Skip to content

vkt08/Object-Detection-in-Computer-Vision

Repository files navigation

python jupyter pytorch

Object Detection in Computer Vision

Object Detection
Object Detection

Helmet Detection by using Faster R-CNN and YOLOv8 Models

This Repository contains 3 Project Works on Object Detection:

! If any of the files is showing any type of error, you can also use this Drive Link given here.

Dataset used for these Projects (Kaggle)

This dataset, contains 5000 images with bounding box annotations in the PASCAL VOC format for these 3 classes:

They're [helmet, head & person], but mainly to predict helmet because the data is heavily imbalanced.

labels
As you can see from the histogram above, almost 75% of the occurences in the Dataset is of helmet class.

We've partitioned the Dataset into Train, Val & Test Splits in Proportion of 8:1:1.

Project 1

We've used pre-trained Faster R-CNN Model with Resnet50 backbone fine-tuned on this Dataset's Train Split.

Then we evaluated the model on the test split. The Results are like :

download (1)
Faster R-CNN
Predictions on a random image of the test dataset.
Green & Yellow Boxes represent the actual & predicted boxes respectively.
The results are quite good, although the model also predicted some redundant boxes.

We've used the standard mAP@0.5 Performance Metric (where 0.5 denotes the IoU Threshold Value taken) for evaluation.

We've also calculated the Precision & Recall Values for each class though.

mAP@0.5 Value

Static Badge

Project 2

We've used the SOTA Model YOLOv8 (Medium Version) fine-tuned on the same dataset.

And the Results & the speed of inference were quite Promising. Have a look :

hard_hat_workers989
YOLOv8
Predictions on a random image of the test dataset.
Not only the model was able to predict helmet class accurately with good confidence, it was able to predict head class well. Again, some redundant boxes.

Here also we've used the mAP@0.5 Performance Metric for evaluation & comparision b/w the 2 Models.

Here again also, we've calculated the Precision & Recall Values for each class.

mAP@0.5 Value

Static Badge

Comparing the two Models

*YOLOv8, the new State of the Art Model is quite accurate & fast comparative to the conventional models used for Object Detection Models, like here we used *Faster R-CNN. And the results are quite astonishing.

While the Faster R-CNN struggled a bit giving a quite low mAP @0.5 value as "25.34%", on the other hand, YOLOv8 totally outperformed the former model by giving the same value as **"63.40%".

Also due to its rapid processing speed, it takes around only 10ms on an avg. for an image prediction while the latter one takes around 142ms for the same.

Almost 15x times faster.

So, It easily surpasses the criteria of 24fps for a model to be run on Video. (YOLOv8 FPS = 83FPS)

diff

  • It can be used conveniently for REAL-TIME Detection & this leads to many Real-World Applications.

Project 3

output_1.1.mp4

A smaller yet powerful Project build using YOLOv8 to showcase one out of many real-world applications.

This tool simply plots the bounding boxes of Helmets without confidence score (else it will become clumsy, just to look clean) and displays the current count of Helmets in the videos.

This tool can be very useful for real-time video surveillance, traffic monitoring, and autonomous systems.

You can also use more features like ability to track objects, maintain identities, handle occlusions and noise in this tool.

For giving you just a simple example, Traffic Camera - this tool can be implemented in city surveillance cameras to give an automated estimate of how well are the traffic rules being followed (if helmets are mandatory).

Authors - Ayush Raj & Vikash Kumar Thakur

License: Apache 2.0

Ayush Raj

gmail image github kaggle medium

Vikash Kumar Thakur

gmail image github kaggle medium

About

Object Detection by using Faster R-CNN and YOLOv8 Models

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published