AI-Powered Traffic Violation Detection System Development by Fares SultanAI-Powered Traffic Violation Detection System Development by Fares Sultan

AI-Powered Traffic Violation Detection System Development

Fares Sultan

Fares Sultan

Intelligent Traffic Monitoring & Violation Detection System

An AI-powered traffic monitoring system for detecting, tracking, and analyzing vehicles in road traffic videos.
The system combines object detection, multi-object tracking, vehicle counting, direction estimation, speed estimation, traffic-light detection, and traffic-violation analysis into a unified video-processing pipeline.

Features

Vehicle detection using YOLO
Multi-object tracking using ByteTrack
Vehicle counting
Vehicle direction estimation
Road calibration
Wrong-way driving detection
Vehicle speed estimation
Speed-limit violation detection
Traffic-light detection
Red-light violation detection
Automatic violation evidence collection
Centralized violation management
Streamlit web interface — currently under development

System Pipeline

The system processes traffic videos through a unified pipeline:

Project Structure


The data/, outputs/, and tests/ directories are excluded from the repository because they contain local datasets, generated files, and development/testing resources.

The Streamlit interface is currently under development and will be added to the app/ directory.

Demo

Vehicle Tracking

Vehicle Counting

Speed-Limit Sign Detection

Red-Light Violation Detection

Technologies

Python
PyTorch
Ultralytics YOLO
OpenCV
NumPy
ByteTrack

Models

The project uses YOLO-based models for vehicle and traffic-sign detection.

Vehicle Detection

The final vehicle detection model is:

Traffic Sign Detection

The traffic-sign detection model is:

The models used in the final system are included in the repository.

Datasets

Three datasets were used during the development of the system.

1. Road Traffic Dataset

This dataset was used for general road-traffic object detection, including vehicles, motorcycles, bicycles, traffic lights, and crosswalks.

2. Traffic Vehicle Dataset

This dataset was used to provide additional vehicle classes and training samples.
The first two datasets were merged into a unified dataset for the main vehicle and traffic-object detection model.
During preprocessing, the datasets were:
Class-mapped into a common label scheme
Converted into a unified YOLO detection format
Combined while preventing filename conflicts
Validated for missing labels and invalid bounding boxes
Organized into unified train, validation, and test splits

3. Traffic Speed-Limit Sign Dataset

This dataset was used separately for the traffic-sign detection model, which is responsible for detecting speed-limit signs used by the speed-violation component.
The datasets themselves are not included in this repository because of their size and dataset distribution/licensing considerations.
The dataset preparation and validation scripts are included in:

Data Preprocessing

The project includes several utilities for dataset preparation, analysis, and validation.
Examples include:

These utilities were used to analyze class distributions, prepare dataset splits, merge different datasets, remap classes, convert label formats, and validate the final unified dataset.

Configuration

Traffic and road-related settings are stored under:

The main traffic configuration is:

Road-specific calibration settings are stored under:

These configurations control parameters such as:
Detection confidence
Image size
Vehicle classes
Speed measurement lines
Reference distance
Speed limit
Road type

Running the Pipeline

The main traffic-processing pipeline is implemented in:

The pipeline can be imported and used from a Python script:

Replace the video path with the path to your local traffic video.

Output

The system can generate:
Processed traffic videos
Vehicle tracking information
Vehicle counts and direction information
Speed measurements
Violation records
Violation evidence images
Generated files are stored locally and excluded from Git where appropriate.

Limitations

The accuracy of direction, speed, and traffic-violation detection depends on several factors, including:
Camera position
Video resolution
Road configuration
Vehicle visibility
Lighting conditions
Calibration accuracy
Speed estimation in particular depends on the configured road reference distance and measurement lines.

Future Development

The project is currently being extended with a Streamlit-based web interface to provide a user-friendly interface for running the traffic-monitoring pipeline.

License

This project is licensed under the MIT License.
See the LICENSE file for more information.
Like this project

Posted Sep 28, 2026

Developed AI-powered system for traffic monitoring and violation detection.