DroneFlow — YOLOv8n fine-tuned on VisDrone (vehicles only)
A YOLOv8n detector fine-tuned on VisDrone2019-DET, restricted to the five vehicle classes used by the DroneFlow traffic-flow pipeline. It is meant for aerial/drone footage of road traffic, where objects are small and dense.
| id | class |
|---|---|
| 0 | car |
| 1 | van |
| 2 | truck |
| 3 | bus |
| 4 | motor |
Pedestrians, people, bicycles, tricycles and awning-tricycles are not detected — their annotations were removed from the training data on purpose (see Training data below).
Metrics
Evaluated with model.val() at imgsz=1280, outside the training loop.
| split | images | mAP50 | mAP50-95 | precision | recall |
|---|---|---|---|---|---|
| val | 548 | 0.6044 | 0.4038 | 0.6723 | 0.5690 |
| test-dev | 1610 | 0.5347 | 0.3399 | 0.6154 | 0.5257 |
Per class on test-dev — the split comparable with published VisDrone results:
| class | mAP50 | mAP50-95 | recall | instances |
|---|---|---|---|---|
car | 0.7990 | 0.5122 | 0.7901 | 28,074 |
bus | 0.5960 | 0.4255 | 0.5451 | 2,940 |
truck | 0.4530 | 0.2968 | 0.4920 | 2,659 |
van | 0.4459 | 0.3055 | 0.4163 | 5,771 |
motor | 0.3797 | 0.1598 | 0.3848 | 5,845 |
Per class on val:
| class | mAP50 | mAP50-95 | recall | instances |
|---|---|---|---|---|
car | 0.8603 | 0.6116 | 0.8299 | 14,064 |
bus | 0.6436 | 0.4648 | 0.5896 | 251 |
motor | 0.5598 | 0.2617 | 0.5139 | 4,886 |
van | 0.5257 | 0.3816 | 0.4967 | 1,975 |
truck | 0.4324 | 0.2994 | 0.4147 | 750 |
Full numbers, including speed, are in metrics.json. The training curve is in
results.csv.
Usage
With Ultralytics directly:
from ultralytics import YOLO
model = YOLO("best.pt") # or hf_hub_download(...) first
results = model.predict("frame.jpg", imgsz=1280, conf=0.35)
Use imgsz=1280 at inference. The model was trained at that resolution and
VisDrone is dominated by small objects; running at 640 costs a large amount of
recall.
With the DroneFlow CLI, which resolves and caches Hub weights on its own:
droneflow detect \
--model hf://sobucki/droneflow-yolov8n-visdrone-vehicles/weights/best.pt@v1-vehicles-1280 \
--imgsz 1280 --video analysis_video.mp4 --crop-metadata crop_metadata.json --output detections.csv
Pinning the tag matters for reproducibility: DroneFlow records the resolved
commit in its run_metadata.json, so a run stays traceable even if the tag moves.
Training data
Derived from VisDrone2019-DET (Tianjin University). The original 10 classes
were reduced to 5 by dropping the annotations of pedestrian, people,
bicycle, tricycle and awning-tricycle and remapping the remaining class
ids. More than a third of the original annotations were discarded this way —
capacity that would otherwise be spent on categories the pipeline never counts.
| split | images | notes |
|---|---|---|
| train | 6,471 | 184 images (2.8%) end up with no annotation and are kept as background images |
| val | 548 | |
| test-dev | 1,610 |
Training-set class balance, which explains most of the per-class spread above:
| class | instances | share |
|---|---|---|
car | 144,867 | 66.4% |
motor | 29,647 | 13.6% |
van | 24,956 | 11.4% |
truck | 12,875 | 5.9% |
bus | 5,926 | 2.7% |
The conversion script is training/scripts/prepare_visdrone_vehicles.py in the
project repository.
Training
| base weights | yolov8n.pt (COCO-pretrained) |
| epochs | 60 (completed, no early stop) |
| image size | 1280 |
| batch | 4 |
| optimizer | auto → AdamW, lr₀ ≈ 0.001111, momentum 0.9 |
| seed | 0 |
| close_mosaic | 10 |
| AMP | enabled |
| device | Apple M4 Pro (MPS) |
Environment: Python 3.12.14, PyTorch 2.13.0, Ultralytics 8.4.131, macOS. Inference speed measured during validation at 1280 on MPS: 4.0 ms inference + 5.0 ms postprocessing per image.
Every hyperparameter, the dataset configuration with its sha256, and the full
environment are recorded in args.yaml and train_metadata.json, both published
alongside the weights.
Limitations
motorandtruckare weak (mAP50 0.38 and 0.45 on test-dev). Motorcycles are only a handful of pixels at typical drone altitude; if your application depends on counting them, validate before trusting it.- Severe class imbalance.
caris 66% of the training instances and is by far the best-detected class. The ranking of the other four largely follows their frequency. - Domain gap. Training data is VisDrone footage captured in China. This model has never seen the Passo Fundo (Brazil) footage the DroneFlow project targets, and the project's validation against manual counting is a separate experiment whose results are not reflected here.
- Nano model.
yolov8nwas chosen for speed on consumer hardware. A larger backbone would very likely do better on the small-object classes. - The model detects vehicles only; it does not track them or count movements. That is the job of the surrounding pipeline.
Licenses
Two layers apply, and both must be respected:
- Weights and code: AGPL-3.0, inherited from Ultralytics YOLOv8.
- Training data: VisDrone2019-DET, by Tianjin University (VisDrone-Dataset), released for academic use. Check the dataset's own terms before any redistribution or commercial use of derivatives.
Please cite VisDrone if you use this model in academic work.
Sobre este modelo (PT)
Este modelo faz parte do TCC "Análise de fluxo de trânsito através de visão computacional utilizando filmagens de drone" (Ciência da Computação, Universidade de Passo Fundo), que constrói uma pipeline para contar veículos e identificar movimentos em cruzamentos a partir de vídeo aéreo.
O yolov8n pré-treinado em COCO não dá conta de objetos pequenos vistos de cima,
e as classes do COCO não batem com a taxonomia de veículos que o trabalho precisa.
Este fine-tuning no VisDrone, restrito a car, van, truck, bus e motor,
é a etapa de detecção dessa pipeline.
O número a citar é o do split test-dev: mAP50 de 0,535 e mAP50-95 de 0,340.
O split val (0,604 / 0,404) foi usado durante o desenvolvimento e é otimista em
comparação.
Duas ressalvas importantes para leitura dos resultados: motor e truck ficam
bem abaixo das demais classes, o que decorre em boa parte do desbalanceamento do
VisDrone; e o modelo foi treinado sobre imagens do VisDrone, não sobre os vídeos
de Passo Fundo cedidos pela Secretaria de Planejamento — a validação contra
contagem manual é um experimento à parte, e os números daqui não a substituem.
Os artefatos de proveniência (args.yaml, results.csv, metrics.json,
train_metadata.json) estão publicados junto dos pesos para que o experimento
inteiro possa ser auditado e reproduzido.