DrAbbas commited on
Commit
ac96323
ยท
verified ยท
1 Parent(s): 9cadf71

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +164 -0
README.md ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - image-classification
5
+ - x-ray
6
+ - customs
7
+ - smuggling-detection
8
+ - sonar
9
+ language:
10
+ - ar
11
+ - en
12
+ ---
13
+
14
+ # ๐Ÿ”ฑ SONAR AI - Customs X-Ray Inspection Models
15
+
16
+ ## Dr. Abbas Fadel Jassim | 2026
17
+
18
+ > AI-powered customs inspection system for X-ray cargo scanning
19
+
20
+ ---
21
+
22
+ ## ๐Ÿ“Š Models Performance Summary
23
+
24
+ | # | Model | Task | Classes | F1 Score | Architecture |
25
+ |---|-------|------|---------|----------|-------------|
26
+ | 1 | **Classification** | ุชุตู†ูŠู ุงู„ุจุถุงุนุฉ | 43 | **94.2%** | Swin-V2 Tiny |
27
+ | 2 | **Concealment** | ูƒุดู ุงู„ุฅุฎูุงุก | 2 | **98.4%** | Swin-V2 Tiny |
28
+ | 3 | **Risk Assessment** | ุชู‚ูŠูŠู… ุงู„ุฎุทูˆุฑุฉ | 5 | **97.3%** | DaViT Tiny |
29
+
30
+ ---
31
+
32
+ ## ๐Ÿ” Model 1: Classification (43 cargo categories)
33
+
34
+ **Task:** Classify X-ray images into 43 different cargo types
35
+
36
+ | Model | Params | Accuracy | F1 Score |
37
+ |-------|--------|----------|----------|
38
+ | ๐Ÿ† **Swin-V2 Tiny** | 27.6M | 94.2% | **94.1%** |
39
+ | ๐Ÿฅˆ **DaViT Tiny** | 27.6M | 94.2% | **94.1%** |
40
+
41
+ ### Per-Class Performance (Swin-V2):
42
+
43
+ | Category | Precision | Recall | F1 | Samples |
44
+ |----------|-----------|--------|-----|---------|
45
+ | appliances | 98.2% | 98.2% | **98.2%** | 57 |
46
+ | auto_parts | 92.6% | 94.3% | **93.5%** | 53 |
47
+ | bags | 100% | 100% | **100%** | 12 |
48
+ | banana | 100% | 100% | **100%** | 40 |
49
+ | batteries | 100% | 88.9% | **94.1%** | 9 |
50
+ | beverages | 71.4% | 100% | **83.3%** | 10 |
51
+ | cables | 100% | 94.4% | **97.1%** | 18 |
52
+ | canned_food | 92.0% | 79.3% | **85.2%** | 29 |
53
+ | ceramic | 97.5% | 97.5% | **97.5%** | 40 |
54
+ | chemicals | 100% | 94.9% | **97.4%** | 39 |
55
+ | cleaning | 91.7% | 91.7% | **91.7%** | 24 |
56
+ | clothes | 91.8% | 96.3% | **94.0%** | 81 |
57
+ | cooking_oil | 76.9% | 100% | **87.0%** | 10 |
58
+ | cosmetics | 100% | 94.1% | **97.0%** | 17 |
59
+ | electronics | 92.7% | 87.9% | **90.3%** | 58 |
60
+ | fruits | 85.7% | 100% | **92.3%** | 6 |
61
+ | furniture | 97.1% | 96.6% | **96.8%** | 174 |
62
+ | glass | 95.2% | 100% | **97.6%** | 20 |
63
+ | kitchenware | 100% | 100% | **100%** | 2 |
64
+ | lubricants | 92.3% | 100% | **96.0%** | 12 |
65
+ | machinery | 87.5% | 95.5% | **91.3%** | 66 |
66
+ | meat | 92.3% | 92.3% | **92.3%** | 13 |
67
+ | medical | 100% | 100% | **100%** | 3 |
68
+ | milk | 98.4% | 98.4% | **98.4%** | 62 |
69
+ | motorcycle | 100% | 66.7% | **80.0%** | 6 |
70
+ | nuts | 92.9% | 100% | **96.3%** | 26 |
71
+
72
+ **Training:** 30 epochs, AdamW (lr=1e-4), CosineAnnealing, Albumentations augmentation
73
+
74
+ ---
75
+
76
+ ## ๐Ÿ” Model 2: Concealment Detection (match vs no_match)
77
+
78
+ **Task:** Detect hidden/smuggled items in X-ray containers
79
+
80
+ | Model | Params | Accuracy | F1 Score |
81
+ |-------|--------|----------|----------|
82
+ | ๐Ÿ† **Swin-V2 Tiny** | 27.6M | 98.4% | **98.4%** |
83
+ | ๐Ÿฅˆ **DaViT Tiny** | 27.6M | 98.4% | **98.4%** |
84
+ | ๐Ÿฅ‰ **EVA-02 Tiny** | 5.5M | 97.8% | **97.8%** |
85
+ | 4๏ธโƒฃ **MaxViT Tiny** | 30.4M | 96.7% | **96.8%** |
86
+
87
+ ### Classes:
88
+ - **match:** Container contents match declaration (6,348 images)
89
+ - **no_match:** Concealed/smuggled items detected (702 images)
90
+
91
+ ---
92
+
93
+ ## โš ๏ธ Model 3: Risk Assessment (5 levels)
94
+
95
+ **Task:** Assess risk level of container cargo
96
+
97
+ | Model | Params | Accuracy | F1 Score |
98
+ |-------|--------|----------|----------|
99
+ | ๐Ÿ† **DaViT Tiny** | 27.6M | 97.2% | **97.3%** |
100
+ | ๐Ÿฅˆ **Swin-V2 Tiny** | 27.6M | 97.2% | **97.2%** |
101
+
102
+ ### Risk Levels:
103
+
104
+ | Level | Name (AR) | Name (EN) | Samples | F1 Score |
105
+ |-------|-----------|-----------|---------|----------|
106
+ | 0 | ุขู…ู† | Safe | 6,355 | **99.1%** |
107
+ | 1-2 | ู…ู†ุฎูุถ | Low | 5 | โš ๏ธ Limited |
108
+ | 3 | ู…ุชูˆุณุท | Medium | 387 | **79.5%** |
109
+ | 4 | ุนุงู„ูŠ | High | 297 | **84.5%** |
110
+ | 5 | ุญุฑุฌ | Critical | 6 | โš ๏ธ Limited |
111
+
112
+ **Note:** Low and Critical levels have very few training samples.
113
+
114
+ ---
115
+
116
+ ## ๐Ÿ“ Files
117
+ ```
118
+ SONAR-AI-Models/
119
+ โ”œโ”€โ”€ concealment/
120
+ โ”‚ โ”œโ”€โ”€ best_swinv2.pth (110 MB, 98.4% F1)
121
+ โ”‚ โ”œโ”€โ”€ best_davit.pth (110 MB, 98.4% F1)
122
+ โ”‚ โ”œโ”€โ”€ best_eva02.pth (22 MB, 97.8% F1)
123
+ โ”‚ โ””โ”€โ”€ best_maxvit.pth (122 MB, 96.8% F1)
124
+ โ”œโ”€โ”€ classification/
125
+ โ”‚ โ”œโ”€โ”€ best_swinv2_43cls.pth (110 MB, 94.1% F1)
126
+ โ”‚ โ””โ”€โ”€ best_davit_43cls.pth (110 MB, 94.1% F1)
127
+ โ”œโ”€โ”€ risk/
128
+ โ”‚ โ”œโ”€โ”€ best_swinv2_risk.pth (110 MB, 97.2% F1)
129
+ โ”‚ โ””โ”€โ”€ best_davit_risk.pth (110 MB, 97.3% F1)
130
+ โ””โ”€โ”€ results/
131
+ โ”œโ”€โ”€ classification_cm.png
132
+ โ”œโ”€โ”€ classification_training.png
133
+ โ”œโ”€โ”€ risk_cm.png
134
+ โ””โ”€โ”€ risk_training.png
135
+ ```
136
+
137
+ ## ๐Ÿ› ๏ธ Usage
138
+ ```python
139
+ import timm, torch
140
+ from torchvision import transforms
141
+ from PIL import Image
142
+
143
+ # Load model
144
+ model = timm.create_model('swinv2_tiny_window8_256', pretrained=False, num_classes=43)
145
+ ckpt = torch.load('classification/best_swinv2_43cls.pth', map_location='cpu')
146
+ model.load_state_dict(ckpt['model_state_dict'])
147
+ model.eval()
148
+
149
+ # Inference
150
+ tf = transforms.Compose([
151
+ transforms.Resize((256, 256)),
152
+ transforms.ToTensor(),
153
+ transforms.Normalize([0.485,0.456,0.406], [0.229,0.224,0.225])
154
+ ])
155
+ img = tf(Image.open('xray.jpg').convert('RGB')).unsqueeze(0)
156
+ with torch.no_grad():
157
+ pred = model(img).argmax(1).item()
158
+ ```
159
+
160
+ ## ๐Ÿ“œ License
161
+ Apache 2.0
162
+
163
+ ## ๐Ÿ‘จโ€๐Ÿ’ป Author
164
+ **Dr. Abbas Fadel Jassim** - 2026