Professional Documents
Culture Documents
Project Report
Project Report
On
Real Time Vehicle Counting system
Bachelor of Technology
In
Computer Science and Engineering
(Artificial Intelligence and Machine Learning)
Submitted By
Affiliated to
2023-2024
1. Introduction
Congestion is a big problem; we meet it every day on the way. In order to solve this
problem, we need to have a system that helps us to know the state of the road, Parking
area etc before reaching it. Then this system is done through several steps, starting with
the important one that focuses on the counting of vehicles passed on the several spot
like road, parking area, etc. The latter helps to estimate the state of the spot at a specific
point in time. Since we work with CCTV cameras, the conception of this system can
meet several problems and difficulties on different sides, the hardware side if the
camera is misplaced, the side of the scene poses the problem of changes in brightness
and movement of the background, that we need to solve in this work. In congestion, we
find the distance between vehicles too small, which poses difficulties in terms of
detection and counting because we will count several vehicles as a single object. In a
video surveillance system, the detection of moving objects is the first step. A lot of
work is focused on detection. Computer vision technique we will used. Computer
vision techniques are often used to detect vehicles within images or video frames. This
involves identifying regions of interest in the visual data that likely contain vehicles.
Methods such as edge detection, contour analysis, and feature extraction may be
employed for this purpose. Once potential vehicles are identified, they are usually
enclosed in bounding boxes. which facilitates the detection, then we apply our counting
algorithm.
2. Objectives
The primary aim of the Vehicle Counting System within real-time traffic surveillance is to
create a resilient and effective framework capable of accurately detecting and enumerating
vehicles within targeted zones, specifically in urban or high-traffic settings. This system
plays a pivotal role in traffic surveillance and management by:
Focusing on refining and augmenting its capabilities to enhance the precision and reliability
of vehicle detection and counting processes.
Parking Lot Management: In urban areas, the system can be used to manage
parking lots by monitoring the availability of parking spaces and guiding drivers to
open spots, reducing congestion and making parking more efficient.
Smart City Initiatives: The system supports smart city initiatives by providing data
that can be integrated into broader smart city solutions, including intelligent
transportation systems.
Environmental Impact Assessment: The system can collect data on traffic volume,
which is essential for assessing the environmental impact of transportation systems,
including air quality and emissions.
Public transportation agencies can use the data to plan bus schedules, manage routes,
and adjust the public transit system based on demand.
Incident Detection: The system can quickly identify unusual traffic patterns or
incidents, such as accidents or road closures. This enables rapid response by traffic
authorities or emergency services to manage and mitigate the impact of such incidents.
3. Existing System
Open ALPR: OpenALPR is an open-source Automatic License Plate Recognition
system that often incorporates vehicle counting as a feature. It uses YOLOv2/v3 for
vehicle detection.
Toll Booths and Traffic Analysis: Toll booth systems and traffic management
solutions frequently integrate YOLO-based models for vehicle counting and tracking.
Related Work: -
YOLO-Based Object Detection: Various research papers and projects focus on the
use of YOLO-based models for vehicle detection and counting, often introducing
modifications or enhancements to improve accuracy and real-time performance.
Drone-Based Vehicle Counting: Research may extend YOLOv7 for vehicle counting
in aerial footage, which can be used for traffic analysis or monitoring large outdoor
events.
4. Motivation
The motivation behind developing a real-time vehicle counting system is to address
various practical and utilitarian needs, such as:
Traffic Management: Efficiently managing traffic flow and congestion in urban areas
to reduce travel time and enhance transportation infrastructure.
Urban Planning: Collecting data for urban planners to make informed decisions
regarding road expansions, public transportation improvements, and infrastructure
development.
Route Planning: Vehicle counting data helps drivers choose the most efficient routes,
reducing travel time and fuel consumption. Navigation apps and systems often use this
data to provide real-time traffic updates and route suggestions.
5. Methodology
Model Selection:
We have chosen the YOLOv7 model architecture as our base model for vehicle
detection. YOLOv7 provides various sizes (e.g., YOLOv7-S, YOLOv7-M, YOLOv7-
L) with different trade-offs between speed and accuracy.
Fine-Tunning:
Real-Time Inference:
As part of the project, the next crucial step is the development of a user-friendly
interface meticulously designed for the purpose of real-time monitoring and the
presentation of vehicle counts. This interface is poised to be the bridge that connects
the complex technological underpinnings with the end user.
The visualization tools are expected to enhance the user experience by offering a clear,
informative, and aesthetically pleasing interface. The real-time monitoring becomes
more than just a passive observation; it becomes a dynamic and insightful process that
empowers users to make informed decisions and interventions.
An email alert system is developed that monitors the real-time vehicle count.
Set a predefined threshold for the maximum allowed vehicle count. If the real-time
count exceeds this threshold, trigger an email alert. The email alert should contain
information about the count exceeding the limit and a screenshot of the scene at that
moment.
The Testing and Validation phase represents a critical milestone in the development of
the real-time vehicle counting system. It is a comprehensive process designed to verify
that each component, from vehicle counting and tracking to the email alert system,
functions precisely as intended. Moreover, this phase aims to affirm the accuracy and
reliability of the entire system, ensuring that it operates seamlessly under various real-
world conditions.
6. Plan of work
Project Scope and Planning:
• Install Dependencies: Set up the required libraries like OpenCV, PyTorch, and
dependencies for YOLOv7.
• Download Pre-trained YOLOv7 Model: Retrieve the pre-trained weights for the YOLOv7
model.
• Data Collection: Gather a dataset of vehicle images or videos, ensuring diversity in vehicle
types, angles, and lighting conditions.
• Annotation: Annotate the dataset with bounding boxes around vehicles for training
purposes.
• Transfer Learning: Use the pre-trained YOLOv7 model and fine-tune it with your
annotated vehicle dataset.
• Model Training: Train the modified YOLOv7 model specifically for vehicle detection.
Real-Time Implementation:
• Camera/Video Stream Integration: Set up a system to access live camera feeds or video
streams.
• Real-Time Object Detection: Use the trained YOLOv7 model to perform vehicle detection
on the incoming video stream.
• Bounding Box Processing: Process the detected bounding boxes to identify vehicles and
keep track of their counts.
• Threshold Logic: Implement logic to compare the count against a predefined threshold
number.
Alerting Mechanism:
• Alert Trigger: When the vehicle count surpasses the threshold, trigger an alert mechanism.
• Alert System Integration: Set up a mechanism (email, SMS, notification, etc.) to send alerts
to designated recipients.
Performance Evaluation:
• Accuracy Assessment: Evaluate the model's accuracy in detecting and counting vehicles in
real-time scenarios.
• Threshold Testing: Validate the threshold logic under various traffic conditions.
• User Interface Development: Create a user interface to display real-time vehicle counts and
alert statuses.
• System Integration: Integrate the vehicle counting, threshold logic, and alerting
mechanisms into a cohesive system.
• Scenario Testing: Test the system under different scenarios (high traffic, varying weather
conditions, etc.) to ensure accuracy and reliability.
• Alert System Validation: Validate the alert system's functionality by triggering alerts with
different vehicle count scenarios.
• CPU: we can run YOLOv7 on a CPU, but it may be slow for real-time
processing.
• GPU (Recommended): For faster training and real-time inference, having a
CUDA-compatible GPU from NVIDIA is highly recommended. YOLOv7 is
optimized for GPU acceleration.
• Memory (RAM): Deep learning models, especially when working with large
images or videos, require a significant amount of RAM. 16GB or more is
recommended.
• Storage: we'll need storage space for the model files, dataset, and other
project-related files.
• Camera(s): If you're working with live video feeds, you'll need cameras or
video sources.
References
[1] F. Li, C.-H. Lee, C.-H. Chen, L.P. Khoo, Hybrid data-driven vigilance model in traffic control
centre using eye-tracking data and context data, Adv. Eng. Inform. 42, 2019
[2] Y. Zhang, Y. Sun, Z. Wang, and Y. Jiang, “YOLOv7-RAR for Urban Vehicle Detection,”
Sensors, vol. 23, no. 4, Art. no. 4, 2023
[3] Wang, C.Y., Bochkovskiy, A. and Liao, H.Y.M., YOLOv7: Trainable bag-of-freebies sets
new state-of-the-art for real-time object detectors, 2022
[4] Dollár, P.; Singh, M.; Girshick, R. Fast and accurate model scaling. In Proceedings of the
IEEE/CVF Conference on Computer Vision and Pattern Recognition, Nashville, TN, USA, 20–
25 June 2021; pp. 924-932
[5] Sivaraman, M.M. Trivedi, Looking at vehicles on the road: A survey of visionbased vehicle
detection, tracking, and behavior analysis, IEEE Trans. Intell. Transp. Syst. 14 (4) 1773-1795,
2013
[6] R. Girshick, Fast r-cnn, in: 2015 IEEE International Conference on Computer Vision (ICCV),
pp. 1440-1448, 2015
[7] B.A. Alpatov, M.D. Ershov, “Real-time stopped vehicle detection based on smart camera,”
Proceedings of 6th Mediterranean Conference on Embedded Computing (MECO), pp. 171-174,
2017
[8] C.S. Royden, M.A. Holloway, “Detecting moving objects in an optic flow field using
direction- and speed-tuned operators,” Vision Research,vol. 98, pp. 14-25, 2014.
[9] D. Li, B. Liang, W. Zhang, “Real-time moving vehicle detection, tracking, and counting
system implemented with OpenCV,” Information Science and Technology, pp. 631-634, 2014.
[11] Lin, T. Y., M. Maire, S. Belongie, J. Hays, P. Perona, D.Ramanan, P. Dolla´ r, and C. L.
Zitnick. Microsoft COCO: Common Objects in Context. European Conference on Computer
Vision, Zurich, Switzerland, pp. 740–755, 2014.
[12] Ren, S., K. He, R. Girshick, and J. Sun. Faster R-CNN: Towards Real-Time Object
Detection with Region Proposal Networks. IEEE Transactions on Pattern Analysis &
Machine Intelligence, Vol. 39, No. 6, pp. 1137–1149, 2015.
[13] Redmon, J., and A. Farhadi. YOLO9000: Better, Faster,Stronger. Proc., IEEE Conference
on Computer Vision and Pattern Recognition, Honolulu, Hawaii, pp. 7263–7271, 2017.
[14] Asha Ashwini A/P Muthar pavalar, Measuring Of Real-Time Traffic Flow Using Video
From Multiple IP-Based Cameras,2019, IEEE International Conference on Signal and Image
Processing Applications. Amit Ghosh, An Adaptive Video-based Vehicle Detection,
Classification, Counting, and Speed-measurement System for Real-time Traffic Data Collection,
2019
[15] Mirthu bashini J,Video based vehicle counting using Deep Learning Algorithm, 6th
International Conference on Advanced Computing & Communication Systems (ICACCS), 2020.
Mr. Nikhil Chhadikar, Image processing based Tracking and Counting Vehicles, Third
International Conference on Electronics Communication and Aerospace Technology [ICECA
2019]