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.
- 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
- Python
- YOLOv8 (Ultralytics)
- OpenCV
- NumPy
MLP2-Traffic-Analysis-Using-YOLOv8/
│
├── traffic_analysis.py
├── requirements.txt
├── README.md
├── Camera Feed.jpg
├── Detection.jpg
├── Executing.png
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
- Place your input video in the project folder:
traffic.mp4
- Run the script:
python traffic_analysis.py
- Output will be generated as:
output.mp4
https://drive.google.com/file/d/1E-Bqly11JwZAEd-fOcMSm0EmCkcVeDJk/view?usp=sharing
https://drive.google.com/file/d/1DdPM9zPI_woCqy967lBUGdMOARu-HYlu/view?usp=sharing
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)
- Distance between vehicles is calculated using pixel values
- Real-world distance estimation requires camera calibration
- Smart city traffic monitoring
- Traffic flow analysis
- Intelligent transportation systems
- AI-based surveillance
machine-learning, computer-vision, yolov8, opencv, traffic-analysis, vehicle-detection, real-time-detection, smart-city
Nithish Praba M P


