SentryVision is an advanced AI-powered security monitoring system that provides real-time weapon detection using YOLOv8m deep learning models. The system offers live camera streaming, intelligent threat detection, and comprehensive alert management through a modern web interface.
- 🎯 Advanced Threat Detection: Custom-trained YOLOv8m model with 47.08% mAP@0.5 for detecting knives, pistols, and long weapons
- 📹 Multi-Camera Support: Real-time streaming from multiple camera sources with DirectShow backend support
- ⚡ Intelligent Filtering: Per-class confidence thresholds to reduce false positives (phones/pens detected as knives)
- 🔐 User Authentication: Secure login and registration system with Flask-Login
- 🚨 Real-Time Alerts: Instant notifications with detection snapshots and audio alerts
- 📱 Responsive Dashboard: Modern web interface optimized for desktop and mobile devices
- 🔧 GPU Acceleration: CUDA-optimized training and inference for RTX GPUs
- 📊 Performance Monitoring: Comprehensive model evaluation and training metrics
├── instance/ # SQLite database and other instance-specific files
├── static/ # Static files (CSS, JS, images, snapshots)
│ ├── snapshots/ # Directory for storing detection snapshots
│ ├── bg.jpg # Background image for UI
│ └── alert.mp3 # Sound for alert notifications
├── templates/ # HTML templates for Flask
│ ├── index.html # Main dashboard
│ ├── login.html # Login page
│ ├── register.html # Registration page
│ └── alerts.html # Standalone alerts page
├── camera_processor.py # Handles camera processing and YOLO detection
├── config.py # Configuration settings
├── forms.py # Flask-WTF forms for authentication
├── main.py # Main Flask application
├── models.py # SQLAlchemy database models
├── requirements.txt # Python dependencies
└── README.md # This file
-
Clone the Repository:
git clone https://github.com/hibaanwer07/SentryVision.git cd flask-security-monitoring -
Set Up a Virtual Environment:
python -m venv venv source venv\Scripts\activate
-
Install Dependencies:
pip install -r requirements.txt
-
Configure Environment Variables (create
.envfile):SECRET_KEY=your-secret-key DATABASE_URL=sqlite:////path/to/site.db MAIL_USERNAME=your-email@gmail.com MAIL_PASSWORD=your-app-password
-
Initialize the Database:
flask db init flask db migrate flask db upgrade
-
Start the Flask Server:
python main.py
Access the dashboard at http://localhost:5000.
-
Toggle Security Modes and view live feeds and alerts.
- Camera Sources: Add webcam indices or RTSP URLs in
config.py. - Threat Classes: Modify
PRIMARY_THREAT_CLASSESfor detection. - Alert Settings: Adjust alert intervals for email and real-time updates.
- MQTT Settings: Configure MQTT broker for IoT integration.
- Fork the repository.
- Create a branch (
git checkout -b feature/your-feature). - Commit changes (
git commit -m 'Add feature'). - Push to the branch (
git push origin feature/your-feature). - Open a Pull Request.
This project is licensed under the MIT License.
- YOLOv8: For object detection.
- Flask: For the web framework.
- OpenCV: For video processing.
- Paho MQTT: For MQTT integration.