To detect any reasonable change in a live cctv to avoid large storage of data. Once, we notice a change, our goal would be track that object or person causing it. We would be using Computer vision concepts. Our major focus will be on Deep Learning and will try to add as many features in the process.
- About the Project
- Approach
- Theory
- Getting Started
- Usage
- Results and Demo
- Future Work
- Troubleshooting
- Mentors
- Contributors
- Acknowledgements and Resources
Aim: The project aims at storing only relevant data in a CCTV camera (in this case a traffic camera) to prevent storage loss and also detects the object that is causing the change in a frame and classifies them.
Description: The project uses Yolov3 pre-trained weights and config file. It calculates the distance between 2 consecutive frames of a video and then records if the change found is relevant. It further uses the OpenCV library's DNN module to load the Yolov3 weights and then classifies the object in front of the camera, also encloses the object detected with a bounding box
The project uses:
MAIN BRANCH
📦Notes -Contains the notes for reference
┣ 📜CNN (Eklavya).pdf -Notes on Convolutional Neural Networks
┣ 📜Eklavya (Linear Algebra).pdf -Notes on Linear Algebra
┣ 📜Eklavya (Neural Networks).pdf -Notes on Basics of Neural Networks
┗ 📜Handwritten_Notes.pdf -Handwritten notes on all topics
📦Live_CCTV_Cosine
┣📜Bounding_Boxes.py -Python file, contains function for Object Classification, Labeling them and further bounding them
┣📜Cos_sim.py -Python file, Containing the function to calculate Cosine Similarity between 2 consecutive frames of a video
┣📜Main.py -The Main Python file that exexutes the code
┣📜labels.txt -Contains the labels for the objects that it detects
┣📜yolov3-tiny.weights -Pre-trained Yolov3 weights
┗📜yolov3.cfg -Pre-trained Yolov3 Configuration file
📦assets
┣ 📜LiveCCTV_Report.pdf -Report on the project
┣ 📜Output.mp4 -Output video from test.mp4
┗ 📜result.png -Result on an image
┣📜Bounding_Boxes.py -Python file, contains function for Object Classification, Labeling them and further bounding them
┣📜Euclidean_dist.py -Python file, Containing the function to calculate Euclidean Distance between 2 consecutive frames of a video
┣📜Main.py -The Main Python file that exexutes the code
┣📜Read.me.txt -Contains the instructions
┣📜coco.txt -Contains the labels for the objects that it detects
┣📜test.mp4 -Testing video
┣📜yolov3-tiny.weights -Pre-trained Yolov3 weights
┗📜yolov3.cfg -Pre-trained Yolov3 Configuration file
The approach of this project is to basically record relevant changes in a video. By checking the similarity between 2 consecutive frames of a video we can decide wether a change is relevant or no based on the magnitude of similarity.
A neural network is a network or circuit of neurons, or in a modern sense, an artificial neural network, composed of artificial neurons or nodes.
There are different types of Neural Networks:
- Standard Neural Networks
- Convolutional Neural Networks
It is a method to calcuate the distance between 2 vectors in a given space. In the project Euclidean distance is used to calculate distance between image vectors of 2 consecutive frames of the video.
The Yolo algorithm or You Only Look Once algorithm, is an object classification algorithm that divides the image into small grids and applies object classification to each of them. The algorithm then assigns bounding boxes to the objects which further uses NMS(Non-Max Supression).
Install these on the conda prompt:
- Python 3 (conda already consists of Python)
- OpenCV: In conda prompt type
conda install -c conda-forge opencv
- numpy
conda install -c anaconda numpy
Clone the repo
git clone https://github.com/AsRaNi1/live-cctv.git
After cloning the repo, open the file and run the Main file in each of the folders in the Command line Example:
$ Python Main.py
After running the main file, it will ask for the paths, so enter the paths as asked.
Input video file path:
Output path:
The project clearly identifies an object in the video frame and assigns a bounding box to it along with labels i.e classifying the object, it also records the relevant motion taking place in the video. The video is saved in the Path folder.
Output.mp4
The motion tracking algorithm the current project uses is derived from Eucidean diatnce, but this can further be bettered by the use of feature vectors i.e adding a Conv-net and then linear regression to the Euclidean distance found between 2 consecutive frames of a video. Further, the project can be enhanced by making it a Realtime car tracker which will not only be able to identify defaulters while driving but will also be able to save their numberplate and then we will be able to track their vehicle using out program in various CCTV's:
- Common errors while configuring the project:
- OpenCV not installed in conda
- numpy not installed in conda
- Using an older Python version
- One can change the threshold vale for movement detection, so choose a suitable one.
- When giving the output path in command line be sure to add .avi, Recording.avi
A very special thanks to the mentors!!