Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,78 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
metrics:
|
| 4 |
+
- accuracy
|
| 5 |
+
---
|
| 6 |
+
# 🖼️ Image Multi-Label Safety Classifier
|
| 7 |
+
**Repo:** `abhi099k/image-multi-detect`
|
| 8 |
+
**Framework:** PyTorch + ONNX
|
| 9 |
+
**Task:** Multi-label image content classification
|
| 10 |
+
**Author:** Abhinav
|
| 11 |
+
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
## 🚀 Overview
|
| 15 |
+
This model is a **professional multi-label image classifier** trained to detect multiple safety-related categories simultaneously.
|
| 16 |
+
It is optimized for:
|
| 17 |
+
|
| 18 |
+
- NSFW / adult content detection
|
| 19 |
+
- Violence
|
| 20 |
+
- Weapons
|
| 21 |
+
- Substance categories (smoking, alcohol, drugs)
|
| 22 |
+
- Sensitive content
|
| 23 |
+
- Hate content
|
| 24 |
+
|
| 25 |
+
The model supports **8 independent labels**, using **sigmoid (multi-label)** rather than softmax.
|
| 26 |
+
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
## 🧠 Labels
|
| 30 |
+
|
| 31 |
+
| Index | Label | Meaning |
|
| 32 |
+
|-------|------------|---------|
|
| 33 |
+
| 0 | `nsfw` | Nude/sexual content |
|
| 34 |
+
| 1 | `violence` | Physical harm, fighting, blood |
|
| 35 |
+
| 2 | `weapon` | Guns, knives, explosives |
|
| 36 |
+
| 3 | `smoking` | Cigarettes, vaping, smoking activity |
|
| 37 |
+
| 4 | `alcohol` | Alcoholic drinks or consumption |
|
| 38 |
+
| 5 | `drugs` | Illegal drugs, pills, paraphernalia |
|
| 39 |
+
| 6 | `sensitive` | Sensitive contexts (medical, blood, etc.) |
|
| 40 |
+
| 7 | `hate` | Hateful symbols, extremist logos |
|
| 41 |
+
|
| 42 |
+
---
|
| 43 |
+
|
| 44 |
+
## 📦 Files in Repository
|
| 45 |
+
|
| 46 |
+
| File | Description |
|
| 47 |
+
|------|-------------|
|
| 48 |
+
| `best.pth` | PyTorch model weights |
|
| 49 |
+
| `model.onnx` | ONNX-exported model (recommended for inference) |
|
| 50 |
+
| `metrics_test.json` | Evaluation results |
|
| 51 |
+
| `history.json` | Training logs |
|
| 52 |
+
|
| 53 |
+
---
|
| 54 |
+
|
| 55 |
+
## 🔧 Technical Details
|
| 56 |
+
|
| 57 |
+
### Architecture
|
| 58 |
+
- **Backbone:** ResNet-50
|
| 59 |
+
- **Head:** Fully connected layer → 8 logits
|
| 60 |
+
- **Loss:** `BCEWithLogitsLoss`
|
| 61 |
+
- **Optimizer:** AdamW
|
| 62 |
+
- **Mixed precision:** Yes
|
| 63 |
+
- **Balanced sampling:** WeightedRandomSampler
|
| 64 |
+
|
| 65 |
+
### Image Size
|
| 66 |
+
`224 × 224`
|
| 67 |
+
|
| 68 |
+
### Training Transformations
|
| 69 |
+
- Resize
|
| 70 |
+
- Random crop
|
| 71 |
+
- Horizontal flip
|
| 72 |
+
- Color jitter
|
| 73 |
+
- Normalization
|
| 74 |
+
|
| 75 |
+
---
|
| 76 |
+
|
| 77 |
+
## 📈 Performance
|
| 78 |
+
Macro-averaged metrics on test set:
|