Skip to content

Repository files navigation

🛡️ VisionGuard AI — Smart Video Surveillance & Tracking

VisionGuard AI is a professional-grade video surveillance system that combines real-time YOLOv8 object detection with Kalman Filter-based tracking and intelligent dynamic zooming. Designed for security and monitoring, it allows users to interactively select objects for tracking, automatically focusing the camera feed on the target with smooth transitions.


✨ Key Features

  • 🚀 Real-Time Detection: Leverages YOLOv8 (and v5) for lightning-fast object identification across 80+ classes.
  • 🎯 Intelligent Tracking: Implements a Kalman Filter to predict and smooth object trajectories, ensuring stable tracking even during fast movement.
  • 🔍 Dynamic Auto-Zoom: Automatically crops and scales the video feed to keep the tracked object centered and clearly visible.
  • 🖱️ Interactive GUI Selection: Press t to open a selection menu and pick a specific detected object to track in real-time.
  • 🚨 Multi-Layered Alerts:
    • Motion Detection: Uses MOG2 background subtraction to detect movement.
    • Audio Alarms: Integrated winsound alert system for critical detections.
  • 📸 Automated Forensics: Automatically saves high-resolution frames when specific objects (e.g., people, cars) are detected.

🛠 Tech Stack

  • Core: Python 3.9+
  • Computer Vision: OpenCV, Ultralytics (YOLOv8)
  • Deep Learning: PyTorch
  • Tracking Algorithm: Kalman Filter (Linear State Prediction)
  • GUI: Tkinter & TTK
  • Alerts: Winsound (Windows Native)

📁 Project Structure

VisionGuard/
├── main.py                # Entry point: Main loop, Tracking & Zoom logic
├── object_detector.py     # YOLO Model wrapper and frame saving logic
├── motion_detector.py     # Background subtraction (MOG2) logic
├── alert_system.py        # Windows-based audio alert system
├── test_camera.py         # Utility to verify camera hardware
├── yolov8n.pt             # Pre-trained YOLOv8 weights (Nano)
├── requirements.txt       # Project dependencies
└── detected_frames/       # Directory where forensic captures are saved

⚙️ Installation & Setup

1. Clone the Repository

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

2. Install Dependencies

pip install -r requirements.txt

3. Requirements

Ensure you have the following installed:

  • opencv-python
  • ultralytics
  • torch
  • numpy

🚀 Usage

Starting the System

Run the main application to launch the surveillance feed:

python main.py

Controls

Key Action
t Target: Open the selection menu to choose an object to track.
q Quit: Safely close the application and release camera resources.

Tracking Workflow

  1. Start the script. The system will begin detecting all objects in the frame.
  2. Press t. A dropdown menu will appear listing all currently visible objects.
  3. Select an object. The camera will immediately lock-on and zoom into that target.
  4. If a Person or Car is detected, the system will automatically save a snapshot to the detected_frames/ folder.

🔬 How it Works

  1. Detection Phase: The frame is passed through YOLOv8. Bounding boxes and class labels are extracted.
  2. Target Selection: When a target is chosen, its centroid coordinates are fed into a Kalman Filter.
  3. State Prediction: The filter predicts the object's next position, minimizing jitter caused by detection fluctuations.
  4. Camera Transformation: A smooth crop-and-resize operation is applied to the frame, centered on the predicted coordinates, creating a "digital zoom" effect.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


Developed for Advanced AI Surveillance Research

About

AI-powered smart surveillance system using YOLOv8, Kalman Filter tracking, and dynamic auto-zoom for real-time object detection and monitoring.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages