Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

🚦 Smart Traffic Object Detection using YOLOv8

📌 Overview

This project presents a deep learning-based system for detecting traffic objects using YOLOv8. The model is trained to identify important road elements such as vehicles and traffic signs, aiming to simulate a simplified smart traffic monitoring system.

The system can detect multiple objects in an image and output bounding boxes, class labels, and confidence scores.


🎯 Objectives

  • Build an object detection model using YOLOv8
  • Detect key traffic elements from images
  • Evaluate model performance on validation and external images
  • Understand challenges such as class imbalance and generalization

📊 Dataset

The dataset used in this project is the Traffic Violation Detection Dataset, sourced from Kaggle.

It contains annotated images in YOLO format covering multiple traffic-related classes such as vehicles, traffic lights, and road signs.

Due to size constraints, the dataset is not included in this repository.

🔧 Preprocessing

To improve model performance, the dataset was cleaned and filtered by:

  • Removing underrepresented classes
  • Reducing class imbalance
  • Keeping only the most relevant classes
  • Removing images with no valid annotations after filtering

This resulted in a smaller but more balanced dataset. Screenshot 2026-04-03 000238


🧠 Classes Used

The model was trained on the following 10 classes:

  • Car
  • Truck
  • Bus
  • Red Light
  • Green Light
  • Stop Sign
  • No Left Turn
  • No Right Turn
  • No Stopping
  • No U-turn

⚙️ Model

  • Model: YOLOv8n (lightweight and fast)
  • Framework: Ultralytics YOLO
  • Training environment: Google Colab
  • Input size: 640x640
  • Epochs: 10–20

The model achieved strong performance on the validation dataset:

  • mAP50 ≈ 0.887
  • mAP50-95 ≈ 0.741
  • Precision ≈ 0.843
  • Recall ≈ 0.834

Class-wise Performance Highlights

  • Stop Sign: Very high accuracy (mAP50 ≈ 0.995)
  • Traffic Lights: Good detection with moderate confidence variation
  • Vehicles (Car, Truck, Bus): Stable and consistent performance
  • Turn Restrictions: High accuracy in most cases

Observations

  • The model performs very well on clear and well-represented classes
  • Strong detection consistency across multiple classes
  • Some variation in performance for smaller or less frequent objects

🧪 Observations

  • Strong performance on clear objects (e.g., stop signs, vehicles)
  • Good detection in both day and night conditions
  • Moderate performance on traffic lights (lower confidence in some cases)
  • Occasional missed detections in complex scenes

⚠️ Limitations

  • Limited dataset size affects generalization
  • Some confusion between similar classes (e.g., traffic lights)
  • Lower confidence in challenging conditions (lighting, angles)
  • Dataset contains cropped objects, which may reduce real-world performance

🖼️ Sample Results

b1fb6858-5952-4724-9ee5-0b9d94cca368 0c40ac7f-2d92-4632-a0c0-b52c5ae946ea 5821ce73-9f51-4a5f-b954-3abc93ba86ba 46403ab4-b0ff-4c75-82cc-2f768770f632

🛠️ Technologies Used

  • Python
  • PyTorch
  • Ultralytics YOLOv8
  • Google Colab

📌 Conclusion

This project demonstrates a practical implementation of object detection in traffic scenarios using YOLOv8. The model performs well within the constraints of limited data and time, and highlights common challenges such as dataset quality and generalization.

About

A deep learning-based traffic object detection system using YOLOv8. The model detects vehicles and traffic signs such as cars, trucks, buses, traffic lights, and stop signs, providing bounding boxes and confidence scores. Trained on a filtered dataset and evaluated on real-world images.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages