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.
| Metric | Value |
|---|---|
| Precision | 76.6% |
| Recall | 82.0% |
| [email protected] | 79.7% |
| Framework | YOLOv8 |
| Dataset | Custom |
- Real-Time Detection (Webcam & Video)
- Custom Dataset Training
- Export to ONNX for Deployment
- Visual Performance Reports (curves & matrices)
- Easy Integration & Customization
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
@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}
}
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
git clone https://github.com/WasifSohail5/Weapon-Detection-System.git
cd Weapon-Detection-Systempip install -r requirements.txtfrom ultralytics import YOLO
model = YOLO('weights/best.pt')
results = model('path/to/test_image.jpg', show=True) # For single imagemodel.export(format='onnx', imgsz=640, half=True, simplify=True, opset=12, dynamic=True)| Input Image | Prediction |
|---|---|
![]() |
![]() |
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)- 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.
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License.




