Files
saw_mill_knot_detection/MODEL_COMPARISON.md

93 lines
2.5 KiB
Markdown
Raw Normal View History

# Model Framework Comparison
## License Comparison
| Framework | License | Commercial Use | OAK-D Support |
|-----------|---------|----------------|---------------|
| **RT-DETR** | Apache 2.0 | ✅ Free | ⭐ Excellent |
| **YOLOv6** | MIT | ✅ Free | ⭐ Excellent |
| **YOLOX** | MIT | ✅ Free | ⭐ Excellent |
| RF-DETR | Check repo | ⚠️ Unknown | ⚠️ May need conversion |
| YOLOv8/v11 | AGPL-3.0 | ❌ Paid ($1k-5k/yr) | Excellent |
## Performance on OAK-D 4 Pro (48 TOPS INT8)
| Model | Size | Speed (FPS) | Accuracy | Training Time |
|-------|------|-------------|----------|---------------|
| RT-DETR r18 | ~15MB | 30-40 | Good | Fast |
| RT-DETR r34 | ~30MB | 20-30 | Better | Medium |
| YOLOv6n | ~10MB | 40-50 | Good | Fast |
| YOLOv6s | ~20MB | 30-40 | Better | Medium |
| YOLOX nano | ~6MB | 50-60 | Good | Fast |
| YOLOX-s | ~18MB | 35-45 | Better | Medium |
## Which to Choose?
### For Maximum Speed (50-60 FPS):
**YOLOX nano** - Smallest, fastest, proven
### For Best Balance (30-40 FPS):
**RT-DETR r18** or **YOLOv6n** - Modern, accurate
### For Best Accuracy (20-30 FPS):
**RT-DETR r34** or **YOLOv6s** - Larger models
### Recommended Starting Point:
**YOLOv6n** - Great balance, proven OAK compatibility, MIT license
## Training Commands
All models use the same workflow in the GUI, or from command line:
### RT-DETR
```bash
.venv/bin/python train_rtdetr.py \
--dataset-dir dataset_prepared \
--model rtdetr-r18 \
--epochs 100
```
### YOLOv6
```bash
.venv/bin/python train_yolov6.py \
--dataset-dir dataset_prepared \
--model yolov6n \
--epochs 100
```
### YOLOX (YOLOv8 equivalent)
```bash
.venv/bin/python train_yolox.py \
--dataset-dir dataset_prepared \
--model yolox-nano \
--epochs 100
```
## Export for OAK-D
All models export to OpenVINO format for OAK deployment:
```bash
# RT-DETR
.venv/bin/python export_rtdetr_oak.py --weights runs/rtdetr_training/training/weights/best.pt
# YOLOv6/YOLOX use Ultralytics export
.venv/bin/python -c "
from ultralytics import YOLO
model = YOLO('runs/yolov6_training/training/weights/best.pt')
model.export(format='openvino', imgsz=640, half=False)
"
```
Then convert to blob:
- Online: https://blobconverter.luxonis.com/
- CLI: `blobconverter --openvino-xml model.xml`
## Tips
1. **Start with nano/r18 models** for fast iteration
2. **Train for 100-200 epochs** - use early stopping
3. **Collect 200+ images** for good accuracy
4. **Test on OAK-D** before collecting more data
5. **Use INT8 quantization** for full 48 TOPS speed