Skip to content

Repository files navigation

Project S.W.O.R.D

Surveillance for Weapon Observation using Real-Time Deep Learning

S.W.O.R.D is an AI-powered weapon detection system that identifies firearms and bladed weapons from user-uploaded images and videos using deep learning. The project is built as a practical surveillance prototype, focusing on accuracy, transparency, and real-world applicability rather than exaggerated claims.

The system is currently deployed via a Gradio-based web interface and performs inference on uploaded media.

🚀 Key Features • 🖼️ Weapon detection on user-uploaded images • 🎞️ Frame-by-frame weapon detection on user-uploaded videos • 🧠 YOLOv8-based object detection model • 📊 Bounding boxes, class labels, and confidence scores • 🖥️ Simple and interactive Gradio UI • 📦 Modular and extensible codebase

🧠 System Workflow 1. User Upload • Image or video uploaded through the Gradio interface 2. Preprocessing • Image normalization and video frame extraction 3. Model Inference • YOLOv8 Nano performs object detection 4. Threat Identification • Weapons localized with bounding boxes and confidence scores 5. Result Display • Annotated output returned to the user

🏗️ Architecture Overview

User Upload (Image / Video) ↓ Preprocessing Pipeline ↓ YOLOv8 Detection Model ↓ Annotated Output (UI)

🛠️ Tech Stack • Language: Python • UI Framework: Gradio • Model Framework: Ultralytics YOLOv8 • Model Variant: YOLOv8 Nano • Computer Vision: OpenCV

🧪 Model & Dataset

Model • Architecture: YOLOv8 Nano (3.2 million parameters) • Reason for Choice: Lightweight, fast inference, suitable for real-time and edge-oriented scenarios

Dataset • Source: Roboflow (open-source weapon detection dataset) • Total Images: 9,669 • Weapon Classes: • Gun • Knife • Rifle • Shotgun • Annotations: Bounding-box labels

Training Details • Training Duration: 12+ hours on a Macbook Air M4 with 24GB RAM • Epochs: 50 • Initial Performance: ~68% • Final Performance: ~74% after tuning • Additional preprocessing applied despite dataset being preprocessed

Note: The dataset is not included in this repository due to size and licensing constraints.

📂 Project Structure

S.W.O.R.D/

├── train.ipynb # Model training notebook

├── launch.ipynb # Launches and configures the Gradio UI app

├── testing.ipynb # Model testing & evaluation (actual testing of the model with images and videos, to be uploaded by the user)

├── dataset.ipynb # Dataset exploration

├── data.yaml # Dataset configuration (YOLO)

├── yolov8n.pt # YOLOv8 Nano weights (local)

└── processed_output.mp4 # Sample output (optional)

▶️ Usage

python testing.ipynb

1.	Launch the Gradio interface in your browser
2.	Upload an image or video
3.	View detected weapons with bounding boxes and confidence scores

⚠️ Current Limitations • No live CCTV / webcam / RTSP stream support • No automated alerting system • Performance depends on local hardware • Not production-deployed

🧭 Roadmap & Future Enhancements • 📹 Live camera and CCTV stream support • ⚡ Real-time inference optimization (ONNX / TensorRT) • 🚨 Alert and notification integration • 🧍 Behavioral threat analysis • 🌙 Low-light and thermal camera compatibility • ☁️ Edge–cloud hybrid deployment

⚖️ Ethical & Legal Disclaimer

This project is intended strictly for research, academic, and lawful surveillance applications. Any deployment must comply with applicable laws, privacy regulations, and ethical AI standards. The author assumes no responsibility for misuse.

👤 Author Mudit Agrawal B.Tech CSE (AI/ML)

📌 Project Status

🚧 Active development — architecture and performance improvements ongoing.

Early detection improves response. Accuracy determines trust.

About

Surveillance for Weapon Observation using Real-Time Deep Learning

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages