Skip to content

Juliowiwiwiwi/Bike-Helmet-Detction-Model

Repository files navigation

🚀 AI Helmet Detection System

YOLOv8 • Roboflow Dataset • Real‑Time Tracking

       


⚡ Overview

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.


🧠 Features

🔹 AI Helmet Detection

  • Detects With Helmet / Without Helmet
  • High accuracy with custom YOLOv8 weights
  • Bounding boxes + confidence overlay

🔹 Image Detection

helmet_detection_image.py — Runs helmet detection on any image.

🔹 Video Detection + Tracking

helmet_detection_video.py supports:

  • YOLOv8 tracking with persist=True
  • Re‑identification of riders
  • Smooth real-time predictions

📊 Model Performance (Visual Results)

🔵 Precision–Confidence Curve

Precision Confidence

🔵 Recall–Confidence Curve

Recall Confidence

🔵 F1–Confidence Curve

F1 Confidence

🔵 Confusion Matrix

Confusion Matrix

🔵 Precision–Recall (mAP@0.5)

Precision Recall

🔵 Training Curves (YOLOv8)

Precision Recall


📈 Key Metrics (YOLOv8)

  • mAP@0.5: 0.896
  • Precision: Helmet – 0.936, No Helmet – 0.856
  • Stable curves and strong detection accuracy for both classes

⚙️ Installation

1️⃣ Install dependencies

pip install ultralytics cvzone opencv-python numpy

2️⃣ Run Image Detection

python helmet_detection_image.py

3️⃣ Run Video Detection

python helmet_detection_video.py

🧬 Training Details

  • Dataset: Roboflow (Bike Helmet Detection)
  • Epochs: 100
  • Framework: YOLOv8 (Ultralytics)
  • Resolution: 640×640
  • Optimizer: Default YOLO settings

Need a banner, logo, or GIF preview? Just tell me — I can generate it! ✨

About

A custom YOLOv8 helmet-detection model trained for 100 epochs using a Roboflow dataset. Includes scripts for real-time image and video detection with bounding boxes, confidence scores, and object tracking with persistent IDs for accurate rider safety monitoring.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages