YOLO11n-VN: High-Precision Vietnamese Traffic Vehicle Detector
A lightweight, production-ready YOLO11n model (~2.6M parameters, 6.5 GFLOPs) specifically fine-tuned for dense Vietnamese traffic vehicle detection and line-crossing counting under diverse weather and lighting conditions.
Developed and trained on an NVIDIA A100 GPU using a curated dataset of 62,485 images combining Ho Chi Minh City CCTV traffic video streams (VN2V-Weather: sunny, rainy, night, hazy), UVH-26, and synthetic adverse weather augmentations.
🚀 Quick Start
1. Installation
pip install ultralytics torch torchvision
2. Download Weights & Run Inference
from ultralytics import YOLO
# Load the lightweight Version 2 deployment model (FP16, 5.3 MB)
model = YOLO("yolo11n_vn_v2_deploy.pt")
# Run inference on an image or video
results = model.predict(
source="path/to/traffic.jpg",
imgsz=1024,
conf=0.45,
iou=0.5,
device=0 # or 'cpu'
)
# Display or save results
for r in results:
boxes = r.boxes
for box, cls, conf in zip(boxes.xyxy, boxes.cls, boxes.conf):
print(f"Detected {model.names[int(cls)]} ({conf:.2f}) at {box.tolist()}")
r.save(filename="output.jpg")
🏷️ Class Taxonomy
The detector recognizes 4 vehicle categories matching Vietnamese urban road composition:
| Class ID | Class Name | Description |
|---|---|---|
0 | car | Sedans, SUVs, hatchbacks, taxis, pickups, vans |
1 | motorbike | Motorcycles, scooters, e-bikes |
2 | bus | Public buses, coaches, minibuses |
3 | truck | Light cargo trucks, heavy freight trucks, container trucks |
📊 Benchmark & Performance Summary
Internal Validation & Frozen Benchmarks
| Metric / Benchmark | Version 1 (Baseline) | Version 2 (Close-Mosaic & Hi-Res) | Notes |
|---|---|---|---|
| Validation mAP50 | 88.44% | 88.91% | New all-time high |
| Validation mAP50-95 | 74.95% | 75.43% | New all-time high |
| Validation Precision | 83.74% | 86.34% | +2.6% improvement |
| Train Box Loss | 0.8627 | 0.6665 | -22.7% (much tighter bounding boxes) |
| Dev2048 Raw Precision | 62.26% | 69.89% | +7.63% |
| Dev2048 Postproc Precision | 66.72% | 72.76% | +6.04% |
| Dev2048 False Positives/frame | 1.123 | 0.789 | 30% reduction in false detections |
| Test Motorbike Raw Precision | 69.42% | 74.86% | >90% at conf=0.60 |
| Test Overall Recall | 91.10% | 94.04% | Catches 94% of traffic flow |
External Independent Benchmarks (VisDrone2019-DET)
Evaluated on 548 high-angle dense traffic images (21,926 annotated vehicles):
| Class | Precision @ conf=0.45 | Precision @ conf=0.55 | Recall |
|---|---|---|---|
| Car | 94.8% | 95.8% | 36.5% |
| Bus | 79.4% | 85.7% | 30.7% |
| Overall | 82.88% | 86.10% | 30.14% |
📦 Repository Contents
yolo11n_vn_v2_deploy.pt— Recommended: Version 2 lightweight deployment model (FP16, 5.3 MB).yolo11n_vn_v1_deploy.pt— Version 1 deployment model (FP16, 5.3 MB).checkpoint_v2_best.pt— Full Version 2 training checkpoint (includes optimizer & EMA state, 26 MB).checkpoint_v1_best.pt— Full Version 1 training checkpoint (26 MB).vn_mix_4cls.yaml— Dataset metadata and class definitions.eval_v2_dev2048.json— Evaluation report on dev2048 screening split.eval_v2_test.json— Evaluation report on frozen 7,608 test video frames.visdrone_v2_report.json— Evaluation report on VisDrone2019-DET validation set.
🛠️ Training Specifications
- Base Architecture: YOLO11n (
ultralytics) - Parameters: 2,590,620 (~2.6M)
- Computational Cost: 6.5 GFLOPs
- Image Resolution: 1024 × 1024 (inference supported at 640 to 1280)
- Hardware: NVIDIA A100-PCIE-40GB
- Optimizer: AdamW (
lr0=0.0002, Cosine annealing) - Dataset Size: 62,485 training images, 1,891 validation images