YOLOv8n β€” Bangladeshi Urban Traffic Detection

A YOLOv8n model fine-tuned on Bangladeshi roadside traffic footage to detect and classify 9 vehicle and pedestrian types common in South Asian urban environments. Designed for real-time inference β€” 3.4 ms per image on GPU, ~15 FPS end-to-end in the streaming pipeline.

Evaluation Results

Evaluated on 4,736 validation images (52,850 instances).

Class Images Instances P R mAP@50 mAP@50-95
All 4736 52850 0.701 0.713 0.762 0.528
Bike 2135 3173 0.774 0.781 0.851 0.510
Bus 3895 10408 0.787 0.866 0.900 0.657
Car 4281 12627 0.824 0.900 0.934 0.699
Cng 3126 5509 0.823 0.845 0.911 0.652
People 2874 7647 0.799 0.764 0.863 0.546
Rickshaw 3849 11964 0.804 0.850 0.904 0.623
Truck 218 243 0.430 0.494 0.474 0.375
Mini-Truck 979 1136 0.568 0.681 0.690 0.504
Cycle 139 143 0.497 0.231 0.330 0.183

Note: Truck, Mini-Truck, and Cycle have significantly fewer training instances (143–1136) compared to other classes (3000–12000+), which explains their lower recall and mAP. Performance on these classes will improve with more annotated data.

Inference speed (per image): 0.1ms preprocess Β· 3.4ms inference Β· 0.4ms postprocess

Model Details

Property Value
Base architecture YOLOv8n
Layers (fused) 73
Parameters 3,007,403
GFLOPs 8.1
Input size 480 Γ— 480 px
Precision FP32 (CPU) / FP16 (CUDA)
Tracker ByteTrack
Framework Ultralytics 8.x

Classes

ID Class Description
0 Bike Motorcycle / motorbike
1 Bus Full-size passenger bus
2 Car Passenger car / sedan / SUV
3 Cng CNG auto-rickshaw (3-wheel, compressed natural gas)
4 People Pedestrian
5 Rickshaw Human-powered cycle rickshaw
6 Truck Goods truck / lorry
7 Mini-Truck Small covered van / pickup
8 Cycle Bicycle

Intended Use

  • Real-time traffic monitoring from fixed roadside cameras
  • Vehicle counting and classification
  • Speed estimation with multi-object tracking (ByteTrack)
  • Traffic density and flow analysis dashboards

This model is optimised for Bangladeshi and similar South Asian traffic environments where CNGs, rickshaws, and cycle rickshaws are prevalent β€” classes typically absent from Western traffic datasets.

Limitations

  • Trained on Bangladeshi urban roads; performance may degrade on highways or in other countries with different vehicle types
  • Truck, Mini-Truck, and Cycle detection is weaker due to limited training data (see evaluation table)
  • Speed estimates rely on a fixed pixel-to-metre heuristic (PX_TO_METER = 0.05) calibrated for a typical roadside camera height β€” recalibrate for different mounting heights
  • Low-light and heavily occluded scenes will reduce detection confidence

How to Use

Inference only

from ultralytics import YOLO

model = YOLO("best.pt")
results = model("traffic.mp4", imgsz=480, conf=0.3)

With ByteTrack (counting + speed)

from ultralytics import YOLO

model = YOLO("best.pt")
results = model.track(
    source="traffic.mp4",
    tracker="bytetrack.yaml",
    imgsz=480,
    conf=0.3,
    iou=0.5,
    persist=True,
    stream=True,
)

for result in results:
    print(result.boxes)

Full web dashboard

The model powers a real-time FastAPI + WebSocket dashboard with live class filtering, speed estimation, and Chart.js visualisations.

β†’ abrarCSE29/traffic-detection-yolo

Training

  • Base weights: yolov8n.pt (ImageNet pre-trained)
  • Dataset: Bangladeshi Traffic Flow Dataset β€” Islam, Mohammad Manzurul; Rashid, Mohammad Rifat Ahmmad (2024), Mendeley Data, V2, doi:10.17632/h8bfgtdp2r.2
  • Validation set: 4,736 images Β· 52,850 instances across 9 classes
  • Framework: Ultralytics YOLOv8

Citation

If you use this model or dataset, please cite:

@misc{abrar_hameem_2026,
    author       = { Abrar Hameem },
    title        = { traffice-detection-best (Revision 0567f6e) },
    year         = 2026,
    url          = { https://huggingface.co/abrarhameem398/traffice-detection-best },
    doi          = { 10.57967/hf/8409 },
    publisher    = { Hugging Face }
}

@misc{bangladeshi-traffic-dataset,
  author    = {Islam, Mohammad Manzurul; Rashid, Mohammad Rifat Ahmmad },
  title     = {Bangladeshi Traffic Flow Dataset},
  year      = {2024},
  publisher = {Mendeley Data},
  doi       = {10.17632/h8bfgtdp2r.2},
  url       = {https://data.mendeley.com/datasets/h8bfgtdp2r/2}
}
Downloads last month
37
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Evaluation results