Update README.md
Browse files
README.md
CHANGED
|
@@ -48,7 +48,6 @@ Our custom threat detection dataset was meticulously curated and annotated to en
|
|
| 48 |
|
| 49 |
The model is trained to detect threats across various scales, from small concealed weapons to larger explosive devices.
|
| 50 |
|
| 51 |
-
---
|
| 52 |
## Performance Metrics
|
| 53 |
|
| 54 |
### Training Performance
|
|
@@ -85,52 +84,6 @@ The training process demonstrates excellent convergence with:
|
|
| 85 |
- **Consistent recall** of 83-85% across all threat categories
|
| 86 |
- **Robust generalization** from validation to test performance
|
| 87 |
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
# Install dependencies
|
| 91 |
-
pip install torch torchvision
|
| 92 |
-
pip install supervision
|
| 93 |
-
pip install rfdetr
|
| 94 |
-
pip install pillow requests numpy
|
| 95 |
-
```
|
| 96 |
-
|
| 97 |
-
### Basic Usage
|
| 98 |
-
|
| 99 |
-
```python
|
| 100 |
-
import numpy as np
|
| 101 |
-
import supervision as sv
|
| 102 |
-
from PIL import Image
|
| 103 |
-
from rfdetr import RFDETRNano
|
| 104 |
-
|
| 105 |
-
# Load the model
|
| 106 |
-
model = RFDETRNano(
|
| 107 |
-
resolution=640,
|
| 108 |
-
pretrain_weights="checkpoint_best_total.pth"
|
| 109 |
-
)
|
| 110 |
-
model.optimize_for_inference()
|
| 111 |
-
|
| 112 |
-
# Load and process image
|
| 113 |
-
image = Image.open("your_image.jpg")
|
| 114 |
-
detections = model.predict(image, threshold=0.5)
|
| 115 |
-
|
| 116 |
-
# Threat class mapping
|
| 117 |
-
THREAT_CLASSES = {
|
| 118 |
-
1: "gun",
|
| 119 |
-
2: "explosive",
|
| 120 |
-
3: "grenade",
|
| 121 |
-
4: "knife"
|
| 122 |
-
}
|
| 123 |
-
|
| 124 |
-
# Generate labels
|
| 125 |
-
labels = [
|
| 126 |
-
f"{THREAT_CLASSES[class_id]} {confidence:.2f}"
|
| 127 |
-
for class_id, confidence in zip(detections.class_id, detections.confidence)
|
| 128 |
-
]
|
| 129 |
-
|
| 130 |
-
print(f"Detected {len(labels)} threats: {labels}")
|
| 131 |
-
```
|
| 132 |
-
|
| 133 |
-
|
| 134 |
## Model Architecture
|
| 135 |
|
| 136 |
- **Base Architecture**: RF-DETR Nano
|
|
|
|
| 48 |
|
| 49 |
The model is trained to detect threats across various scales, from small concealed weapons to larger explosive devices.
|
| 50 |
|
|
|
|
| 51 |
## Performance Metrics
|
| 52 |
|
| 53 |
### Training Performance
|
|
|
|
| 84 |
- **Consistent recall** of 83-85% across all threat categories
|
| 85 |
- **Robust generalization** from validation to test performance
|
| 86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
## Model Architecture
|
| 88 |
|
| 89 |
- **Base Architecture**: RF-DETR Nano
|