An intelligent surveillance system that analyzes live video streams to automatically detect and alert on potential security threats including weapons, anomalies, and suspicious behavior using computer vision and deep learning.
National Security Guard (NSG) and security agencies manually monitor hundreds of live feeds from cameras and drones. Manual video analysis is slow, error-prone, and unscalable - critical threats may be overlooked. In crisis operations, every second matters, requiring real-time intelligent surveillance rather than just footage recording.
SentinelAI is an AI-powered real-time surveillance system that analyzes live video streams and automatically alerts on potential threats like people, vehicles, weapons, anomalies, or intrusions - providing instant decision support for security command units.
| Layer | Tools / Models |
|---|---|
| Video Input | Drone/Bodycam/CCTV feed |
| Processing | OpenCV, YOLOv8 + DeepSORT for object & person tracking |
| Anomaly Detection | Autoencoder + CNN-LSTM for abnormal behaviour |
| Alert Logic | Python backend (threshold-based or ML rule) |
| Dashboard | Streamlit + WebSocket live feed |
| Visualization | Heatmaps, bounding boxes, alert logs |
π¦ SentinelAI
βββ π₯ Video Input Layer
β βββ Support for RTSP streams, webcams, video files
β
βββ π Object Detection (YOLOv8)
β βββ Person detection
β βββ Vehicle detection
β βββ Weapon detection
β
βββ π― Object Tracking (DeepSORT)
β βββ Multi-object tracking
β βββ Persistent ID assignment
β βββ Trajectory analysis
β
βββ π§ Anomaly Detection (CNN-LSTM)
β βββ Weapon detection CNN
β βββ Violence detection (TwoStreamSepConvLSTM)
β βββ Suspicious behavior detection
β βββ Zone violation detection
β
βββ π¨ Alert System
β βββ Real-time threat detection
β βββ WebSocket notifications
β βββ Alert logging
β
βββ π Dashboard
βββ Live video feed
βββ Detection visualization
βββ Real-time metrics
βββ Alert management
- Weapon Detection: Custom CNN model trained for firearms and weapons
- Violence Detection: Two-Stream Separable Convolutional LSTM for aggressive behavior
- Anomaly Detection: Autoencoder + CNN-LSTM for unusual patterns
- Zone Violations: Polygon-based restricted area monitoring
- YOLOv8 Integration: Fast and accurate object detection
- DeepSORT Tracking: Multi-object tracking with persistent IDs
- Trajectory Analysis: Track movement patterns over time
- Real-Time Alerts: Instant notifications via WebSocket
- Alert Prioritization: Severity-based threat classification
- Alert Logging: Complete audit trail of all detections
- Streamlit Interface: Modern, responsive web UI
- Live Video Feed: Real-time stream with bounding boxes
- Metrics Visualization: Charts, heatmaps, and statistics
- Alert Management: View, filter, and respond to alerts
- Python 3.11+
- CUDA-capable GPU (recommended for real-time processing)
- Webcam or RTSP stream source
- Clone the repository
git clone https://github.com/yourusername/SentinelAI.git
cd SentinelAI- Create conda environment
conda create -p .conda python=3.11 -y
conda activate ./.conda- Install dependencies
pip install -r requirements.txt- Download pre-trained models (if available)
# Place your trained models in weights/ folder
# - weapon_detection_best.pth
# - violence_detection_model.pthuvicorn app.main:app --host 0.0.0.0 --port 8000 --reloadstreamlit run dashboard/app.py- Dashboard: http://localhost:8501
- API Documentation: http://localhost:8000/docs
- WebSocket Stream: ws://localhost:8000/ws/stream
python test_camera_app.pySentinelAI/
βββ app/ # Backend API
β βββ api/ # API endpoints
β β βββ metrics.py # Metrics WebSocket
β β βββ zones.py # Zone management
β β βββ training_ws.py # Training WebSocket
β βββ models/ # Model wrappers
β β βββ weapon_detection.py
β β βββ member3_weapon_detector.py
β βββ services/ # Core services
β β βββ detection_service.py # Main detection pipeline
β β βββ tracker.py # Object tracking
β βββ main.py # FastAPI app
β
βββ dashboard/ # Streamlit dashboard
β βββ app.py # Dashboard UI
β
βββ third_party/ # External models
β βββ TwoStreamSepConvLSTM_ViolenceDetection/
β βββ models.py # Violence detection model
β βββ train.py # Training script
β βββ evaluate.py # Evaluation utilities
β
βββ training/ # Model training code
β βββ weapon_detection/ # Weapon detection CNN
β βββ anomaly_detection/ # Anomaly detection
β
βββ weights/ # Trained model weights
βββ logs/ # System logs
βββ demos/ # Demo scripts
βββ requirements.txt # Python dependencies
βββ README.md # This file
GET /- Health checkGET /zones- List all zonesPOST /zones- Create new zoneGET /metrics- System metrics
ws://localhost:8000/ws/stream- Real-time video processingws://localhost:8000/ws/alerts- Real-time alert notificationsws://localhost:8000/ws/training- Training metrics stream
Train your own weapon detection model:
cd training/weapon_detection
# Copy WEAPON_DETECTION_TRAINING.py to Google Colab
# Upload your dataset ZIP
# Run training (takes ~40 minutes on T4 GPU)See training/weapon_detection/WEAPON_DETECTION_GUIDE.txt for detailed instructions.
cd third_party/TwoStreamSepConvLSTM_ViolenceDetection
python train.py --dataset rwf2000 --vidLen 32 --batchSize 4 --numEpochs 150 --mode bothSee third_party/TwoStreamSepConvLSTM_ViolenceDetection/README.md for dataset preparation.
- Live Bounding Boxes: Real-time detection overlays
- Heatmaps: Activity density visualization
- Alert Logs: Timestamped event history
- Metrics Charts: Performance and detection statistics
- Zone Visualization: Restricted area overlays
- Border surveillance
- Military base monitoring
- Restricted area protection
- Airport security
- Railway station monitoring
- Public event surveillance
- Power plant security
- Data center monitoring
- Government facility protection
- Traffic monitoring
- Crowd management
- Incident detection
- Offline Operation: Runs on standard hardware without constant internet access
- Modular Architecture: Easily scales from single CCTV feed to command center
- Open-Source Frameworks: Built using YOLO & OpenCV for reliable deployment
- Cost-Efficient: Low deployment and maintenance costs
- Enhanced Surveillance: Real-time threat detection for faster response
- Efficiency Boost: Reduces manual monitoring workload by up to 70%
- Integration Ready: Compatible with existing CCTV systems
- Market Potential: Growing demand for automated video analytics in security, defense, and smart surveillance sectors
- Backend: FastAPI, Python 3.11
- Computer Vision: OpenCV, YOLOv8
- Deep Learning: PyTorch, CNN-LSTM, Autoencoders
- Tracking: DeepSORT
- Frontend: Streamlit, WebSockets
- Database: SQLite (can be upgraded to PostgreSQL)
- Deployment: Docker (optional)
- Detection Speed: 30+ FPS on GPU (RTX 3060)
- Weapon Detection Accuracy: ~90%+ (depends on training)
- Violence Detection Accuracy: ~85%+ (RWF-2000 benchmark)
- Tracking Accuracy: MOTA ~75%
- Alert Latency: <500ms
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- YOLOv8 by Ultralytics
- DeepSORT tracking algorithm
- TwoStreamSepConvLSTM violence detection model
- RWF-2000 dataset for violence detection
- Open-source community
For questions, issues, or feature requests:
- Open an issue on GitHub
- Check the documentation in
/docs - See training guides in
/training