Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Major Project

On
Real Time Vehicle Counting system

For the partial fulfilment for the award of the degree of

Bachelor of Technology
In
Computer Science and Engineering
(Artificial Intelligence and Machine Learning)

Submitted By

Shaunav Jadhav (2001921530050)


Rahul yadav (2001921530043)
Tanveer Alam (2001921530056)

Under the supervision of

Ms. Varsha Singh

G.L. BAJAJ INSTITUTE OF TECHNOLOGY & MANAGEMENT,


GREATER NOIDA

Affiliated to

DR. APJ ABDUL KALAM TECHNICAL UNIVERSITY,

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.

Surveillance Systems: Various commercial and open-source surveillance systems,


such as Blue Iris and Zone Minder, include vehicle counting modules that may use
YOLO-based models.
.

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.

Deep SORT Integration: Some research integrates YOLOv7 with DeepSORT


(Simple Online and Realtime Tracking) for tracking vehicles over time, which is crucial
for accurate counting.

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.

Parking Management: Monitoring available parking spaces in parking lots or


garages, helping drivers find parking spots quickly.

Environmental Monitoring: Gathering data for environmental studies, such as


vehicle emissions, traffic patterns, and air quality.

Urban Planning: Collecting data for urban planners to make informed decisions
regarding road expansions, public transportation improvements, and infrastructure
development.

Optimizing Signal Timing: Traffic signals at intersections can be optimized based on


vehicle counts, reducing waiting times for drivers and minimizing unnecessary stops.
Adaptive traffic signal systems use real-time data to adjust signal timings dynamically.

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.

Safety Improvements: By analyzing vehicle counts at accident-prone locations, traffic


management authorities can identify areas that require safety enhancements, such as
additional signage, road markings, or physical modifications.

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:

The YOLOv7 model, pre-trained for vehicle detection, serves as an invaluable


foundation. By fine-tuning this pre-trained model on our specific dataset, we can tailor
its capabilities to align with our unique requirements. This fine-tuning process
customizes a model, originally trained on a broad and general dataset, to a narrower,
domain-specific task. It empowers the model to harness its pre-learned knowledge and
adapt it for increased specialization and precision within your targeted application.

Real-Time Inference:

Implementing real-time video or image stream processing entails the application of a


meticulously fine-tuned YOLOv7 model to actively analyze and interpret visual data
as it is captured. In this dynamic process, we have the flexibility to engage with various
sources of visual input, including live camera feeds, pre-recorded video streams, or
sequences of individual images. The fine-tuned YOLOv7 model serves as the central
intelligence, swiftly and accurately identifying objects, such as vehicles, within these
streams or sequences, all in real time.

Visualization and User Interface

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.

To facilitate a seamless user experience, the interface will incorporate a range of


visualization tools and features. These tools will not only display real-time vehicle
counts but also provide insightful data representation.

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.

Email Alert System:

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.

Testing and Validation:

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:

• Define the project, objective, scope and expected outcome.


• Identifying the target area and objects to be counted.
• Set a clear project timeline and allocate resources.

Environment Setup and Model Retrieval:

• 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 Preparation and Annotation:

• 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.

Fine-Tuning and Training:

• 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.

Vehicle Counting and Threshold Logic:

• 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.

Integration and Deployment:

• 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.

Testing and Validation:

• 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.

Documentation and Maintenance:

• Documentation: Create comprehensive documentation detailing the system architecture,


configurations, and maintenance procedures.
• Maintenance Plan: Develop a plan for ongoing monitoring, updates, and potential
expansion of the system.

7. Tools and Technology


Software Requirements: -

Operating System: Any modern OS (e.g., Linux, Windows, macOS).


Python Libraries: Install necessary Python libraries.
• PyTorch or TensorFlow: Deep learning frameworks that YOLOv7 is often
implemented in.
• OpenCV: For image and video processing.
• Numpy: For numerical operations.
• Matplotlib or similar libraries for visualization.
• Deep Learning Framework :- yolov7
• Many other python libraries according to our requirements.
Hardware Requirements:

• 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.

[10] N. Seenouvong, U. Watchareeruetai, C. Nuthong, K. Khongsomboon, N. Ohnishi, “A


computer vision based vehicle detection and counting system,” Knowledge and Smart
Technology, pp. 224-227, 2016

[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]

You might also like