Skip to content

WasifSohail5/Weapon-Detection-System

Repository files navigation

πŸ”« Weapon Detection Using YOLOv8


πŸš€ Overview

This project implements a real-time weapon detection system using the latest YOLOv8 object detection framework. The model is trained to accurately detect weapons in images and video streams, making it suitable for security systems, smart surveillance, and public safety applications.

This implementation is based on the research paper "Comprehensive Study on Weapon Detection: A Comparative Analysis using YOLOv8", extending the methodologies and enhancing the techniques proposed in the paper.


πŸ“Š Model Performance

Metric Value
Precision 76.6%
Recall 82.0%
[email protected] 79.7%
Framework YOLOv8
Dataset Custom

πŸ”₯ Confusion Matrix Example


πŸ§‘β€πŸ’» Features

  • Real-Time Detection (Webcam & Video)
  • Custom Dataset Training
  • Export to ONNX for Deployment
  • Visual Performance Reports (curves & matrices)
  • Easy Integration & Customization

πŸ“š Research Implementation

This project is an implementation of the methodologies described in "Comprehensive Study on Weapon Detection: A Comparative Analysis using YOLOv8". Our work:

  • Extends the YOLOv8-based weapon detection approach
  • Implements optimizations suggested in the research
  • Achieves similar or better performance metrics on weapon classification
  • Provides practical deployment options via ONNX conversion

πŸ“ Citation

@article{weapon_detection_yolov8,
  title={Comprehensive Study on Weapon Detection: A Comparative Analysis using YOLOv8},
  journal={arXiv preprint arXiv:2410.19862},
  url={https://arxiv.org/pdf/2410.19862},
  year={2024}
}

πŸ—‚οΈ Project Structure

weapon_detection/
β”œβ”€β”€ data/                  # Dataset (images, labels)
β”œβ”€β”€ weights/               # Trained model files (.pt, .onnx)
β”œβ”€β”€ runs/                  # YOLOv8 output (validation results, plots)
β”œβ”€β”€ scripts/               # Training, validation, inference scripts
β”œβ”€β”€ utils/                 # Helper functions
β”œβ”€β”€ README.md
└── requirements.txt

⚑ Quick Start

1. Clone the Repository

git clone https://github.com/WasifSohail5/Weapon-Detection-System.git
cd Weapon-Detection-System

2. Install Requirements

pip install -r requirements.txt

3. Inference on Images or Video

from ultralytics import YOLO

model = YOLO('weights/best.pt')
results = model('path/to/test_image.jpg', show=True)  # For single image

4. Export Model to ONNX

model.export(format='onnx', imgsz=640, half=True, simplify=True, opset=12, dynamic=True)

πŸ“ˆ Results Visualization

  • Precision-Recall Curve

  • F1 Curve


πŸ† Example Results

Input Image Prediction

πŸ› οΈ Training

To train the model on your dataset:

from ultralytics import YOLO
model = YOLO('yolov8n.pt')  # or use yolov8s.pt, yolov8m.pt, etc.
model.train(data='data.yaml', epochs=100, imgsz=640)

πŸ“¦ Model Export & Deployment

  • Formats Supported: PyTorch (.pt), ONNX (.onnx), TorchScript, CoreML, etc.
  • ONNX model can be integrated into real-time inferencing pipelines & edge devices.
  • This follows the deployment strategy outlined in the research paper, enabling edge computing applications.

🀝 Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.


πŸ“œ License

This project is licensed under the MIT License.


πŸ”° Secure the Future with Real-Time Weapon Detection! πŸ”°

About

This project implements a real-time weapon detection system using the latest YOLOv8 object detection framework. The model is trained to accurately detect weapons in images and video streams, making it suitable for security systems, smart surveillance, and public safety applications.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors