Intelligent Security Surveillance System using Computer Vision & AI
Real-time surveillance solution with Fire/Smoke detection, Stranger/Known person recognition, Fall detection,
Telegram alerts, GUI management and automatic event recording.
GuardianAI is an intelligent security surveillance system, optimized for 24/7 operation with high performance. The system uses advanced AI models to detect dangers and send instant alerts via Telegram.
| Feature | Description |
|---|---|
| π₯ Fire & Smoke Detection | YOLO (OpenVINO/ONNX) with smart post-processing filters, minimizing False Positives |
| π€ Face Recognition | InsightFace + SORT Tracker, classifying Known/Stranger persons |
| π¨ Fall Detection | RTMPose + ONNX model, real-time pose analysis |
| πΈ Infrared Camera (IR) | Auto-detection and appropriate filter switching |
| π± Telegram Alerts | Send photos/videos, interactive confirmation buttons, periodic heartbeat |
| π€ AI Assistant | Compatible with OpenAI API (Gemini/LM Studio/Ollama) |
| π¬ Auto Recording | Automatically record clips on events and send with alerts |
| π₯οΈ Management GUI | Beautiful interface with CustomTkinter |
- OS: Windows 10/11 or Linux
- Python: 3.12
- RAM: Minimum 4GB (recommended 8GB+)
- Camera: Webcam, IP Camera (RTSP), or video file
git clone https://github.com/your-username/GuardianAI.git
cd GuardianAIpython -m venv .venv
.venv\Scripts\activate # Windows
# or
source .venv/bin/activate # Linux/macOSpip install -r requirements.txtEdit file config/config.yaml:
# === Telegram Bot ===
telegram:
token: ${TELEGRAM_TOKEN:""}
chat_id: ${TELEGRAM_CHAT_ID:""}
# === Camera ===
camera:
# Webcam: 0 | File: "video.mp4" | RTSP: "rtsp://user:pass@ip:554/stream"
sources: 0
target_fps: 10
# === AI Assistant (optional) ===
ai:
enabled: false
api_base: ${AI_API_BASE:"https://api.openai.com/v1"}
api_key: ${AI_API_KEY:""}
model: ${AI_MODEL:"gpt-4o-mini"}π‘ Tip: Use environment variables with syntax
${ENV:"default"}to secure sensitive information.
python main.pyGuardianAI/
βββ main.py # Entry point - Initialize and orchestrate system
βββ config/
β βββ config.yaml # Main configuration file
β βββ settings.py # Load config, supports ${ENV:"default"}
βββ core/
β βββ camera.py # Camera class: read frames, IR detection, pipeline
β βββ camera_manager.py # Multi-camera management, processing threads
β βββ recorder.py # Alert video recording
β βββ detection/
β βββ fire.py # FireDetector: YOLO + RGB/IR filters
β βββ face.py # FaceDetector: InsightFace
β βββ person.py # PersonTracker: YOLO + SORT + Face ID
β βββ fall.py # FallDetector: RTMPose + ONNX
βββ bot/
β βββ *.py # Telegram Bot, AI Assistant
βββ gui/
β βββ app.py # Main GUI Application
β βββ panels/ # Panels (settings, cameras, faces...)
β βββ widgets/ # Custom widgets
β βββ styles.py # Theme and styling
βββ utils/
β βββ *.py # StateManager, SpamGuard, AlarmPlayer...
βββ Data/
βββ Model/ # AI models (YOLO, InsightFace, ONNX...)
- Uses YOLO with OpenVINO/ONNX backend for optimal performance
- Smart filters to minimize False Positives:
- Color analysis (HSV ranges)
- Flicker detection
- Reflection and bright light filtering
- Texture analysis (entropy)
- Dedicated IR mode: Auto-switches filters when camera is in infrared mode
- InsightFace for high-quality face embeddings
- SORT Tracker for continuous multi-person tracking
- ReID (Re-Identification): Remembers people when they leave and return
- Management GUI: Add new people, build embeddings
- RTMPose (from rtmlib) for 17-point pose estimation
- ONNX model classifies falls based on pose sequences
- Analyzes keypoint velocity and location
- Visual skeleton overlay display
- Auto-detects IR mode every 10 frames
- Maintains 30-frame history for stable results
- Dedicated IR filters (brightness, variance, hot spot)
- Smoke detection disabled by default in IR mode
| Command | Description |
|---|---|
/start |
Start bot, show instructions |
/status |
Check system status |
/detect |
Toggle detection mode |
/alarm |
Control alarm siren |
/get_image |
Capture image from camera |
When receiving alerts, you can interact via buttons:
- β Confirm: This is a real event
- β Dismiss: False positive
- π Mute: Stop alarm siren
See config/config.yaml to adjust:
- Camera: FPS, resolution, process interval
- Detection: Confidence thresholds, filter parameters
- Tracker: IOU threshold, max age
- Recorder: Duration, extension time
- Telegram: Response timeout, spam protection
This project is released under the MIT License. See LICENSE file for more details.
Made with β€οΈ by HuyHAP & Minh Tri