🖼️ Image Multi-Label Safety Classifier
Repo: abhi099k/image-multi-detect
Framework: PyTorch + ONNX
Task: Multi-label image content classification
Author: Abhinav
🚀 Overview
This model is a professional multi-label image classifier trained to detect multiple safety-related categories simultaneously.
It is optimized for:
- NSFW / adult content detection
- Violence
- Weapons
- Substance categories (smoking, alcohol, drugs)
- Sensitive content
- Hate content
The model supports 8 independent labels, using sigmoid (multi-label) rather than softmax.
🧠 Labels
| Index | Label | Meaning |
|---|
| 0 | nsfw | Nude/sexual content |
| 1 | violence | Physical harm, fighting, blood |
| 2 | weapon | Guns, knives, explosives |
| 3 | smoking | Cigarettes, vaping, smoking activity |
| 4 | alcohol | Alcoholic drinks or consumption |
| 5 | drugs | Illegal drugs, pills, paraphernalia |
| 6 | sensitive | Sensitive contexts (medical, blood, etc.) |
| 7 | hate | Hateful symbols, extremist logos |
📦 Files in Repository
| File | Description |
|---|
best.pth | PyTorch model weights |
model.onnx | ONNX-exported model (recommended for inference) |
metrics_test.json | Evaluation results |
history.json | Training logs |
🔧 Technical Details
Architecture
- Backbone: ResNet-50
- Head: Fully connected layer → 8 logits
- Loss:
BCEWithLogitsLoss
- Optimizer: AdamW
- Mixed precision: Yes
- Balanced sampling: WeightedRandomSampler
Image Size
224 × 224
Training Transformations
- Resize
- Random crop
- Horizontal flip
- Color jitter
- Normalization
📈 Performance
Macro-averaged metrics on test set: