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