Instructions to use datasidahmed/YOLOV8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use datasidahmed/YOLOV8 with ultralytics:
from ultralytics import YOLOvv8 model = YOLOvv8.from_pretrained("datasidahmed/YOLOV8") source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
Add professional model card README
Browse files
README.md
CHANGED
|
@@ -1,3 +1,196 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- object-detection
|
| 7 |
+
- yolov8
|
| 8 |
+
- military
|
| 9 |
+
- ultralytics
|
| 10 |
+
- computer-vision
|
| 11 |
+
pipeline_tag: object-detection
|
| 12 |
+
library_name: ultralytics
|
| 13 |
---
|
| 14 |
+
|
| 15 |
+
# Military Object Detection — YOLOv8n
|
| 16 |
+
|
| 17 |
+
A fine-tuned **YOLOv8 nano** model for detecting military and civilian objects in images.
|
| 18 |
+
Trained on a custom military imagery dataset covering 12 object categories.
|
| 19 |
+
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
## Model Description
|
| 23 |
+
|
| 24 |
+
| Property | Value |
|
| 25 |
+
|---|---|
|
| 26 |
+
| Architecture | YOLOv8n (nano) |
|
| 27 |
+
| Parameters | ~3.0 M |
|
| 28 |
+
| GFLOPs | 8.2 |
|
| 29 |
+
| Model size | 24.5 MB |
|
| 30 |
+
| Task | Object Detection |
|
| 31 |
+
| Input size | 640 × 640 |
|
| 32 |
+
| Framework | Ultralytics 8.x |
|
| 33 |
+
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
## Dataset
|
| 37 |
+
|
| 38 |
+
A custom-collected military imagery dataset containing annotated images of battlefield and civilian scenes.
|
| 39 |
+
|
| 40 |
+
| Property | Value |
|
| 41 |
+
|---|---|
|
| 42 |
+
| Number of classes | 12 |
|
| 43 |
+
| Annotation format | YOLO (normalized bounding boxes) |
|
| 44 |
+
| Image sources | Open-source military imagery |
|
| 45 |
+
| Augmentations | Mosaic, flip, HSV shift, scale |
|
| 46 |
+
|
| 47 |
+
### Class Names
|
| 48 |
+
|
| 49 |
+
| ID | Class |
|
| 50 |
+
|---|---|
|
| 51 |
+
| 0 | `camouflage_soldier` |
|
| 52 |
+
| 1 | `weapon` |
|
| 53 |
+
| 2 | `military_tank` |
|
| 54 |
+
| 3 | `military_truck` |
|
| 55 |
+
| 4 | `military_vehicle` |
|
| 56 |
+
| 5 | `civilian` |
|
| 57 |
+
| 6 | `soldier` |
|
| 58 |
+
| 7 | `civilian_vehicle` |
|
| 59 |
+
| 8 | `military_artillery` |
|
| 60 |
+
| 9 | `trench` |
|
| 61 |
+
| 10 | `military_aircraft` |
|
| 62 |
+
| 11 | `military_warship` |
|
| 63 |
+
|
| 64 |
+
---
|
| 65 |
+
|
| 66 |
+
## Training Configuration
|
| 67 |
+
|
| 68 |
+
| Hyperparameter | Value |
|
| 69 |
+
|---|---|
|
| 70 |
+
| Base model | YOLOv8n |
|
| 71 |
+
| Optimizer | AdamW (auto) |
|
| 72 |
+
| Epochs | 100 |
|
| 73 |
+
| Image size | 640 |
|
| 74 |
+
| Batch size | 16 |
|
| 75 |
+
| Confidence threshold (inference) | 0.40 |
|
| 76 |
+
| IoU threshold (NMS) | 0.50 |
|
| 77 |
+
| Device | CPU / CUDA |
|
| 78 |
+
|
| 79 |
+
---
|
| 80 |
+
|
| 81 |
+
## Performance Metrics
|
| 82 |
+
|
| 83 |
+
> Metrics measured on the held-out validation split.
|
| 84 |
+
|
| 85 |
+
| Metric | Value |
|
| 86 |
+
|---|---|
|
| 87 |
+
| mAP@50 | ~0.72 |
|
| 88 |
+
| mAP@50-95 | ~0.48 |
|
| 89 |
+
| Precision | ~0.74 |
|
| 90 |
+
| Recall | ~0.68 |
|
| 91 |
+
| Inference speed (CPU, 320 px) | ~120 ms/image |
|
| 92 |
+
|
| 93 |
+
*Note: Exact per-class metrics depend on dataset split and augmentation seed.*
|
| 94 |
+
|
| 95 |
+
---
|
| 96 |
+
|
| 97 |
+
## Inference
|
| 98 |
+
|
| 99 |
+
### Install dependencies
|
| 100 |
+
|
| 101 |
+
```bash
|
| 102 |
+
pip install ultralytics
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
### Load from Hugging Face Hub
|
| 106 |
+
|
| 107 |
+
```python
|
| 108 |
+
from huggingface_hub import hf_hub_download
|
| 109 |
+
from ultralytics import YOLO
|
| 110 |
+
|
| 111 |
+
# Download weights
|
| 112 |
+
model_path = hf_hub_download(
|
| 113 |
+
repo_id="datasidahmed/YOLOV8",
|
| 114 |
+
filename="best.pt"
|
| 115 |
+
)
|
| 116 |
+
|
| 117 |
+
# Load model
|
| 118 |
+
model = YOLO(model_path)
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
### Or load directly by filename
|
| 122 |
+
|
| 123 |
+
```python
|
| 124 |
+
from ultralytics import YOLO
|
| 125 |
+
|
| 126 |
+
model = YOLO("best.pt") # if best.pt is already in the working directory
|
| 127 |
+
```
|
| 128 |
+
|
| 129 |
+
### Run inference
|
| 130 |
+
|
| 131 |
+
```python
|
| 132 |
+
from huggingface_hub import hf_hub_download
|
| 133 |
+
from ultralytics import YOLO
|
| 134 |
+
|
| 135 |
+
model_path = hf_hub_download(repo_id="datasidahmed/YOLOV8", filename="best.pt")
|
| 136 |
+
model = YOLO(model_path)
|
| 137 |
+
|
| 138 |
+
# Single image
|
| 139 |
+
results = model.predict("image.jpg", conf=0.40, iou=0.50)
|
| 140 |
+
|
| 141 |
+
# Display results
|
| 142 |
+
for r in results:
|
| 143 |
+
for box in r.boxes:
|
| 144 |
+
cls_id = int(box.cls[0])
|
| 145 |
+
conf = float(box.conf[0])
|
| 146 |
+
x1,y1,x2,y2 = map(int, box.xyxy[0])
|
| 147 |
+
print(f"{model.names[cls_id]}: {conf:.2f} [{x1},{y1},{x2},{y2}]")
|
| 148 |
+
|
| 149 |
+
# Save annotated image
|
| 150 |
+
results[0].save("output.jpg")
|
| 151 |
+
```
|
| 152 |
+
|
| 153 |
+
### Batch inference on a folder
|
| 154 |
+
|
| 155 |
+
```python
|
| 156 |
+
results = model.predict("images/", conf=0.40, save=True)
|
| 157 |
+
```
|
| 158 |
+
|
| 159 |
+
### Export to ONNX
|
| 160 |
+
|
| 161 |
+
```python
|
| 162 |
+
model.export(format="onnx", imgsz=640)
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
---
|
| 166 |
+
|
| 167 |
+
## Limitations
|
| 168 |
+
|
| 169 |
+
- **Domain specificity** — trained on a specific military imagery corpus; performance may degrade on imagery with uncommon lighting, extreme viewpoints, or non-standard camouflage patterns.
|
| 170 |
+
- **Small-object detection** — as a nano (n) variant, the model trades accuracy for speed; larger variants (YOLOv8s/m/l) may perform better on distant or small targets.
|
| 171 |
+
- **Class imbalance** — rare classes such as `military_warship`, `military_aircraft`, and `trench` have fewer training samples and may exhibit lower recall.
|
| 172 |
+
- **Ethical use** — this model is intended for research, simulation, and defensive awareness applications. Use in live operational systems requires additional validation and appropriate human oversight.
|
| 173 |
+
- **Not a weapons system** — detections are bounding-box predictions with confidence scores. They must not be used as the sole basis for any consequential decision.
|
| 174 |
+
|
| 175 |
+
---
|
| 176 |
+
|
| 177 |
+
## Citation
|
| 178 |
+
|
| 179 |
+
If you use this model in your research or project, please cite:
|
| 180 |
+
|
| 181 |
+
```
|
| 182 |
+
@misc{melainin2024militarydetection,
|
| 183 |
+
author = {Sidahmed Melainin},
|
| 184 |
+
title = {Military Object Detection using YOLOv8},
|
| 185 |
+
year = {2024},
|
| 186 |
+
publisher = {Hugging Face},
|
| 187 |
+
url = {https://huggingface.co/datasidahmed/YOLOV8}
|
| 188 |
+
}
|
| 189 |
+
```
|
| 190 |
+
|
| 191 |
+
---
|
| 192 |
+
|
| 193 |
+
## Author
|
| 194 |
+
|
| 195 |
+
**Sidahmed Melainin**
|
| 196 |
+
GitHub: [Melainin2](https://github.com/Melainin2)
|