AI-Based Traffic Violation Detection System Using Computer Vision
Oluwasefunmi Busola Famodimu *
Department of Computer Science, Babcock University, Ilishan-Remo, Nigeria.
Mayowa Osundina
Department of Computer Science, Babcock University, Ilishan-Remo, Nigeria.
Dorachima Ifeanyi
Department of Computer Science, Babcock University, Ilishan-Remo, Nigeria.
Oluwayemisi Fatade
Department of Computer Science, Babcock University, Ilishan-Remo, Nigeria.
*Author to whom correspondence should be addressed.
Abstract
Aims: This project presents the development and implementation of an AI-based traffic violation detection system designed to automate the monitoring of road traffic violations using CCTV footage and computer vision techniques. The aim is to create a comprehensive solution that can analyse real-time or recorded video streams to detect violations such as red-light running and speeding, thereby improving road safety and reducing the manual surveillance burden.
Study Design: The research employed a modular, data-driven approach combining software engineering best practices with advanced machine learning and computer vision techniques. The system was developed iteratively with a component-based architecture supporting separation of concerns and scalability.
Place and Duration of Study: The study was conducted at Babcock University, Department of Computer Science, School of Computing, Ilishan-Remo, Nigeria, from September 2023 to May 2024.
Methodology: The implementation utilised Python as the primary programming language, OpenCV for image processing and video analysis, and the YOLOv8 deep learning model for real-time object detection and vehicle classification. Multi-object tracking was accomplished using the DeepSORT algorithm, enabling consistent vehicle identification across video frames. Speed estimation was performed through frame displacement analysis and timestamp calculations. A rule-based violation detection module was integrated to identify traffic offences, including red-light violations and speeding. An Automatic Number Plate Recognition (ANPR) component utilising Optical Character Recognition (OCR) was included for vehicle identification. A structured MySQL database was implemented to store violation records with timestamps and evidence. An administrative dashboard, developed using HTML, CSS, JavaScript, and Bootstrap, provides real-time analytics, processing history, and violation reporting capabilities. The system architecture follows a three-tier model: Client-Side (Frontend), Server-Side (Backend), and Database Layer.
Results: Functional testing confirmed successful video upload, accurate vehicle detection using the YOLOv8 model, which demonstrated high precision, reliable multi-object tracking with consistent vehicle ID maintenance, accurate speed estimation through frame analysis, and correct violation flagging with real-time visual alerts. Performance evaluation demonstrated that the YOLOv8 model processed video frames efficiently at optimal detection speed, maintaining consistent detection accuracy and tracking reliability under various traffic conditions, including different lighting, weather, and traffic density scenarios. The system successfully generated violation reports with vehicle identification through licence plate recognition, timestamps, and evidence imagery for enforcement purposes.
Conclusion: The AI-based traffic violation detection system provides a practical and innovative solution to contemporary traffic violation control and management challenges. By integrating advanced computer vision features, including object detection, multi-object tracking, and automatic number plate recognition, the system analyses captured footage with high accuracy to identify violations and extract relevant vehicle details. The system's ability to provide real-time evidence capture and generate automated violation reports demonstrates how modern AI technologies can be effectively leveraged to create practical tools that meet contemporary traffic management needs, enabling authorities to manage road safety with greater effectiveness and efficiency.
Keywords: Artificial Intelligence, computer vision, traffic violation detection, object detection, vehicle tracking, deep learning, YOLO, CCTV, automatic number plate recognition, road safety