Vehicle Detection and Classification Using Computer Vision Techniques
In the past decade, vehicular traffic in Pakistan has increased tremendously and continues to do so. Unfortunately, due to the lack of proper planification in regards to traffic management and infrastructure to support the increasing traffic, this has started to become a major bottleneck. To
2025-06-28 16:29:55 - Adil Khan
Vehicle Detection and Classification Using Computer Vision Techniques
Project Area of Specialization Internet of ThingsProject SummaryIn the past decade, vehicular traffic in Pakistan has increased tremendously and continues to do so. Unfortunately, due to the lack of proper planification in regards to traffic management and infrastructure to support the increasing traffic, this has started to become a major bottleneck.
To better manage the vehicular traffic and minimize road congestions, proper acquisition and analysis of road traffic data is necessary. Traffic surveys can capture the data that reflects the traffic conditions in a specific area. Traffic surveys can be conducted using simple technology like a pneumatic tube, which counts the number of vehicles passing through a point, or by using employing more advanced technologies incorporating state-of-the-art computer vision techniques.
Counting vehicles through traditional pneumatic tubes, which is commonly used for road traffic surveys in Pakistan, can provide some data. However, such pneumatic tubes do not provide precise vehicular count and are more prone to errors. Moreover, the data obtained from pneumatic tubes do not specify the type of traffic that most frequents on a certain road. To overcome these limitations, data collection using computer vision techniques can be utilized. Computer vision techniques provide data with high level of accuracy and also it can also easily characterize the type of traffic in certain area.
Traffic volume data, which is the number of traffic attendants passing through a road in a certain period of time, is a crucial information which indicates the utilization of the road at a given time. The traffic data and also the transport behavior are continuously collected at regular intervals. This data is essential in order to fulfill the demand of the transport models, i.e.,
- Data analysis for existing traffic
- Finding out problematic road locations during peak and off-peak times
- Modeling of minor changes in the city transport networks like closures, new sections, capacity changes, speed limits, etc.
In this project, we are going to create a cost-effective real time road traffic survey device using raspberry Pi. The device will incorporate computer vision technique to detect the vehicles and then classify those vehicles into different classes.
Project ObjectivesThe aim of the project is to design a system utilizing both raspberry pi and computer vision technique to capture and analyze real time traffic of the road.
Following are the major objectives for this project
- Perform vehicle detection using computer vision techniques.
- Post-processing the data in real-time to:
- Classify the type of traffic (light vehicle or heavy vehicle)
- Count the number of vehicles (in every class) passing through a point
- Store the data of these vehicles in a database in csv file format.
The implementation plan for this project consists of two phases
- Implementation and evaluation of computer vision algorithms
- Real-time data collection
- Implementation and evaluation of computer vision algorithms:
In the first phase of our project, we will literature review and select current state-of-the-art computer vision algorithms (OpenCV, YOLO etc.) for object detection and tracking. The algorithms will then be implemented on a personal computer and their performance will be evaluated on sample video recordings of road traffic data. The outcome of this phase is to select the best method for vehicular traffic detection and classification, which has good accuracy in detecting the vehicles and properly classifying them according to classes (light vehicle, heavy vehicle).
- Real-time Data Collection:
In the second phase of our project, we will implement the selected computer vision algorithm on a Raspberry PI micro-computer. The computer vision algorithm will perform vehicular detection and classification on traffic data coming from a live video stream obtained from a PI-cam connected to Raspberry Pi.
The Raspberry Pi will store the processed video as well as the vehicle data in an external storage device connected to Raspberry Pi. This data can then be downloaded to other systems for post processing for further analysis if required.
Benefits of the ProjectThe project can help transportation engineers, traffic authorities in:
- Understanding the traffic flow evolution. The data being derived from our project can help in forecasting traffic flow.
- Road traffic management to avoid traffic congestions during peak times.
- Proper road infrastructure planning.
Following are the final deliverables of the project
- Object Detection Model:
In the end of this project, we will have the final simulation model of object detection and classification usable for object detection, tracking and counting of vehicles.
- Pi cam Module:
This module will be able to capture the traffic flow in real-time.
- Raspberry PI Module:
Upon completion of the project, we will have a fully programmed Raspberry Pi microcontroller which can perform the above simulated tasks in real-time.
- Data Storage Device:
We will use a 128 GB micro-SD card to store the processed data. Upon post-processing, our device will be able to store the video feed and also the vehicle count file.
Final Deliverable of the Project HW/SW integrated systemCore Industry TransportationOther Industries IT , Telecommunication Core Technology Internet of Things (IoT)Other Technologies Artificial Intelligence(AI), Big DataSustainable Development Goals Industry, Innovation and Infrastructure, Sustainable Cities and CommunitiesRequired Resources| Item Name | Type | No. of Units | Per Unit Cost (in Rs) | Total (in Rs) |
|---|---|---|---|---|
| Total in (Rs) | 79860 | |||
| Raspberry Pi 4 Model B 8GB | Equipment | 1 | 45000 | 45000 |
| FTDI Cable 5V | Equipment | 1 | 2600 | 2600 |
| Raspberry Pi 4 Case with Cooling Fan and Heatsink | Equipment | 1 | 1600 | 1600 |
| Raspberry Pi 4 Micro HDMI Cable | Equipment | 1 | 800 | 800 |
| Raspberry Pi 4 Power Supply | Equipment | 1 | 1000 | 1000 |
| Raspberry Pi LCD Screen | Equipment | 1 | 8000 | 8000 |
| Raspberry Pi Camera Module | Equipment | 1 | 10000 | 10000 |
| Raspberry Pi GPIO Breakout Expansion Board | Equipment | 1 | 1000 | 1000 |
| Male to Female Jumper Wires | Miscellaneous | 40 | 4 | 160 |
| SanDisk 128GB Extreme Pro V30 Micro SD Card (SDXC) A2 UHS-I U3 - 170MB | Miscellaneous | 1 | 5700 | 5700 |
| Delivery Charges | Miscellaneous | 1 | 4000 | 4000 |