Built to order

Two-Wheeler Helmet Detection from Traffic CCTV using YOLO

This project fine-tunes YOLOv8 on a ~12,000-image helmet dataset to detect two-wheeler riders in traffic CCTV and classify each as helmet or without-helmet. Helmet-less riders are auto-logged with timestamp and camera ID for e-challan-style review, and a single-file web dashboard shows live bounding boxes, a violation feed and analytics. The training notebook, evaluation metrics and complete viva kit ship with the build. Suitable for B.E./B.Tech final-year projects in Computer Science, IT and AI & Machine Learning.

Two-Wheeler Helmet Detection from Traffic CCTV using YOLO — project thumbnail preview
More project photos (2)

The problem

Head injuries are the leading cause of two-wheeler fatalities, and helmet laws only work when violations are actually caught — but no traffic department has the staff to watch every CCTV feed all day. This project automates that watch: a YOLOv8 object detector trained on the Roboflow Universe helmet dataset (~12,000 annotated traffic images) scans CCTV frames, finds every two-wheeler, and classifies each rider as helmet or without-helmet. Each violation is cropped, timestamped and logged with its camera ID into a review table — the raw material for an e-challan-style enforcement workflow. The demo dashboard (the screenshots on this page) shows the system in action: a priority camera feed with live bounding boxes and confidence scores, a camera wall, a scrolling event feed, and analytics on violation rates. Because the pipeline is built on standard tools (Ultralytics YOLOv8, OpenCV, ONNX export), the student can explain and defend every stage in the viva.

How it works

  1. Each CCTV frame is resized to 640×640 and normalized for the YOLOv8-m network.
  2. The network predicts bounding boxes for three classes — Two Wheeler, Helmet, Without Helmet — and NMS (IoU 0.5) removes duplicate boxes.
  3. Head-region boxes are associated with their rider box by spatial overlap inside the two-wheeler region.
  4. Detections below the confidence threshold (default 0.35, tunable) are discarded to control false alarms.
  5. Every rider classified without-helmet is cropped, timestamped and appended to the violation log with the camera ID.
  6. The dashboard polls the log and renders live boxes, the violation feed and analytics charts in the browser.
  7. The same weights export to ONNX, so the pipeline can move from a workstation to pole-side edge hardware unchanged.

Tech stack:

  • Python 3, PyTorch, Ultralytics YOLOv8
  • OpenCV (frame capture, tracking helpers)
  • ONNX Runtime (edge deployment)
  • NumPy, Matplotlib (evaluation plots)
  • Roboflow Universe helmet dataset
  • HTML/CSS/JS single-file dashboard (this demo)

Dataset & model details

  • Dataset: Roboflow Universe "Helmet Wearing Detection" — approximately 12,000 annotated traffic images (10,494 train / 992 validation / 512 test), three classes (Helmet, Without Helmet, Two Wheeler), YOLO-format bounding boxes, varied daylight lighting and camera angles.
  • Task: Multi-class object detection; input = 640×640×3 frame, output = bounding boxes with class label and confidence.
  • Model: YOLOv8-m (approximately 25.9M parameters), fine-tuned from COCO weights; NMS IoU 0.5; confidence threshold 0.35 default (operator-tunable).
  • Metrics: mAP@0.5 0.88, mAP@0.5:0.95 0.61, helmet-class precision 0.91 / recall 0.87 — design targets for the built-to-order training run. The report documents the actually achieved figures.
Parameter Value
Input resolution 640 × 640
Classes 3 (Two Wheeler, Helmet, Without Helmet)
Model YOLOv8-m, approximately 25.9M parameters
mAP@0.5 0.88 (design target, not a measured claim)
Inference Approximately 45 ms/frame on a T4 GPU (expected)
Confidence threshold 0.35 default, operator-adjustable
Inputs MP4 clips, still images, RTSP/IP-camera stream
Export ONNX (TensorRT-ready)
Demo Single-file HTML dashboard, runs offline after download

Project features

  • [YOLOv8 detection pipeline] Detects two-wheelers and classifies each rider region as helmet or without-helmet on CCTV frames, with non-maximum suppression cleaning overlapping boxes.
  • [Automatic violation logging] Every helmet-less rider is cropped, timestamped and logged with camera ID into a review table — ready for authority-side challan workflows.
  • [Live monitoring dashboard] Priority feed with bounding boxes and confidence scores, a 4-camera wall, and a scrolling event feed in one single-file web UI.
  • [Violation analytics] Violation rate, hourly violation trend and repeat-rider counts computed from the detection log, shown as dashboard charts.
  • [Tunable confidence threshold] Operator-adjustable threshold (default 0.35) trades precision against recall; the effect is measured and documented in the report.
  • [Multiple input modes] Runs on recorded CCTV clips, still images, or a live RTSP/IP-camera stream with the same pipeline.
  • [ONNX export for edge] Trained weights export to ONNX so the detector can run on edge hardware such as a Jetson Nano at the camera pole.

What is included

  • Fine-tuned YOLOv8 weights and the complete training notebook
  • Detection + violation-logging Python pipeline
  • Single-file HTML monitoring dashboard wired to the pipeline outputs
  • Training curves, mAP plots and confusion matrix for the report
  • Project report PDF (background, dataset, methodology, results)
  • PPT presentation for final review
  • Viva Q&A preparation document (YOLO architecture, NMS, mAP, precision/recall trade-offs)

