Code Monkey home page Code Monkey logo

brahimmade / live-cctv Goto Github PK

View Code? Open in Web Editor NEW

This project forked from asrani1/live-cctv

0.0 0.0 0.0 67.68 MB

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.

License: MIT License

Python 81.40% Jupyter Notebook 18.60%

live-cctv's Introduction

LIVE-CCTV

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.

image

TABLE OF CONTENTS

About The Project

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

Tech Stack

The project uses:

File Structure

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

Approach

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.

Theory

Neural Networks

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

Euclidean distance

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. image

Yolo

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).

Flowchart for code execution

Flowchart

Getting Started

Prerequisites

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
    

Installation

Clone the repo

git clone https://github.com/AsRaNi1/live-cctv.git

Usage

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:

Results and Demo

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

result

Future Work

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:

Troubleshooting

  • 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

Mentors

A very special thanks to the mentors!!

Contributors

Acknowledgements and Resources

live-cctv's People

Contributors

asrani1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.