Downloads · 30 days
0
mustafa005/PassengersLuggagesXrayAnalyzer
PassengersLuggagesXrayAnalyzer is a object detection model from mustafa005. Use it when you need objects located in an image. The card lists the license as mit.
An end-to-end computer vision system that detects prohibited and suspicious items in X-ray baggage scans, built for customs and airport security screening. The project merges 9 public X-ray datasets into one unified t…
Downloads · 30 days
0
Access
Public
Updated Aug 26, 2026
Repo size
856 KB
Likes
0
Public
Click a slice to open those files.
.png856 KB · 93%
From the Hugging Face model README
An end-to-end computer vision system that detects prohibited and suspicious items in X-ray baggage scans, built for customs and airport security screening. The project merges 9 public X-ray datasets into one unified taxonomy, trains 7 specialized YOLOv8 models, and serves them through a single web interface that runs all models on every image and merges their results in real time.
<p align="center"> <img src="assets/detection_example.webp" alt="X-ray detection example" width="720"> </p>Security X-ray screening is a classic multi-class object detection problem, but with a twist: the objects of interest range from knives and firearms to lighters, power banks, and liquids — categories that look nothing alike and don't share visual features. Instead of forcing one model to learn all 38 classes at once, this project takes a divide-and-specialize approach:
The result is a system where any single category can be retrained or improved independently, without retouching the other six models.
| Criterion | Single Model (38 classes) | 7 Models + Ensemble (this project) |
|---|---|---|
| Per-category accuracy | Lower — confuses visually unrelated classes | Higher — each model specializes in one coherent category |
| Inference time per image | Faster (one pass) | Slower (7 passes + merge step) |
| Retraining a single category | Requires retraining everything | Only the affected model needs retraining |
The training data comes from 9 public X-ray datasets (HiXray, GDXray-Baggages, ClCXray, DvXray, HUMSXray, X-ray Contraband, OPIXray, SiXray, and LDXray), each originally published in a different annotation format — custom CSV, COCO JSON, Pascal VOC XML, and pre-formatted YOLO. LDXray was fully converted but excluded from the final training set due to bounding boxes that didn't match object scale.
The raw sources were processed through a 6-stage pipeline:
class x_center y_center width height format.knife, Knife, KnifeCustom) to one final class ID, so adding a new dataset later only requires adding its aliases.classes.txt, dataset.yaml, train.py).7 main categories · 38 total classes, aggregated from overlapping labels across all 9 source datasets.
| Category | # Classes | Classes |
|---|---|---|
| Weapons | 5 | Bat, Baton, Bullet, Gun, HandCuffs |
| Tools | 4 | Hammer, Plier, Screwdriver, Wrench |
| Liquids & Cans | 7 | Cans, CartonDrinks, GlassBottle, PlasticBottle, Tin, VacuumCup, Water |
| Sharp Objects | 12 | Blade, Dagger, Dart, Folding Knife, Knife, Multi-tool Knife, Razor Blade, Saw Blade, Scissors, Straight Knife, SwissArmyKnife, Utility Knife |
| Explosives & Flammable | 7 | Battery, Fireworks, Lighter, Nonmetallic Lighter, Pressure Vessel, SprayCans, Sprayer |
| Cosmetic | 1 | Cosmetic |
| Electronics | 4 | Laptops, Mobile phones, PowerBank, Tablet |
The full numbered class list for every model is available in
all_classes.txt.
Each of the 7 models is trained independently with transfer learning, starting from COCO-pretrained YOLOv8m weights — chosen as a balance between speed and accuracy for a moderate number of classes per category. Key training choices:
The same training script is reused for all 7 categories by simply pointing it to a different dataset config and output path — no code duplication.
A single X-ray scan can contain items from several categories at once (e.g. a weapon and a liquid in the same bag). Rather than picking one model, the app runs all 7 models on every uploaded image simultaneously, then merges the results:
.pt model files are loaded once at startup (not per-request) for fast inference.Each model is assigned a fixed, consistent color for its bounding boxes, so the source model of any detection is visible at a glance directly on the output image.