Helmet-Detection

Datasets Used

Models Trained

Yolov5 on the Kaggle dataset

The Kaggle Dataset has 764 images belonging to 2 classes(with helmet and without helmet).
The dataset was split into train(75%), validation(15%) and test(10%) sets. The images were auto-oriented and resized to 416x416 using Roboflow. The Xml annotations were converted to the YOLO v5 PyTorch using Roboflow.
Model Weights
Results on given videos

Confusion Matrix

alt text

Results

alt text

Validation batch labels

alt text

Validation batch predictions

alt text

Yolov5 on the Roboflow Dataset

This dataset (v1) is composed of 1,371 images of people with and without bike helmets.
The training set has 1.2k images, validation set has 126 images and the test set has 63 images.
The images in this dataset has been auto-oriented and resized to 416x416. Further augmentations prior to import have been applied(Bounding Box Blur - upto 10 px)
Model Weights
Results on given videos

Confusion Matrix

alt text

Results

alt text

Validation batch labels

alt text

Validation batch predictions

alt text To Count the number of helmets, we just need to iterate over the output of the model and count the no. of times the class 0 shows up in the output.

Running Instructions

Open the terminal and type the following

$ git clone https://github.com/mudit14224/Helmet-Detection.git
$ cd helmet-detection/yolov5
$ python -m venv helmet-detect-env
$ .\helmet-detect-env\Scripts\activate
$ pip3 install -r requirements.txt
$ python detect.py --weights "Path to model weights" --source "Path to image or video"