/Weapon-Detection-and-Alarm-System

The system uses an IP camera for taking inputs. Whenever a weapon is detected, the system alerts the security instantly and prevents any big accident from happening.

Primary LanguagePython

Open in

Open In Colab Open In Kaggle

It is a YOLOv5 🚀 weapon detection model trained on custom dataset for detecting the weapons in real life and alarm system.

Quick Start Examples

Install

Clone repo and install requirements.txt in a Python>=3.7.0 environment, including PyTorch>=1.7.

git clone https://github.com/K-saif/Weapon-Detection-Mail-Alerts.git  # clone
cd Weapon-Detection-Mail-Alerts
pip install -r requirements.txt  # install
Mail Bot

Step-1: For sending automatic Email first we need to turn on 2-step verification to get a 16 character password that we can use to log in to Gmail using Python, follow the steps here.

step-2: Copy and paste that password in the auto_mail.py

Training For training, use below command
python train.py --img 640 --batch 16 --epochs 30 --data custom_data.yaml --weights '' --cache

Note: provide file name and path properly

Training Results

Graphs:

Output:

Inference with detect.py

detect.py runs inference on a variety of sources and saving results to runs/detect.

python detect.py --source 0  # webcam
                          img.jpg  # image
                          vid.mp4  # video
                          path/  # directory
                          'path/*.jpg'  # glob
                          'https://youtu.be/'  # YouTube
                          'rtsp://abc.com/weapon.mp4'  # RTSP, RTMP, HTTP stream
Detection For detection, use below command
python detect.py --weights best.pt --img 640 --conf 0.5 --source image.jpg

Note: provide file name and path properly

Environments

Get started in seconds with our verified environments. Click each icon below for details.

Contribute

Our Contributors are,

Contact