Open in
It is a YOLOv5 🚀 weapon detection model trained on custom dataset for detecting the weapons in real life and alarm system.
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 commandpython train.py --img 640 --batch 16 --epochs 30 --data custom_data.yaml --weights '' --cache
Note: provide file name and path properly
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 commandpython detect.py --weights best.pt --img 640 --conf 0.5 --source image.jpg
Note: provide file name and path properly
Get started in seconds with our verified environments. Click each icon below for details.
Our Contributors are,