Real-Time Weapon Detection using YOLOv8 β’ Flask β’ OpenCV β’ Raspberry Pi β’ Twilio
- Overview
- Problem Statement
- Solution
- Features
- System Architecture
- Technology Stack
- Project Structure
- Screenshots
- Installation
- Configuration
- Running the Project
- Workflow
- Model Performance
- Security
- Limitations
- Future Roadmap
- Contributing
- License
- Author
FALCON is an AI-powered surveillance and emergency response platform that performs real-time weapon detection using a custom-trained YOLOv8 model. The system automatically identifies potential threats from live video streams, stores incident data, captures evidence, updates an interactive dashboard, and immediately notifies authorities through Twilio SMS alerts.
Designed as an end-to-end solution, FALCON combines computer vision, backend engineering, edge AI, and web technologies into a complete security platform suitable for educational demonstrations, research, and smart surveillance prototypes.
Traditional CCTV systems continuously record video but rely on human operators to identify threats, often delaying emergency response.
FALCON addresses this challenge by automatically detecting weapons in live video streams and triggering immediate alerts while maintaining searchable incident records.
The system continuously monitors live video feeds using YOLOv8.
When a weapon is detected:
- Detects the object
- Captures an image
- Records the video clip
- Stores incident details
- Sends SMS alerts
- Updates the dashboard
- Generates detection reports
- Real-time weapon detection
- Custom YOLOv8 model
- Live RTSP/IP Camera support
- USB Camera support
- Confidence-based detection
- Twilio SMS alerts
- Detection history
- Alert logs
- Timestamp recording
- Incident analytics
- Active alerts
- Detection statistics
- Weapon gallery
- Interactive reports
- User Registration
- Secure Login
- Session Management
- Detection reports
- Captured Images
- Video Evidence
- Historical records
- Raspberry Pi compatible
- Lightweight deployment
- Local inference support
Live Camera
β
βΌ
YOLOv8 Detection
β
βββββββββββ΄βββββββββββ
βΌ βΌ
Save Image & Video Twilio SMS Alert
β β
βΌ βΌ
SQLite Database Emergency Contact
β
βΌ
Flask Web Dashboard
β
βΌ
Reports & Analytics
| Layer | Technology |
|---|---|
| Programming | Python |
| Backend | Flask |
| Frontend | HTML CSS JavaScript |
| Computer Vision | OpenCV |
| AI Model | YOLOv8 |
| Database | SQLite |
| Alerts | Twilio API |
| Deployment | Raspberry Pi |
| Version Control | Git & GitHub |
FALCON/
β
βββ screenshots/
βββ static/
βββ templates/
βββ train_detect_weapons/
β
βββ app.py
βββ yolo_detect.py
βββ live_rtsp_detector.py
βββ train_yolo.py
βββ twilio_alert.py
βββ database.py
βββ alert_db.py
β
βββ requirements.txt
βββ .gitignore
βββ README.md
git clone https://github.com/Astik97/FALCON.git
cd FALCONCreate virtual environment
python -m venv venvWindows
venv\Scripts\activateLinux
source venv/bin/activateInstall dependencies
pip install -r requirements.txtCreate a .env file.
TWILIO_ACCOUNT_SID=
TWILIO_AUTH_TOKEN=
TWILIO_PHONE=
SECRET_KEY=python app.pyOpen
http://127.0.0.1:5000
Start Camera
β
YOLOv8 Detection
β
Weapon Detected
β
Capture Evidence
β
Store in Database
β
SMS Alert
β
Dashboard Update
β
Generate Report
| Metric | Value |
|---|---|
| Model | YOLOv8 |
| Dataset | 9,633 Images |
| Epochs | 50 |
| Precision | 85% |
| Recall | 75% |
| mAP@0.5 | 81% |
| Device | FPS | Latency |
|---|---|---|
| GPU | 15β25 | 40β60 ms |
| CPU | 5β10 | 120β200 ms |
| Raspberry Pi | 1β3 | 400β800 ms |
- Environment variables for secrets
.gitignoreexcludes credentials- Secure authentication
- Session management
- No API keys committed
- Reduced accuracy in poor lighting
- False positives possible
- Raspberry Pi has limited inference speed
- Stable network required for RTSP
- Docker Support
- PostgreSQL Migration
- Multi-camera Monitoring
- Email Alerts
- Push Notifications
- Cloud Deployment
- ONNX/TensorRT Optimization
- Mobile Dashboard
- Face Recognition Module
Contributions, issues, and feature requests are welcome.
Fork the repository.
Create a feature branch.
Commit your changes.
Open a Pull Request.
This project is licensed under the MIT License.
Backend Developer β’ AI Systems Developer β’ Computer Vision Enthusiast
π§ Email: astikm7007@gmail.com
π LinkedIn
https://linkedin.com/in/astik-mohapatra
π GitHub
If you found this project helpful,
β Star the repository
π΄ Fork it
π’ Share it
Happy Coding π





