Skip to content

An AI-powered, real-time surveillance system that fuses YOLOv8 person detection, MediaPipe skeleton tracking, face recognition, and Telegram remote control to deliver intelligent zone-based intrusion detection, automated alerts, and visual monitoring from any camera.

License

Notifications You must be signed in to change notification settings

Binivert/security-system

Repository files navigation

Security System Header



Overview


Security System is an advanced AI-powered surveillance platform that transforms any camera into an intelligent monitoring station. Built with cutting-edge computer vision technologies, it provides real-time person detection, facial recognition, motion analysis, and instant alerts—all controllable from your Telegram app.

The system combines YOLOv8 for accurate person detection, MediaPipe for skeleton tracking, and face_recognition for trusted person identification. When an intruder enters a defined security zone, the system immediately triggers alarms, captures evidence, and sends notifications to your phone.

Key Capabilities:

  • 🎯 Zero false positives with YOLOv8 neural network detection
  • 🦴 Full skeleton tracking detects partial body intrusions (hands, feet, etc.)
  • 👤 Trusted person recognition automatically disarms for known faces
  • 📱 Complete Telegram control with inline buttons and real-time status
  • 🔥 Motion heat mapping visualizes activity patterns over time
  • 🎨 Professional GUI with night vision, recording, and zone drawing


Features



Feature Description
YOLOv8 Detection — State-of-the-art neural network for accurate person detection with adjustable sensitivity (Low/Medium/High)
Skeleton Tracking — MediaPipe pose estimation tracks 33 body landmarks for comprehensive breach detection
Face Recognition — Identifies trusted persons and automatically suppresses false alarms with personalized greetings
3D Security Zones — Draw custom polygonal zones with animated visualization and real-time breach detection
Motion Heat Map — Visualizes movement patterns with color-coded intensity overlay
Telegram Integration — Full remote control with inline buttons, live snapshots, and instant alerts
Smart Alarm System — Audio alerts with text-to-speech announcements and mute controls
Multi-Source Input — Supports live cameras and video file playback with full transport controls


How It Works



Detection Flow Diagram


Detection Pipeline Explained:

  1. Frame Capture — Camera feed is captured at up to 30 FPS with configurable resolution (default 1280×720)

  2. Preprocessing — Frames are resized and normalized for optimal neural network performance

  3. Parallel Detection — Three detection modules run simultaneously:

    • YOLOv8 identifies person bounding boxes with confidence scores
    • MediaPipe Pose extracts 33 skeleton landmarks for each detected person
    • Face Recognition matches faces against the trusted database
  4. Detection Fusion — Results are merged to create comprehensive person profiles including:

    • Bounding box coordinates
    • Skeleton joint positions
    • Partial body detections (hands, feet, torso)
    • Face identity and trust status
  5. Zone Analysis — Each detection is checked against defined security zones:

    • Full body overlap detection
    • Individual landmark breach checking
    • Partial body intrusion detection
    • Motion-correlated breach verification
  6. Alert Dispatch — When breach is confirmed:

    • Alarm sound triggers immediately
    • TTS announces the intrusion
    • Snapshot is captured and saved
    • Telegram notification sent with photo
    • Database logs the event


Components



🧠 Core Engine Module Technology Function
main.py
gui.py
config.py
Person Detection YOLOv8 Neural network person detection with confidence scoring
Skeleton Tracking MediaPipe 33-point pose estimation for partial body detection
Face Recognition face_recognition Trusted person identification with auto-processing
📡 Communication Module Protocol Function
telegram_bot.py
audio.py
Remote Control Telegram API Inline buttons, live snapshots, instant alerts
Audio Alerts pyttsx3 + pygame Text-to-speech announcements and alarm sounds
💾 Data Layer Module Storage Function
database.py
utils.py
Event Logging SQLite Persistent storage for events and daily statistics
Zone Management Memory Polygon geometry, 3D rendering, breach detection


Installation


Prerequisites:

  • Python 3.10 or higher
  • Webcam or IP camera
  • Telegram account (for remote control)

Step 1: Clone the Repository

git clone https://github.com/Binivert/Security-System.git
cd Security-System

Step 2: Create Virtual Environment

python -m venv venv
source venv/bin/activate  # Linux/Mac
venv\Scripts\activate     # Windows

Step 3: Install Dependencies

pip install -r requirements.txt

Step 4: Configure Telegram Bot

  1. Create a bot via @BotFather on Telegram
  2. Copy your bot token
  3. Get your chat ID from @userinfobot
  4. Update config.py with your credentials:
TELEGRAM_BOT_TOKEN = "your_bot_token_here"
TELEGRAM_CHAT_ID = "your_chat_id_here"

Step 6: Add Trusted Faces (Optional)

Place photos of trusted persons in the trusted_faces/ folder. The system will automatically process them on startup.



Usage


Starting the System:

python main.py

🖥️ GUI Controls 📱 Telegram Commands ⌨️ Keyboard Shortcuts
Control Action
🔒 ARM SYSTEM Activate monitoring
⏺ Record Start/stop recording
📸 Snap Capture snapshot
🔇 Mute Silence alarms
➕ New Zone Create security zone
✏️ Draw Add zone points
🤖 Auto-Detect Auto-detect corners
Command Description
/arm Arm the system
/disarm Disarm the system
/snap Request snapshot
/status Get system status
/stats View daily stats
/mute Mute alarm
/unmute Unmute alarm
/record Start recording
/stoprecord Stop recording
/sensitivity Adjust sensitivity
Key Action
A Toggle arm/disarm
R Toggle recording
Space Take snapshot
F11 Toggle fullscreen
Esc Exit fullscreen


File Structure


Security-System/
├── main.py              # Application entry point
├── gui.py               # PyQt6 GUI and main logic
├── config.py            # Configuration settings
├── detectors.py         # YOLOv8, MediaPipe, face recognition
├── telegram_bot.py      # Telegram bot integration
├── audio.py             # TTS and alarm system
├── database.py          # SQLite event logging
├── utils.py             # Zone management utilities
├── requirements.txt     # Python dependencies
├── trusted_faces/       # Trusted person photos
├── recordings/          # Saved video recordings
├── snapshots/           # Captured snapshots
└── alerts/              # Alert evidence photos


Demo

Untitled.video.-.Made.with.Clipchamp.mp4

📱 Telegram Remote Control Demo

Real-time alerts, snapshots, and full system control directly from your phone

Live intrusion alert with snapshot

What You’re Seeing

  • 🚨 Instant intrusion notification
  • 📸 Auto-captured snapshot
  • 🔘 Inline control buttons
  • 🔐 Arm / Disarm remotely
  • 🔇 Mute alarms instantly

Designed for speed, clarity, and zero friction
your security system responds in seconds, wherever you are.



Footer


About

An AI-powered, real-time surveillance system that fuses YOLOv8 person detection, MediaPipe skeleton tracking, face recognition, and Telegram remote control to deliver intelligent zone-based intrusion detection, automated alerts, and visual monitoring from any camera.

Topics

Resources

License

Stars

Watchers

Forks

Languages