Skip to content

cosmicc0der78/WeaponDetection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”« Real-Time Weapon Detection using YOLOv8

AI that spots weapons in real time. Just YOLOv8, a camera, and a model trained to protect.

This project harnesses the power of YOLOv8 to detect weapons like guns and knives directly from live webcam feeds or video footage. You can train it on a custom dataset from Kaggle or run it instantly using a pretrained best.pt model. Perfect for smart surveillance, AI-powered security systems, and anyone looking to fuse deep learning with real-world safety.


πŸ“ Project Structure

weapon-detection/
β”œβ”€β”€ dataset/ # YOLO-formatted dataset (downloaded from Kaggle)
β”œβ”€β”€ best.pt # Pretrained model (optional)
β”œβ”€β”€ detect.py # Real-time detection script
β”œβ”€β”€ train_colab.ipynb # Google Colab training script
└── README.md

βœ… Requirements

  • Python 3.8+
  • Ultralytics YOLOv8
  • OpenCV
  • PyTorch

πŸš€ Getting Started

Option 1: πŸ”½ Use Pretrained Model

  1. Download best.pt from this GitHub repo or from your training.
  2. Place it in your project directory.
  3. Update detect.py:
    model_path = r"C:/..."

Option 2: 🧠 Train Your Own Model (Google Colab)

  1. Open train_colab.ipynb in Colab.

  2. Follow steps to:

    • Run training
    • Download best.pt after training
    from google.colab import files
    files.download('runs/detect/train/weights/best.pt')
  3. Update detect.py:

    model_path = r"C:/..."

πŸ” Real-Time Detection(Webcam)

Run the detect.py:

python detect.py

🀝 Open to Collaborate

Whether you're a developer, researcher, or enthusiast β€” if you're passionate about AI, computer vision, or building for public safety, let's connect!
Feel free to open issues, suggest features, or submit pull requests.
Always open to ideas, improvements, and partnerships.

About

A real-time weapon detection system using Yolov8 to identify firearms or knives in video feeds for enhanced public safety and surveillance automation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors