File size: 4,248 Bytes
5dbce6d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
---

license: apache-2.0
tags:
  - object-detection
  - wildlife
  - thermal
  - rgb
  - drone
  - ultralytics
  - yolo
datasets:
  - custom
pipeline_tag: object-detection
library_name: ultralytics
---


# Wildlife Detection with YOLOv26 β€” Drone RGB & Thermal Models

A collection of five **YOLOv26x** models fine-tuned for **wildlife detection in drone imagery**, supporting both **RGB** and **thermal (infrared)** modalities. Models were trained using the [Ultralytics](https://github.com/ultralytics/ultralytics) framework on 1024Γ—1024 px drone images.

---

## Models Overview

| Model | Modality | Dataset | Epochs | mAP50 | mAP50-95 | Notes |
|---|---|---|---|---|---|---|
| `thermal_original` | Thermal | Original thermal dataset | 25 | 0.217 | β€” | Baseline thermal model |
| `thermal_merged` | Thermal | Original + supplemental thermal data | 23 | 0.390 | 0.250 | Refined thermal model |
| `rgb` | RGB | Full RGB dataset | 72 | 0.946 | 0.655 | Primary RGB model |
| `matched_rgb` | RGB | Matched RGB-thermal pairs | 43 | 0.731 | 0.431 | Cross-modal comparison |
| `matched_thermal` | Thermal | Matched RGB-thermal pairs | 27 | 0.719 | 0.289 | Cross-modal comparison |

> **Matched models** were trained on the same spatially co-registered scene pairs to enable fair modality comparison.

---

## Training Details

All models share the following configuration:

| Parameter | Value |
|---|---|
| Base model | `yolo26x.pt` |
| Image size | 1024 Γ— 1024 px |
| Batch size | 4 |
| Max epochs | 200 |
| Early stopping patience | 20 epochs |
| Optimizer | Auto |
| AMP (mixed precision) | Enabled |
| Close mosaic | Last 10 epochs |
| Data augmentation | RandAugment, erasing (p=0.4), fliplr (p=0.5) |

---

## Repository Structure

```

.

β”œβ”€β”€ README.md

β”œβ”€β”€ inference.py                  # Sample inference code

β”œβ”€β”€ thermal_original/

β”‚   β”œβ”€β”€ weights/

β”‚   β”‚   β”œβ”€β”€ best.pt               # Best checkpoint

β”‚   β”‚   └── last.pt               # Last checkpoint

β”‚   β”œβ”€β”€ args.yaml                 # Training configuration

β”‚   β”œβ”€β”€ results.csv               # Per-epoch training metrics

β”‚   └── results.png               # Training curves

β”œβ”€β”€ thermal_merged/

β”‚   └── ...

β”œβ”€β”€ rgb/

β”‚   └── ...

β”œβ”€β”€ matched_rgb/

β”‚   └── ...

└── matched_thermal/

    └── ...

```

---

## Quick Start

### Installation

```bash

pip install ultralytics

```

### Load a model and run inference

```python

from ultralytics import YOLO



# Choose your model

model = YOLO("rgb/weights/best.pt")          # RGB drone imagery

# model = YOLO("thermal_merged/weights/best.pt")  # Thermal imagery



# Run inference on an image

results = model("path/to/your/image.jpg")



# Display / save results

results[0].show()

results[0].save("output.jpg")



# Access detections

for box in results[0].boxes:

    print(f"Class: {box.cls.item()}, Conf: {box.conf.item():.2f}, BBox: {box.xyxy[0].tolist()}")

```

### Batch inference

```python

from ultralytics import YOLO

from pathlib import Path



model = YOLO("rgb/weights/best.pt")



# Run on a folder of images

results = model(

    source="path/to/images/",

    imgsz=1024,

    conf=0.25,

    iou=0.45,

    save=True,

    project="detections",

    name="run"

)

```

### Modality comparison (matched dataset)

```python

from ultralytics import YOLO



rgb_model     = YOLO("matched_rgb/weights/best.pt")

thermal_model = YOLO("matched_thermal/weights/best.pt")



# Run both models on co-registered image pairs

rgb_results     = rgb_model("rgb_frame.jpg",     imgsz=1024, conf=0.25)

thermal_results = thermal_model("thermal_frame.png", imgsz=1024, conf=0.25)



print(f"RGB detections:     {len(rgb_results[0].boxes)}")

print(f"Thermal detections: {len(thermal_results[0].boxes)}")

```

See **`inference.py`** for a complete script with CLI argument parsing.

---

## Results Visualizations

Training curves, precision-recall curves, and validation batch predictions are included in each model subdirectory (`.png` / `.jpg` files).

---

## License

Apache 2.0 β€” see `LICENSE`.