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|
| 5 |
+
- segmentation
|
| 6 |
+
- overlay-detection
|
| 7 |
+
- computer-vision
|
| 8 |
+
- instance-segmentation
|
| 9 |
+
library_name: ultralytics
|
| 10 |
+
license: agpl-3.0
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# YOLO Overlay Detection Model - Optimized
|
| 14 |
+
|
| 15 |
+
This model was trained to detect and segment overlay elements in images/videos using YOLOv8 segmentation with optimized hyperparameters.
|
| 16 |
+
|
| 17 |
+
## Model Details
|
| 18 |
+
|
| 19 |
+
- **Model Type**: YOLOv8 Instance Segmentation
|
| 20 |
+
- **Architecture**: auto
|
| 21 |
+
- **Framework**: Ultralytics YOLO
|
| 22 |
+
- **Training Date**: 2025-11-07
|
| 23 |
+
- **Task**: Instance Segmentation
|
| 24 |
+
- **Classes**: Overlay elements
|
| 25 |
+
- **Image Size**: 800px (optimized for detail)
|
| 26 |
+
|
| 27 |
+
## Performance Metrics
|
| 28 |
+
|
| 29 |
+
| Metric | Value |
|
| 30 |
+
|--------|-------|
|
| 31 |
+
| Box mAP@0.5 | 0.9038 |
|
| 32 |
+
| Box mAP@0.5:0.95 | 0.7171 |
|
| 33 |
+
| Mask mAP@0.5 | 0.3981 |
|
| 34 |
+
| Mask mAP@0.5:0.95 | 0.1520 |
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
## Key Optimizations
|
| 38 |
+
|
| 39 |
+
This model includes several optimizations over the baseline:
|
| 40 |
+
|
| 41 |
+
- ✅ **Mosaic Augmentation** enabled (1.0) - Critical for YOLO performance
|
| 42 |
+
- ✅ **Copy-Paste Augmentation** (0.3) - Essential for segmentation tasks
|
| 43 |
+
- ✅ **Larger Image Size** (800px) - Better detail capture
|
| 44 |
+
- ✅ **Cosine LR Scheduler** - Smoother convergence
|
| 45 |
+
- ✅ **Multi-Scale Training** - Better scale invariance
|
| 46 |
+
- ✅ **Enhanced Augmentations** - Rotation (10°), Scale (0.5), Perspective
|
| 47 |
+
- ✅ **Optimized Batch Size** (32) - Better gradient estimates on dual GPUs
|
| 48 |
+
|
| 49 |
+
## Usage
|
| 50 |
+
|
| 51 |
+
### Installation
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
pip install ultralytics
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
### Inference
|
| 58 |
+
|
| 59 |
+
```python
|
| 60 |
+
from ultralytics import YOLO
|
| 61 |
+
from huggingface_hub import hf_hub_download
|
| 62 |
+
|
| 63 |
+
# Download model
|
| 64 |
+
model_path = hf_hub_download(
|
| 65 |
+
repo_id="farazv2/overlay-model-yolo",
|
| 66 |
+
filename="best.pt"
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
# Load model
|
| 70 |
+
model = YOLO(model_path)
|
| 71 |
+
|
| 72 |
+
# Run inference
|
| 73 |
+
results = model('image.jpg')
|
| 74 |
+
|
| 75 |
+
# Process results
|
| 76 |
+
for result in results:
|
| 77 |
+
boxes = result.boxes # Bounding boxes
|
| 78 |
+
masks = result.masks # Segmentation masks
|
| 79 |
+
|
| 80 |
+
# Visualize
|
| 81 |
+
result.show()
|
| 82 |
+
|
| 83 |
+
# Save
|
| 84 |
+
result.save('output.jpg')
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
### Batch Inference
|
| 88 |
+
|
| 89 |
+
```python
|
| 90 |
+
# Process multiple images
|
| 91 |
+
results = model(['image1.jpg', 'image2.jpg', 'image3.jpg'])
|
| 92 |
+
|
| 93 |
+
# Process video
|
| 94 |
+
results = model('video.mp4', save=True)
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
## Training Configuration
|
| 98 |
+
|
| 99 |
+
| Parameter | Value | Notes |
|
| 100 |
+
|-----------|-------|-------|
|
| 101 |
+
| Epochs | 10 | |
|
| 102 |
+
| Image Size | 800 | Increased from 640 |
|
| 103 |
+
| Batch Size | 16 | Optimized for dual T4 |
|
| 104 |
+
| Optimizer | AdamW | |
|
| 105 |
+
| Initial LR | 0.0005 | With cosine scheduler |
|
| 106 |
+
| Mosaic | 1.0 | Re-enabled (critical!) |
|
| 107 |
+
| Copy-Paste | 0.3 | New addition |
|
| 108 |
+
| Multi-Scale | True | Enabled |
|
| 109 |
+
| Mixed Precision | True | Enabled |
|
| 110 |
+
| Patience | 25 | |
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
## Model Export
|
| 114 |
+
|
| 115 |
+
The model can be exported to various formats:
|
| 116 |
+
|
| 117 |
+
```python
|
| 118 |
+
from ultralytics import YOLO
|
| 119 |
+
|
| 120 |
+
model = YOLO('best.pt')
|
| 121 |
+
|
| 122 |
+
# Export to ONNX
|
| 123 |
+
model.export(format='onnx')
|
| 124 |
+
|
| 125 |
+
# Export to TensorRT
|
| 126 |
+
model.export(format='engine')
|
| 127 |
+
|
| 128 |
+
# Export to CoreML
|
| 129 |
+
model.export(format='coreml')
|
| 130 |
+
```
|
| 131 |
+
|
| 132 |
+
## Citation
|
| 133 |
+
|
| 134 |
+
If you use this model, please cite:
|
| 135 |
+
|
| 136 |
+
```bibtex
|
| 137 |
+
@software{overlay_yolo_model,
|
| 138 |
+
author = {farazv2},
|
| 139 |
+
title = {YOLO Overlay Detection Model - Optimized},
|
| 140 |
+
year = {2025},
|
| 141 |
+
publisher = {HuggingFace},
|
| 142 |
+
url = {https://huggingface.co/farazv2/overlay-model-yolo}
|
| 143 |
+
}
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
## License
|
| 147 |
+
|
| 148 |
+
This model is released under the AGPL-3.0 license, following Ultralytics YOLOv8 licensing.
|
| 149 |
+
|
| 150 |
+
## Acknowledgments
|
| 151 |
+
|
| 152 |
+
- Built with [Ultralytics YOLOv8](https://github.com/ultralytics/ultralytics)
|
| 153 |
+
- Trained on Kaggle with GPU acceleration
|
| 154 |
+
- Optimized with best practices for segmentation tasks
|