Limitations & prerequisites

  • Camera angle matters: the pipeline is calibrated for typical roadside CCTV views; steep overhead angles degrade head-box association.
  • Night and low-light footage needs IR-capable cameras; heavy rain or fog reduce accuracy.
  • Pillion riders heavily occluded by the driver can be missed.
  • 0.88 mAP@0.5 is a design target for the training run, stated honestly — the report documents the actual achieved figure.
  • Number-plate reading is not part of this build (listed as future scope).
  • As shipped, the violation log is a decision-support aid, not a legal enforcement device — challan workflows need authority-side integration.

Frequently Asked Questions

Which dataset is used and why?

The Roboflow Universe "Helmet Wearing Detection" set — about 12,000 traffic images with boxes for Helmet, Without Helmet and Two Wheeler. It matches the deployment domain (roadside CCTV) far better than a generic dataset, which is exactly what a viva examiner will ask about.

How does it tell helmet from no-helmet?

The detector finds the two-wheeler and head regions; each head box is classified as helmet or without-helmet, then associated to its rider by spatial overlap. The dashboard shows per-box confidence so the decision is auditable.

Can it run on a live camera?

Yes — the pipeline accepts an RTSP/IP-camera stream with the same code path as recorded clips; only the frame source changes.

What accuracy figure can I quote in my viva?

mAP@0.5 of 0.88 is the design target for the built-to-order training run. The report documents the actually achieved mAP, per-class precision/recall and the confusion matrix — quote those, never the target alone.

Does it read number plates for challans?

Not in this build — plate recognition is listed as future scope in the report. The violation log stores the cropped rider image, timestamp and camera ID as the handoff to any challan workflow.

Is this project suitable for a final-year project?

Yes — for Computer Science, IT and AI/ML programs. It covers dataset handling, transfer learning with YOLOv8, detection metrics, deployment export and a working dashboard demo. Suitable for B.E./B.Tech final-year projects in Computer Science, IT and AI & Machine Learning.

Components & software requirements
  • Python 3, PyTorch, Ultralytics YOLOv8
  • OpenCV (frame capture, tracking helpers)
  • ONNX Runtime (edge deployment)
  • NumPy, Matplotlib (evaluation plots)
  • Roboflow Universe helmet dataset
  • HTML/CSS/JS single-file dashboard (this demo)

Dataset & model details

  • Dataset: Roboflow Universe "Helmet Wearing Detection" — approximately 12,000 annotated traffic images (10,494 train / 992 validation / 512 test), three classes (Helmet, Without Helmet, Two Wheeler), YOLO-format bounding boxes, varied daylight lighting and camera angles.
  • Task: Multi-class object detection; input = 640×640×3 frame, output = bounding boxes with class label and confidence.
  • Model: YOLOv8-m (approximately 25.9M parameters), fine-tuned from COCO weights; NMS IoU 0.5; confidence threshold 0.35 default (operator-tunable).
  • Metrics: mAP@0.5 0.88, mAP@0.5:0.95 0.61, helmet-class precision 0.91 / recall 0.87 — design targets for the built-to-order training run. The report documents the actually achieved figures.
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download abstract (PDF)

Related guides

All guides
Blueprint-style technical illustration of multiple decision trees voting together into one final predictionStudents with basic Python and pandas skills who want a reliable first classifier for ML coursework and tabular data projects.

Random Forests Explained: Why Decision Trees Vote Better Together

Decision trees are readable but overfit; random forests fix this by training hundreds of varied trees on bootstrapped data with random feature subsets, then letting them vote. This guide explains Gini impurity, bagging, out-of-bag validation and the four hyperparameters that matter, with a complete scikit-learn workflow, honest feature-importance practices, and the mistakes students keep making.

Read guide
Illustration of object tracking showing video frames with bounding boxes and persistent ID labels following people and vehicles, comparing motion prediction and appearance matching.B.E./B.Tech Computer Science and Electronics students building video analytics projects — people counting, vehicle tracking, sports analysis — who have detection working and need

Object Tracking: DeepSORT and ByteTrack Explained

Detection finds objects per frame; tracking keeps their identities across frames. This guide explains tracking-by-detection, Kalman motion models, DeepSORT's appearance embeddings vs ByteTrack's low-confidence box recovery, tracking metrics (HOTA, IDF1, ID switches), and the tuning parameters that determine real-world quality.

Read guide
Illustration of image segmentation showing U-Net's U-shaped encoder-decoder with skip connections producing pixel masks, alongside Mask R-CNN detecting instances with masks.B.E./B.Tech Computer Science and AI/ML students moving from image classification or detection to pixel-level understanding — medical imaging, defect detection, autonomous driving

Image Segmentation: U-Net and Mask R-CNN

When projects need pixel-level answers, segmentation delivers. This guide explains semantic vs instance vs panoptic segmentation, U-Net's encoder-decoder with skip connections, Mask R-CNN's parallel mask head, Dice and IoU evaluation, paired augmentation, and how to choose the right architecture for your data and question.

Read guide
Get a quotation