Giter Site home page Giter Site logo

atulyakumar97 / fire-and-gun-detection Goto Github PK

View Code? Open in Web Editor NEW
71.0 3.0 26.0 26.04 MB

Fire and Gun detection using yolov3 in videos as well as images. Training code, dataset and trained weight file available.

License: MIT License

Python 100.00%
yolov3 gun-detection fire-detection object-detection python darknet deep-learning ai artificial-intelligence deep-neural-networks

fire-and-gun-detection's Introduction

Fire and Gun Detection

result

How to use yolo.py:

usage: yolo.py [-h] [--webcam WEBCAM] [--play_video PLAY_VIDEO]
               [--image IMAGE] [--video_path VIDEO_PATH]
               [--image_path IMAGE_PATH] [--verbose VERBOSE]

optional arguments:
  -h, --help            show this help message and exit
  --webcam WEBCAM       True/False
  --play_video PLAY_VIDEO
                        Tue/False
  --image IMAGE         Tue/False
  --video_path VIDEO_PATH
                        Path of video file
  --image_path IMAGE_PATH
                        Path of image to detect objects
  --verbose VERBOSE     To print statements

Weights File Backup

If the GitLFS file is not accessible - Download Weights and keep inside the project folder.

Move inside the project folder and use the following command:

python yolo.py --play_video True --video_path videos/fire1.mp4

Dataset

Training done on google collab - Jupyter notebook

Demo: Youtube

Paper

Fire and Gun Violence based Anomaly Detection System Using Deep Neural Networks
Proceedings of the International conference on Electronics and Sustainable Communication Systems - ICESCS 2020
ISBN: 978-1-7281-4107-7
978-1-7281-4108-4/20/©2020 IEEE

fire-and-gun-detection's People

Contributors

atulyakumar97 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fire-and-gun-detection's Issues

How to improve the detect speed?

Hi:
I noticed in your sample videos, there is no jitters or lags at all. But when i run your default code, it has a lot of jitters/lags. A 5 seconds video may need 15 seconds to finish. Looks like the net.forward part is taking too long. How to modify the code in order to get the same effect as you showed in your video? Many thanks!

def detect_objects(img, net, outputLayers):			
	blob = cv2.dnn.blobFromImage(img, scalefactor=0.00392, size=(320, 320), mean=(0, 0, 0), swapRB=True, crop=False)
	net.setInput(blob)
	outputs = net.forward(outputLayers) #this part is taking so long
	return blob, outputs

Error

Great work you did there :)

I am getting an error while running this code, can you please help me.

Opening videos/fire1.mp4 ....
Traceback (most recent call last):
File "yolo.py", line 143, in
start_video(video_path)
File "yolo.py", line 116, in start_video
model, classes, colors, output_layers = load_yolo()
File "yolo.py", line 24, in load_yolo
output_layers = [layers_names[i[0]-1] for i in net.getUnconnectedOutLayers()]
File "yolo.py", line 24, in
output_layers = [layers_names[i[0]-1] for i in net.getUnconnectedOutLayers()]
IndexError: invalid index to scalar variable.

I would be really glad if you could help me in this.
Thank you :)

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.