Disclaimer: This is an example of a student written essay.
Click here for sample essays written by our professional writers.

Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of UKEssays.com.

Automatic Traffic Control Using Real-time Vehicle Detection

Paper Type: Free Essay Subject: Information Technology
Wordcount: 1648 words Published: 8th Feb 2020

Reference this


Developing nations like India and China are facing critical traffic conditions from a very long time. There are at least millions of vehicles running everyday on the roads of India. There are various digital solutions available for real time vehicle detection and counting. Real time vehicle detection and counting approach provides the three main components which detects the running vehicle and maintains count if it. We also plan to extend this research in future to analyze traffic conditions and will work on the prediction of traffic patterns.


Traffic congestion is a major challenge, especially in developing nations like India, China. There are major steps are taken to control the poor traffic conditions and lot of money spent on the traffic control system. Automatic traffic control system will detect the vehicles on the road using feature extraction techniques and weight detectors. The significances of this system include estimating traffic flow on a given road per time, predicting future traffic conditions, understanding traffic patterns and the factors that affect them, and optimizing existing manual traffic management systems. For example, this system will predict today’s traffic condition based on which one can make decision about which road to take to reach the destination faster. By using output and reports generated about the flow of traffic cities will be able to intelligently avoid the traffic jams by directing vehicle to the less traffic routes This data can be useful for traffic control agencies and systems.

Layman Approach

The vehicle counting system is made up of three main components: a detector, tracker and counter. The detector identifies vehicles in a given frame of video and returns a list of bounding boxes around the vehicles to the tracker. The tracker uses the bounding boxes to track the vehicles in subsequent frames. The detector is also used to update trackers periodically to ensure that they are still tracking the vehicles correctly. The counter draws a counting lines across the road. When a vehicle crosses the line, the vehicle count is incremented. Brief review of this components is as follows-

Detector – Detects vehicle and gives ROI(region of interest) to tracker. To detect the vehicle we are using YOLOv3 library. It’s a pretrained model to detect various objects. You just have to mention which class of objects you are looking for.It’s modified version of CNN

Tracker – Uses bounding boxes to track the vehicles in subsequent frames, detector also works periodically with tracker. Tracker takes the ROI given by Detector and keeps the track of it by identifying same pixels in every frame. Detector also works with tracker periodically to make sure that tracker is tracking the same frames. It makes centroid around the tracking object.

Counter – It draws a counting line across the road. It increments the count when centroid of detected box crosses the line.

Dataset- We have used the dataset provided by Yolo which is the big library for the object detection. Yolo did the web scraping for thousands of vehicle images in various different angles.

Database- MongoDB database is used to store the images of vehicles, features extracted from images and their HOG visulization(Histogram of Oriented Gradients). MongoDB is used over other databases because of it s ability to store large unstructred data. MongoDB is one of the best ways to store images. GridFS is used to store images. We will revisit the GridFS in next section.

Actual Image and HOG visulization


In Deep learning, a convolutional neural network is a class of deep neural networks, most commonly allpied to analyzing visual imagery. We are using YOLOv3 liberary which ultimately uses CNN to train its model.

A convolution neural network consists of an input and an output layer, as well as multiple hidden layers. The hidden layers of a CNN typically consist of convolution layers, i.e activation function, pooling layers, fully connected layers and normalization layers.

Convolutional Neural Network

Steps we performed for Vechicle identification using CNN

  1. Feature identification
  2. Model trainning
  3. Creating classifiers
  4. Using those classifiers againsed each frame to identify Vechile

We were very limited on our time constraineds so here we are using ready made model provided by YOLOv3 but we studied everyting needed to create a classification model.


GridFS is a mechanisum for storing and retrieving files that exceed the BSON-document size limit of 16 MB. MongoDb stores the data in JSON format. Images and data less than 16MB can be stored as single document. Videos and large images which exceeds 16MB can be stored using GridFS.

Instead of storing a file in a single document, GridFS divides the file into parts, or chunks , and stores each chunk as a separate document. GridFS uses a default chunk size of 255 kB; that is, GridFS divides a file into chunks of 255 kB with the exception of the last chunk. The last chunk is only as large as necessary. Similarly, files that are no larger than the chunk size only have a final chunk, using only as much space as needed plus some additional metadata.

GridFS uses two collections to store files. One collection stores the file chunks, and the other stores file metadata.

  • chunks stores the binary chunks.
  • files stores the file’s metadata.

files JSON structure Chunks JSON structure

When you query GridFS for a file, the driver will reassemble the chunks as needed. You can perform range queries on files stored through GridFS. You can also access information from arbitrary sections of files, such as to skip to the middle of a video or audio file.

GridFS is useful not only for storing files that exceed 16 MB but also for storing any files for which you want access without having to load the entire file into memory.


We have implemented this vehicle couting system using python language. Repository structure is as follows-

Technology stack-

OpenCV- Open Source Computer Vision is a library of programming functions mainly aimed at real-time computer vision. In simple language it is library used for Image Processing.

Yolo Detector– Real time object detection system

GraphGS- MongoDb database format to store large images and videos which exceeds 16MB.

Project Repository Structure

Running Python file (arguments- input video)

Input Video-

Output Video detecting vehicles-



Image processing and real time object detection takes huge load on computing resources. For better performance and faster implementation, these system demands powerful computing resources with better Graphical Processing Unit (GPUs) which was affordable to us at the implementation time. Also, there is huge tradeoff between speed and accuracy because of the poor processing units.


For better real time object detection, training large dataset plays important role in order to recognize vehicle shape and dimension. For example. hatchback and SUV. There can be certain confusion for the system to categorize the hatchback and SUV because both have similar dimension. We proposed feature-based extraction method for detecting vehicles. CNN based approach is more efficient and gives better accuracy comparing with other methods. If time permits, we would love to extend our research to next level to give database generated reports which will predict the current and future traffic condition which will save a lot of time of people.


[1] Real-time vehicle detection and tracking – K.V. Arya ; Shailendra Tiwari ; Saurabh Behwalc

[2] You Only Look Once: Unified, Real-Time Object Detection – Joseph Redmon, Santosh Divvalay, Ross Girshick{, Ali Farhadiy

[3] Hadi, Raad & Sulong, Ghazali & George, Loay. (2014). Vehicle Detection and Tracking Techniques: A Concise Review. Signal & Image Processing : An International Journal. 5. 10.5121/sipij.2013.5101.


Cite This Work

To export a reference to this article please select a referencing stye below:

Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.

Related Services

View all

DMCA / Removal Request

If you are the original writer of this essay and no longer wish to have your work published on UKEssays.com then please: