This project implements a custom-trained YOLOv8 model that detects whether motorcycle riders are wearing helmets. The model was trained for 100 epochs using a high‑quality Roboflow dataset and includes image detection, video detection, and real‑time object tracking with persistent IDs.
- Detects With Helmet / Without Helmet
- High accuracy with custom YOLOv8 weights
- Bounding boxes + confidence overlay
helmet_detection_image.py — Runs helmet detection on any image.
helmet_detection_video.py supports:
- YOLOv8 tracking with
persist=True - Re‑identification of riders
- Smooth real-time predictions
- mAP@0.5:
0.896 - Precision: Helmet –
0.936, No Helmet –0.856 - Stable curves and strong detection accuracy for both classes
pip install ultralytics cvzone opencv-python numpy
python helmet_detection_image.py
python helmet_detection_video.py
- Dataset: Roboflow (Bike Helmet Detection)
- Epochs: 100
- Framework: YOLOv8 (Ultralytics)
- Resolution: 640×640
- Optimizer: Default YOLO settings





