Skip to content

theYsnS/ai-object-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Real-Time Object Detection System

Python YOLOv8 OpenCV License: MIT

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.

Features

  • 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

Architecture

┌─────────────┐     ┌──────────────┐     ┌─────────────┐
│ Video Source │────▶│  Detector    │────▶│  Tracker    │
│ (Camera/File)│     │  (YOLOv8)    │     │ (Centroid)  │
└─────────────┘     └──────────────┘     └──────┬──────┘
                                                 │
                    ┌──────────────┐     ┌───────▼──────┐
                    │ Alert System │◀────│ Zone Checker │
                    │ (Logging)    │     │              │
                    └──────────────┘     └──────────────┘

Installation

git clone https://github.com/theYsnS/ai-object-detection.git
cd ai-object-detection
pip install -r requirements.txt

Usage

# 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

Tech Stack

  • Detection: Ultralytics YOLOv8
  • Computer Vision: OpenCV
  • Language: Python 3.9+
  • Configuration: YAML

Project Structure

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

License

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

About

Real-time object detection system using YOLOv8 and OpenCV for security surveillance applications

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages