Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README Enhancement - CCTV Human Detection #513

Merged
merged 7 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added CCTV-HUMAN-DETECTION/Images/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CCTV-HUMAN-DETECTION/Images/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 46 additions & 31 deletions CCTV-HUMAN-DETECTION/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,14 @@

![image.png](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSrLn9Zzwpzvpp2FLu0n8bdwOIR26fARzsV4A&usqp=CAU)

YOLOv4 HumaN DETECTION
==========================
# GOAL
Detecting humans from CCTV Images

This is a tutorial demonstrating how to train a YOLOv4 people detector using [Darknet](https://github.com/AlexeyAB/darknet) and the Kaggle Human dataset.
# DESCRIPTION
This is a tutorial demonstrating how to train a YOLOv4 people detector using [Darknet](https://github.com/AlexeyAB/darknet) and the Kaggle Human dataset,, which contains annotated images of people in various scenarios. YOLOv4 is a state-of-the-art object detection model known for its speed and accuracy, making it suitable for real-time applications such as surveillance and autonomous vehicles. Follow along to understand the process of training your own custom object detector to detect people in images and video streams.

Process
-----------------

* [Setup](#setup)
* [Preparing training data](#preparing)
* [Training on a local PC](#training-locally)
* [Testing the custom-trained yolov4 model](#testing)

# Introduction

This Human detection model is made on deep learning model based on Yolo(You Only Look Once).

# Dataset

# DATASET
The dataset for this project is taken from the Kaggle website. Here is the link for the dataset,https://www.kaggle.com/datasets/jonathannield/cctv-human-pose-estimation-dataset.

Here in the dataset you will find the various human images captured through CCTV cameras installed on various places.
Expand All @@ -30,29 +19,55 @@ We used LabelIMG to annotate image.
You can refer to https://machinelearningknowledge.ai/train-custom-yolov4-model-for-object-detection-in-google-colab/ for custom data preparation.


# Goal
# WHAT I HAD DONE

The goal of this project is to identify human being from CCTV camera.

# Approach
The script detects objects using YOLOv4 model with Darknet, configurable through command-line arguments.
* [Setup](#setup)
* [Preparing training data](#preparing)
- It supports both image and video inputs, including live streams from webcams and various protocols.
* [Training on a local PC](#training-locally)
- Detection results can be displayed, saved as images or videos, and exported as text files.
- The script utilizes PyTorch for inference and CUDA for GPU acceleration if available.
- Training the model requires GPU.If GPU is not there then use google colab for training the model.Refer the yolo_model.ipynb file for detailed procedure of training and testing.
* [Testing the custom-trained yolov4 model](#testing)

In the notebook we have implemented various Yolov4 and latest released Yolov7 and compare their accuracy with the help of dataset each approach will be divided into different section.
# MODEL IMPLEMENTED
### DARKNET:-
Darknet, the neural network framework developed by Joseph Redmon, has been instrumental in the evolution of YOLO models and numerous other deep learning projects. Offering flexibility and efficiency, Darknet serves as the backbone for implementing cutting-edge algorithms like YOLOv4 and YOLOv7. Its modular architecture facilitates rapid prototyping and experimentation, enabling researchers and developers to push the boundaries of object detection and recognition. Moreover, Darknet's open-source nature fosters collaboration and innovation within the computer vision community, driving continual advancements in human detection and beyond.

# Approach Using Yolov4
### YOLO4:-
You Only Look Once (YOLO) version 4 (YOLOv4) has been a significant advancement in human detection from CCTV footage, offering real-time processing capabilities and improved accuracy compared to its predecessors. YOLOv4 utilizes a single neural network to predict bounding boxes and class probabilities directly from full images in one evaluation. While it excels in detecting human figures swiftly and accurately, it falls short in discerning finer details such as facial features or subtle gestures. This limitation poses a challenge in scenarios where identifying specific individuals or analyzing intricate behaviors is crucial, highlighting the need for further refinement in detection algorithms.

![image.png](https://miro.medium.com/max/785/1*f2diI7O28j2A875FwQPMJA.jpeg)
### YOLO7:-
In contrast, YOLO version 7 (YOLOv7) represents the latest evolution in human detection technology, boasting enhanced performance and robustness over YOLOv4. With advancements in model architecture and training techniques, YOLOv7 demonstrates superior accuracy in identifying human subjects from CCTV feeds while also addressing some of the limitations of its predecessors. Its improved ability to capture finer details ensures better recognition of human attributes and behaviors, making it a preferred choice for applications requiring precise analysis and tracking in complex environments.

### This model fails to perform with distant and finer object.
# LIBRARIES NEEDED
opencv-python==4.1.1.26
lxml
tqdm
tensorflow==2.3.0
absl-py
easydict
matplotlib
pillow

# Approach Using Yolov7
# EDA RESULTS
#### Approach Using Yolov4
![image.png](https://miro.medium.com/max/785/1*f2diI7O28j2A875FwQPMJA.jpeg)
This model fails to perform with distant and finer object.

#### Approach Using Yolov7
![image.png](https://github.com/WongKinYiu/yolov7/raw/main/figure/performance.png)
This model performs much better than Yolov4 on distant objects

### This model performs much better than Yolov4 on distant objects

# Training and Testing
# COMPARING PERFORMANCE
Loss is less in YoLo7 compared to Yolo4. Hence, YoLo7 is more accurate
#### Performance of YoLo4 vs Performance of YoLo7
![alt text](<Screenshot 2024-05-11 173921-1.png>)
Yolo7

Training the model requires GPU.If GPU is not there then use google colab for training the model.Refer the yolo_model.ipynb file for detailed procedure of training and testing.
![alt text](<Screenshot 2024-05-11 173858-1.png>)
Yolo4

# Conclusion
### We have implemented two different approach Yolov4 and Yolov7 and, Yolov7 gives the best accuracy.
# CONCLUSION
We have implemented two different approach Yolov4 and Yolov7 and, Yolov7 gives the best accuracy.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading