Skip to content

huyhapitk12/GuardianAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Python Platform License AI

πŸ›‘οΈ GuardianAI

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.


🎯 Overview

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.

✨ Key Features

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

πŸš€ Installation

System Requirements

  • OS: Windows 10/11 or Linux
  • Python: 3.12
  • RAM: Minimum 4GB (recommended 8GB+)
  • Camera: Webcam, IP Camera (RTSP), or video file

Step 1: Clone repository

git clone https://github.com/your-username/GuardianAI.git
cd GuardianAI

Step 2: Create virtual environment (recommended)

python -m venv .venv
.venv\Scripts\activate  # Windows
# or
source .venv/bin/activate  # Linux/macOS

Step 3: Install dependencies

pip install -r requirements.txt

Step 4: Configuration

Edit 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.

Step 5: Run the application

python main.py

πŸ“‚ Project Structure

GuardianAI/
β”œβ”€β”€ 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...)

πŸ”§ Feature Details

πŸ”₯ Fire & Smoke Detection

  • 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

πŸ‘€ Face Recognition

  • 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

🚨 Fall Detection

  • 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

πŸ“Έ Infrared Camera (IR) Support

  • 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

πŸ“± Telegram Bot Usage

Available Commands

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

Alert Handling

When receiving alerts, you can interact via buttons:

  • βœ… Confirm: This is a real event
  • ❌ Dismiss: False positive
  • πŸ”‡ Mute: Stop alarm siren

βš™οΈ Advanced Configuration

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

πŸ“œ License

This project is released under the MIT License. See LICENSE file for more details.

Made with ❀️ by HuyHAP & Minh Tri

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages