Skip to content

gopal092003/handgun-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔫 Handgun Detection using Deep Learning

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.


🚀 Features

  • 🔍 Detects handguns in images and video streams
  • 🎯 High accuracy using trained deep learning models
  • ⚡ Real-time inference capability
  • 📦 Easy-to-use and extendable codebase

🧠 Model & Approach

  • 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

📁 Project Structure

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

⚙️ Installation

  1. Clone the repository:
git clone https://github.com/gopal092003/handgun-detection.git
cd handgun-detection

Install dependencies:

pip install -r requirements.txt


▶️ Usage

Run Detection on Image

python detect.py --image path/to/image.jpg

Run Detection on Video

python detect.py --video path/to/video.mp4

Webcam Detection

python detect.py --webcam

📊 Results

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


🛠️ Tech Stack

  • Python
  • OpenCV
  • TensorFlow / PyTorch
  • NumPy
  • Matplotlib

📌 Future Improvements

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

🤝 Contributing

Contributions are welcome! Feel free to fork this repository and submit a pull request.


📜 License

This project is licensed under the MIT License.


👤 Author

Gopal Gupta GitHub: https://github.com/gopal092003


⭐ Support

If you found this project helpful, please give it a ⭐ on GitHub!


About

Deep learning-based handgun detection system using computer vision to identify weapons in images, videos, and real-time streams for surveillance and security applications.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors