Skip to content

sairam-s0/Smart-Traffic-Violation-Detection-System

Repository files navigation

🚦 Smart Traffic Violation Detection System

An AI-powered traffic surveillance system that detects multiple types of traffic violations using computer vision and deep learning models. Each violation type is handled by a separate, independently optimized model to allow flexibility, better benchmarking, and modular updates.


🧠 Core Features

  • 🎯 Helmet Detection – Detects riders without helmets using YOLOv8.
  • 😷 Face Mask Detection – Identifies whether individuals are wearing masks (ResNet).
  • 🧍 Triple Riding Detection – Detects more than 2 people on a bike (YOLO/ResNet).
  • 🚫 Red Light Violation Detection – Detects vehicle movement beyond stop-line (OpenCV logic).
  • 🔍 Modular Architecture – Each model runs independently; combine or deploy separately.

🗂️ Project Structure

helmetdetection-using-yolo8m-opencv/
├── datafortesting-and-trainning/
├── testing/
├── train/
├── models/
├── scr/
├── main.py
├── dynamic signal handling.py
├── helmetvc.py
├── requirements.txt
└── README.md


🛠 Installation

  1. Clone the repo

    git clone https://github.com/sairam-s0/Smart-Traffic-Violation-Detection-System.git
    cd Smart-Traffic-Violation-Detection-System
  2. Install dependencies

    pip install -r requirements.txt
  3. Download model weights (Place your YOLO and other model weights in the appropriate folders)


🚀 How to Run

Each module runs independently:

# Helmet detection
cd Helmet-Detection
python helmet_detect.py --source your_video.mp4

# Mask detection
cd ../seatbelt-Detection
python mask_detect.py --source your_video.mp4

# Red light violation detection
cd ../Red-Light-Violation
python redlight_detect.py --source your_video.mp4

MODEL EVALUATION

📊 Model Evaluation Summary

Model Precision Recall mAP@0.5 mAP@0.5:0.95 Notes
License Plate ~0.925 ~0.95 ~0.967 ~0.815 High-performing, best across all metrics
Seatbelt Detection ~0.84 ~0.80 ~0.85 ~0.45 Stable training, real-world usable, tighter IoU weaker

🔍 Overall Observations:

  • 📈 All models show smooth learning curves with no signs of overfitting.
  • License Plate model is the strongest — highly accurate and stable.
  • 🚧 Seatbelt model performs well in general, but tighter localization (mAP@0.5:0.95) could be improved.

🧩 Why Modular?

Instead of a single monolithic pipeline, this system treats each violation type as a separate module for:

  • Easier maintenance and debugging
  • Model-specific training & optimization
  • Scalable deployment (microservices, edge devices)

🧩 Why Modular?

Instead of a single monolithic pipeline, this system treats each violation type as a separate module for:

  • Easier maintenance and debugging
  • Model-specific training & optimization
  • Scalable deployment (microservices, edge devices)

📜 License

This project is licensed under the MIT License. See LICENSE for details.


🙋‍♂️ Author

Sairam GitHub: @sairam-s0


🤝 Contributions

Pull requests, suggestions, and bug reports are welcome. Please open an issue or submit a PR with improvements or additional models.

About

This project is used for dynamic handling of traffic rules without human intervention

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages