AI-powered real-time object detection system using YOLOv8 and OpenCV, designed for security surveillance applications. Supports multiple input sources including webcams, video files, and RTSP streams with zone-based detection and alert capabilities.
- Real-time Detection: YOLOv8-based object detection with configurable confidence thresholds
- Multi-source Input: Support for webcam, video files, and RTSP/RTMP streams
- Object Tracking: Centroid-based tracker for persistent object identification across frames
- Zone Detection: Define regions of interest for targeted monitoring
- Alert System: Configurable alerts with cooldown for specific object classes
- FPS Monitoring: Real-time performance overlay
- Logging: Structured logging of all detection and alert events
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Video Source │────▶│ Detector │────▶│ Tracker │
│ (Camera/File)│ │ (YOLOv8) │ │ (Centroid) │
└─────────────┘ └──────────────┘ └──────┬──────┘
│
┌──────────────┐ ┌───────▼──────┐
│ Alert System │◀────│ Zone Checker │
│ (Logging) │ │ │
└──────────────┘ └──────────────┘
git clone https://github.com/theYsnS/ai-object-detection.git
cd ai-object-detection
pip install -r requirements.txt# Webcam detection
python main.py --source 0
# Video file
python main.py --source path/to/video.mp4
# RTSP stream
python main.py --source rtsp://camera-ip:554/stream
# Custom confidence threshold
python main.py --source 0 --confidence 0.6
# With custom config
python main.py --source 0 --config config/default_config.yaml- Detection: Ultralytics YOLOv8
- Computer Vision: OpenCV
- Language: Python 3.9+
- Configuration: YAML
ai-object-detection/
├── src/
│ ├── detector.py # YOLOv8 detection engine
│ ├── tracker.py # Centroid object tracker
│ ├── alert_system.py # Alert management
│ └── utils.py # Utility functions
├── config/
│ └── default_config.yaml
├── tests/
│ └── test_detector.py
├── main.py
├── requirements.txt
└── README.md
This project is licensed under the MIT License - see the LICENSE file for details.