A Computer Vision-based Traffic Signal Violation Detection System developed using YOLOv3 and Tkinter for detecting violations from video footage. This system provides a user-friendly graphical interface for easy interaction.
- Introduction
- Objectives
- System Overview
- Methodology
- Requirements
- Installation
- Usage
- Libraries Used
- Output
- Contributors
- License
The growing number of vehicles on roads has resulted in an increase in traffic violations, which in turn leads to accidents and property damage. To address this problem, this project aims to automate traffic signal violation detection in real-time. The system enforces traffic regulations, helping traffic authorities monitor roads more efficiently.
The system can:
- Detect traffic signal violations in real-time.
- Provide a simple and user-friendly graphical interface.
- Enable authorities to monitor traffic and take action swiftly.
The goal of this project is to automate the detection of traffic signal violations, making it easier for authorities to monitor roads and take action against violators efficiently.
Key objectives:
- Real-time Detection: Detect vehicles crossing traffic signals in real time.
- User-friendly Interface: Provide an easy-to-use graphical interface to operate the system.
- Automated Monitoring: Allow authorities to automate traffic monitoring and rule enforcement.
The system captures video footage, processes each frame using YOLOv3 object detection, and detects if any vehicle crosses a defined traffic signal line.
The system uses the YOLOv3 model to classify and detect vehicles in the video footage. Once a vehicle is detected, the system checks whether it crosses a predefined line, which serves as the traffic signal boundary.
- Open Video Footage: The user can load video footage from the storage using the "Open" option in the File menu.
- Set Region of Interest (ROI): The user selects two points to define the traffic signal line.
- Detection Process: The system detects vehicles that cross the signal line and highlights violations in real-time.
- Output: Violations are logged, and an output video (
output.mp4
) is generated showing the violations.
Before running the system, ensure the following dependencies are installed:
- Python 3.7+
- Keras
- TensorFlow
- OpenCV
- Tkinter
- PIL (Pillow)
-
Clone the repository:
git clone https://github.com/yourusername/Traffic-Signal-Violation-Detection-System.git cd Traffic-Signal-Violation-Detection-System
-
Install the required libraries:
pip install -r requirements.txt
-
(Optional) Download the YOLOv3 pre-trained weights and place them in the appropriate directory:
wget https://pjreddie.com/media/files/yolov3.weights
-
Run the application:
python Project-GUI.py
- Open the application by running
Project-GUI.py
. - Load a video file by selecting File > Open.
- Define the Region of Interest (ROI) by selecting Analyze > Region of Interest and clicking on two points to draw the line.
- The system will process the video and display detected violations. It will generate an output file (
output.mp4
) with the violations highlighted.
python Project-GUI.py
Follow the GUI prompts to load video footage and detect violations.
- Tkinter: Used for creating the graphical user interface.
- OpenCV: Used for processing video footage and images.
- Keras: Used for building and running the YOLOv3 object detection model.
- PIL (Pillow): For image handling in the GUI.
- NumPy: For numerical computations.
The system generates an output video (output.mp4
) in the output
folder, which highlights traffic violations detected in the input footage.
- Your Name - @alihadimoghadam
This project is licensed under the MIT License - see the LICENSE file for details.