Skip to content

About

a real-time computer vision detection program using Python, OpenCV, and YOLOv8 to detect and classify multiple object classes from live video streams.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Real-Time Vehicle & Object Detection System

A production-quality Computer Vision detection program built with Python, OpenCV, and YOLOv8, capable of detecting 80+ object classes in real time from a webcam, video file, or image.

This project was built to demonstrate expertise in computer vision detection pipelines — a core skill for AI engineering roles.


🚀 Features

  • ⚡ Real-time detection from webcam or video file at smooth FPS
  • 🎯 YOLOv8 nano model — fast inference, small footprint (~6 MB)
  • 📦 Detects 80 COCO classes (vehicles, people, animals, objects)
  • 🎨 Per-class colour-coded bounding boxes with confidence scores
  • 📊 Live FPS counter and detection count HUD overlay
  • 🖼️ Image mode — saves annotated output to disk
  • 🔧 Uses C++-backed OpenCV routines for high-performance frame processing

🛠️ Tech Stack

Layer Technology
Language Python 3.10+
Computer Vision OpenCV (cv2)
Detection Model YOLOv8 (Ultralytics)
Numerical Processing NumPy
Backend (OpenCV core) C++

▶️ Setup & Usage

# 1. Install dependencies
pip install -r requirements.txt

# 2. Run on live webcam (default)
python detect.py

# 3. Run on a video file
python detect.py --source path/to/video.mp4

# 4. Run on a static image
python detect.py --source path/to/image.jpg

Note: The YOLOv8 nano model (yolov8n.pt, ~6 MB) downloads automatically on first run.


📁 Project Structure

object-detection/
├── detect.py           # Main detection script
├── requirements.txt    # Dependencies
└── README.md           # This file

🧠 How It Works

  1. Model Load: YOLOv8 is loaded via the Ultralytics API (a high-level wrapper over the C++-optimized PyTorch backend).
  2. Frame Capture: OpenCV's VideoCapture (a C++-backed binding) reads frames from the webcam or video file.
  3. Inference: Each frame is passed to the YOLO model, which returns bounding boxes, class IDs, and confidence scores.
  4. Annotation: Custom draw_detection() uses cv2.rectangle() and cv2.putText() to render results.
  5. HUD: FPS is calculated using time.perf_counter() and overlaid with a semi-transparent background for readability.

About

a real-time computer vision detection program using Python, OpenCV, and YOLOv8 to detect and classify multiple object classes from live video streams.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages