Weapon detection using yolo8m using 95% precision.
Link to open source: https://github.com/sairaj237/Weapon-Detection
Link to Live Project: https://docs.google.com/presentation/d/1TmXfRMg2lykoXfJrox8gwC42iO87-a5a/edit?slide=id.p1#slide=id.p1
This document outlines the system architecture and technical specifications for an AI-powered weapon detection system designed to monitor CCTV feeds in real-time and alert security staff upon weapon detection.
The system will comprise three main components: a Computer Vision Model for weapon detection, a FastAPI Backend for video stream processing and alert management, and a Next.js Frontend for live monitoring and notification display. The overall goal is to provide a robust, real-time solution to enhance security surveillance.
Based on current research and industry trends in real-time object detection, YOLOv8 (You Only Look Once version 8) is recommended for its balance of speed and accuracy [1]. Alternatives like Faster R-CNN and SSD are also viable but YOLOv8 often provides superior performance for real-time applications on edge devices or with limited computational resources.
The model will be trained or fine-tuned on a comprehensive dataset containing various types of weapons (e.g., guns, knives, rifles) in diverse environments and lighting conditions. Publicly available datasets from platforms like Kaggle and GitHub will be utilized, such as those focusing on handguns, knives, and rifles, often pre-formatted for YOLO models [2]. Data augmentation techniques will be employed to increase dataset diversity and improve model robustness.
Upon processing a video frame, the model will output:
- Bounding Boxes: Coordinates (x, y, width, height) for each detected weapon.
- Class Labels: The type of weapon detected (e.g., "Gun", "Knife", "Rifle").
- Confidence Score: A probability score indicating the model's certainty of the detection.
FastAPI will be used to build the backend API due to its high performance, asynchronous capabilities, and automatic interactive API documentation (Swagger UI). Python will be the primary programming language.
- Video Stream Ingestion: The backend will ingest real-time video streams from CCTV/IP cameras. This can be achieved using libraries like OpenCV to capture frames from RTSP (Real-Time Streaming Protocol) or other video sources.
- Real-time Inference: Each ingested video frame will be passed to the loaded YOLOv8 model for weapon detection. To maintain real-time performance, optimizations such as frame skipping or processing frames in batches may be considered.
- Alert Logic: If a weapon is detected with a confidence score above a predefined threshold, the system will trigger an alert. The alert will include details such as:
- Camera ID
- Timestamp of detection
- Type of weapon detected
- Bounding box coordinates
- A snapshot of the frame with the detected weapon.
- Notification System: The backend will integrate with various notification services to send instant alerts to security staff. Potential channels include:
- Email: Via SMTP or third-party email APIs.
- SMS: Via Twilio or similar SMS gateway APIs.
- Push Notifications: To a dedicated mobile application or web push service.
- Webhook: To integrate with existing security management systems.
- API Endpoints:
/stream: WebSocket endpoint for live video feed with detection overlays./alerts: REST endpoint to retrieve historical and real-time alerts./config: REST endpoint for system configuration (e.g., camera management, alert thresholds).
Next.js with the App Router will be used for the frontend development, providing server-side rendering (SSR) and static site generation (SSG) capabilities for a fast and responsive user experience. React will be used for building the user interface components.
- Live Video Feed: Display real-time video streams from selected cameras. Detected weapons will be highlighted with bounding boxes and labels overlaid on the video feed.
- Alert Panel: A dedicated section to display incoming alerts. This panel will provide visual cues (e.g., red highlight, flashing) and audible notifications for new weapon detections.
- Historical Data: Allow security staff to review past alerts, including timestamps, camera locations, and associated snapshots.
- Camera Management: Interface to add, remove, or configure CCTV cameras.
- User Management: (Optional) Manage user roles and permissions for accessing the system.
