• Stars
    star
    433
  • Rank 100,464 (Top 2 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created almost 5 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Computer Vision based Traffic Signal Violation Detection System from video footage using YOLOv3 & Tkinter. (GUI Included)

Traffic Signal Violation Detection System using Computer Vision

Project Video Demonstration

Project Report

Project Slide


Violation_Detection_Frame

INTRO

Workflow Diagram

This is a software for practice of developing a system from completely scratch. Understanding this will help a lot in system development and basic structure of a system along with computer vision, GUI with python library Tkinter and basic opencv.

Go here if you don't have time.

Table of content

Motivation

This project is made for the third year second semester System Development (CSE-3200) course.

Introduction

The increasing number of cars in cities can cause high volume of traffic, and implies that traffic violations become more critical nowadays in Bangladesh and also around the world. This causes severe destruction of property and more accidents that may endanger the lives of the people. To solve the alarming problem and prevent such unfathomable consequences, traffic violation detection systems are needed. For which the system enforces proper traffic regulations at all times, and apprehend those who does not comply. A traffic violation detection system must be realized in real-time as the authorities track the roads all the time. Hence, traffic enforcers will not only be at ease in implementing safe roads accurately, but also efficiently; as the traffic detection system detects violations faster than humans. This system can detect traffic light violation in real-time. A user friendly graphical interface is associated with the system to make it simple for the user to operate the system, monitor traffic and take action against the violations of traffic rules.

Objectives

The goal of the project is to automate the traffic signal violation detection system and make it easy for the traffic police department to monitor the traffic and take action against the violated vehicle owner in a fast and efficient way. Detecting and tracking the vehicle and their activities accurately is the main priority of the system.

Quick starting the project

  1. git clone https://github.com/anmspro/Traffic-Signal-Violation-Detection-System.git
  2. Change the directories in "Project-GUI.py" & "object_detection.py"
  3. If the yolov3.weights is not accessible, download the file from this link.
  4. Install required python dependencies into your python virtual environment.
  5. python Project-GUI.py

System Overview

System Overview

 Figure-1: Flow diagram of traffic signal violation detection system.

The System consists of two main components -

  • Vehicle detection model
  • A graphical user interface (GUI)

First the video footage from the road side is sent to the system. Vehicles are detected from the footage. Tracking the activity of vehicles, system determines if there is any violation or not. Figure 1 shows how the system works.

The Graphical User Interface (GUI) makes the system interactive for the user to use. User can monitor the traffic footage and get the alert of violation with the detected bounding box of vehicle. User can take further action using the GUI.

Methodology

Vehicle Classification

From the given video footage, moving objects are detected. An object detection model YOLOv3 is used to classify those moving objects into respective classes. YOLOv3 is the third object detection algorithm in YOLO (You Only Look Once) family. It improved the accuracy with many tricks and is more capable of detecting objects. The classifier model is built with Darknet-53 architecture. Table-1 shows how the neural network architecture is designed.

Darknet Architecture

Violation detection

The vehicles are detected using YOLOv3 model. After detecting the vehicles, violation cases are checked. A traffic line is drawn over the road in the preview of the given video footage by the user. The line specifies that the traffic light is red. Violation happens if any vehicle crosses the traffic line in red state.

The detected objects have a green bounding box. If any vehicle passes the traffic light in red state, violation happens. After detecting violation, the bounding box around the vehicle becomes red.

Implementation

Computer Vision

OpenCV is an open source computer vision and machine learning software library which is used in this project for image processing purpose. Tensorflow is used for implementing the vehicle classifier with darknet-53.

Graphical User Interface (GUI)

The graphical user interface has all the options needed for the software. The software serves administration and other debugging purposes. We don’t need to edit code for any management. For example, if we need to open any video footage, we can do it with the Open item (Figure-2).

Figure 2

 Figure-2: Initial user interface view.

Primarily, for the start of the project usage, the administrator needs to open a video footage using ‘Open’ item that can be found under ‘File’ (Figure-2). The administrator can open any video footage from the storage files (Figure-3).

Figure 3

 Figure-3: Opening a video footage from storage.

After opening a video footage from storage, the system will get a preview of the footage. The preview contains a frame from the given video footage. The preview is used to identify roads and draw a traffic line over the road. The traffic line drawn by administrator will act as a traffic signal line. To enable the line drawing feature, we need to select ‘Region of interest’ item from the ‘Analyze’ option (Figure-4). After that administrator will need to select two points to draw a line that specifies traffic signal.

Figure 4

 Figure-4: Region of Interest (Drawing signal line)

Selecting the region of interest will start violation detection system. The coordinates of the line drawn will be shown on console (Figure-5). The violation detection system will start immediately after the line is drawn. At first the weights will be loaded. Then the system will detect objects and check for violations. The output will be shown frame by frame from the GUI (Figure-6).

Figure 5

 Figure-5: Line Coordinates (from console)

Figure 6

 Figure-6: Final Output (on each frame)

The system will show output until the last frame of the footage. In background a ‘output.mp4’ will be generated. The file will be in ‘output’ folder of ‘Resources’. The process will be immediately terminated by clicking ‘q’.

After processing a video footage, the administrator can add another video footage from the initial file manager (Figure-2). If the work is complete the administrator can quit using ‘Exit’ item from File option.

Libraries used for graphical user interface:

  • Tkinter

Contributing

The main reason to publish something open source, is that anyone can just jump in and start contributing to my project. So If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.

Links and References

Author

Abu Noman Md. Sakib, Pias Roy
[email protected]
[email protected]
Student at Department of Computer Science and Engineering
Khulna University of Engineering & Technology, Khulna
Bangladesh

Supervised under
Mahmudul Hasan Shauqi
[email protected]
Lecturer
Dept. of Computer Science and Engineering
Khulna University of Engineering & Technology

Licensing

The code in this project is licensed under GNU GPLv3 license.

Stargazers over time

Stargazers over time

More Repositories

1

AI-for-Medicine-Specialization

AI for Medicine Specialization - Coursera offered by deeplearning.ai
Jupyter Notebook
120
star
2

Smart-Car-Parking-System

Smart Car Parking System using Arduino Uno.
C++
25
star
3

Python-Turtle-Graphics-Beginner-to-Advanced

A complete overview of python turtle graphics in Bangla.
Python
22
star
4

Intro-to-Tensorflow-for-Deep-Learning-Udacity

Algorithms implemented in Google Colab.
Jupyter Notebook
12
star
5

DBMS-Traveling_Management_System

Traveling Management System using Database(MySQL)
TSQL
10
star
6

Turbulent-Traveler-Full-Stack-Web-Development

Traveling blog website using asp.net
HTML
9
star
7

stoic-solutions-landing-website

A simple landing page built with vue and vuetify for organization or company.
Vue
8
star
8

Daily-iOS-App

iOS Based app with features such as Todo List, Weather Updates, Health Manager.
Swift
7
star
9

DREAM_Blood-Bank-Application-Android

Blood Bank Android App
Java
7
star
10

Datacamp_Supervised-Learning-with-scikit-learn

All the coding exercises done by me during the completion of the course.
Python
7
star
11

Drawing-Flowers-in-Python

A very basic tutorial for drawing flowers in python.
Python
6
star
12

Compiler-Design

Simple compiler to detect tokens and generate output to some basic operations.
C
5
star
13

Motion-Tracking-using-Background-Subtractor

Few lines of code to track motion using your camera.
Python
5
star
14

3D-Ball-Balancing-Game-using-CPP-and-OpenGL

A Computer Graphics based project using C++ and OpenGL. This game was built for Computer Graphics Laboratory.
C++
4
star
15

Binge-Samsung-TV-App-Tizen

A Samsung TV App for Binge, a leading OTT platform.
JavaScript
3
star
16

my-first-app

Learning angular
TypeScript
2
star
17

Leetcode

My solutions to leetcode problems
C++
2
star
18

Artificial-Intelligence-Laboratory

Python
2
star
19

Image-Processing-and-Computer-Vision-Laboratory

Python
2
star
20

SAP-1-Computer-using-Logisim

A SAP-1 computer with multiple modules and circuits. The whole circuitry was built in Logisim software. This project was made for Digital System Design Laboratory (CSE 4224)
2
star
21

Classification-of-Brain-Hemorrhage-Using-Deep-Learning-from-CT-Scan-Images

Classification of Brain Hemorrhage Using Deep Learning from CT Scan Images. https://link.springer.com/chapter/10.1007/978-981-19-7528-8_15
Jupyter Notebook
2
star
22

Aastha

An AI based platform for preventing rumors.
1
star
23

node-rabbitmq

RabbitMQ Message Consumer in Node.js with TypeScript.
TypeScript
1
star
24

Segmentation-of-Hemorrhagic-Areas-in-Human-Brain-from-CT-Scan-Images

Segmentation of Hemorrhagic Areas in Human Brain from CT Scan Images. https://ieeexplore.ieee.org/abstract/document/10103333
Jupyter Notebook
1
star
25

anmspro

1
star
26

Rice-Leaf-Disease-Prediction-System

Rice Leaf Disease Prediction System using Deep Learning, specifically leveraging the blessings of transfer learning.
HTML
1
star
27

tic-tac-toe-react

JavaScript
1
star
28

Rabbitmq-Delayed-Messaging-with-Nodejs

JavaScript
1
star
29

nps-formmaker

JavaScript
1
star
30

Listing-Skills-Vue-App

A listing skills interface using Vue.js for practice purposes.
Vue
1
star
31

Corn-Leaf-Disease-Prediction-System

Corn Leaf Disease Prediction System using Deep Learning, specifically leveraging the blessings of transfer learning.
HTML
1
star
32

Candidate-Recommendation-System-from-Job-Title

Candidate Recommendation System from Job Title
Python
1
star
33

bird-game

A MelonJS Framework based Game Application. Similar to the famous Flappy Bird Game 🎮
JavaScript
1
star
34

games-backend

PHP
1
star