A computer vision project that detects handguns in images/videos using deep learning techniques. This project leverages object detection models to identify weapons in real-time, making it useful for surveillance and security applications.
- 🔍 Detects handguns in images and video streams
- 🎯 High accuracy using trained deep learning models
- ⚡ Real-time inference capability
- 📦 Easy-to-use and extendable codebase
- Uses Convolutional Neural Networks (CNNs) for feature extraction
- Object detection powered by models like:
- YOLO
- Trained on handgun detection datasets
- Supports inference on:
- Images
- Videos
- Webcam streams
handgun-detection/
│
├── data/ # Raw dataset zip file
│ └── Data.md
│
├── prepared_data/ # YOLO-ready dataset after preparation
│ ├── images/train
│ ├── images/val
│ ├── labels/train
│ ├── labels/val
│ └── data.yaml
│
├── notebooks/
│ ├── handgun_detection_train.ipynb # YOLOv8 training notebook
│ └── handgun_detection_inference.ipynb # Video inference notebook
│
├── scripts/
│ ├── prepare_data.py # Convert videos + JSON → YOLO images/labels
│ ├── split_dataset.py # Train/val split
│ ├── train_yolo.py # YOLOv8 training script
│ └── run_inference.py # Inference script for videos
│
├── utils/
│ └── coco_to_yolo.py # Conversion utilities
│
├── runs/ # YOLO training runs (weights, results)
│
├── results_metrics.txt # Evaluation metrics and results
│
├── requirements.txt
└── README.md
- Clone the repository:
git clone https://github.com/gopal092003/handgun-detection.git
cd handgun-detection
Install dependencies:
pip install -r requirements.txt
python detect.py --image path/to/image.jpg
python detect.py --video path/to/video.mp4
python detect.py --webcam
- Accurate detection of handguns under various conditions
- Works across different lighting conditions and backgrounds
- Optimized for near real-time performance
(Add sample outputs/screenshots here)
- Python
- OpenCV
- TensorFlow / PyTorch
- NumPy
- Matplotlib
- Improve detection accuracy with larger datasets
- Extend to multi-class weapon detection
- Deploy as a web or mobile application
- Optimize for edge devices (Raspberry Pi, Jetson, etc.)
Contributions are welcome! Feel free to fork this repository and submit a pull request.
This project is licensed under the MIT License.
Gopal Gupta GitHub: https://github.com/gopal092003
If you found this project helpful, please give it a ⭐ on GitHub!