Skip to content

mpnithishpraba/MLP2-Traffic-Analysis-Using-YOLOv8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MLP2-Traffic-Analysis-Using-YOLOv8

Overview

This project is an AI-based traffic analysis system that detects and classifies vehicles in video footage using YOLOv8 and computer vision techniques. It calculates the average gap between vehicles and determines traffic density as low, medium, or high.

Features

  • Real-time vehicle detection
  • Vehicle classification (car, motorbike, bus, truck)
  • Centroid-based distance estimation
  • Average gap calculation between vehicles
  • Traffic density classification
  • Annotated video output with bounding boxes and labels

Technologies Used

  • Python
  • YOLOv8 (Ultralytics)
  • OpenCV
  • NumPy

Project Structure

MLP2-Traffic-Analysis-Using-YOLOv8/
│
├── traffic_analysis.py
├── requirements.txt
├── README.md
├── Camera Feed.jpg
├── Detection.jpg
├── Executing.png

Installation

Clone the repository:

git clone https://github.com/mpnithishpraba/MLP2-Traffic-Analysis-Using-YOLOv8.git
cd MLP2-Traffic-Analysis-Using-YOLOv8

Install dependencies:

pip install -r requirements.txt

Usage

  1. Place your input video in the project folder:
traffic.mp4
  1. Run the script:
python traffic_analysis.py
  1. Output will be generated as:
output.mp4

Demo Videos

Input Video

https://drive.google.com/file/d/1E-Bqly11JwZAEd-fOcMSm0EmCkcVeDJk/view?usp=sharing

Output Video

https://drive.google.com/file/d/1DdPM9zPI_woCqy967lBUGdMOARu-HYlu/view?usp=sharing

Results

Camera Feed (Input)

Camera Feed

Vehicle Detection Output

Vehicle Detection

Code Execution

Execution

Output

The output video includes:

  • Bounding boxes around vehicles
  • Vehicle type labels
  • Centroid points
  • Total vehicle count
  • Average gap between vehicles
  • Traffic status (Low / Medium / High)

Notes

  • Distance between vehicles is calculated using pixel values
  • Real-world distance estimation requires camera calibration

Applications

  • Smart city traffic monitoring
  • Traffic flow analysis
  • Intelligent transportation systems
  • AI-based surveillance

Topics

machine-learning, computer-vision, yolov8, opencv, traffic-analysis, vehicle-detection, real-time-detection, smart-city

Author

Nithish Praba M P

About

AI-based Traffic Analysis System using YOLOv8 that detects vehicles in video footage, classifies them (car, bus, truck, motorbike), calculates inter-vehicle distance (average gap), and determines real-time traffic density (low, medium, high) using computer vision techniques.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages