Parking Occupancy Detection Using cOMPUTER VISION
Parking Occupancy Detection Using cOMPUTER VISION
Abstract— The surge in vehicle numbers on roads Challenges include insufficient parking lots and a narrower
contributes significantly to traffic congestion and management road network compared to developed countries.
challenges, particularly evident in developing nations like
India where the influx of cars exceeds road and parking High-density cities like Delhi and Mumbai face acute
capacity. Addressing these issues necessitates the parking shortages, leading to vehicles occupying roadsides,
implementation of sophisticated parking management systems. compounding congestion and safety risks. Finding available
This project focuses on two key objectives: detecting vehicle parking becomes time-consuming, causing traffic to
occupancy within marked parking slots and analyzing parking overflow as drivers search for spots [2].
data. Using the parking lot near IIT Kanpur main gate as a
reference, video data was collected for 14 consecutive days, Presently, manual parking procedures persist,
enabling the evaluation of vehicle occupancy and parking contributing to fuel and time wastage. Inefficient planning
patterns. and management further exacerbate the issue, impacting
public places' viability as people avoid them due to parking
Object detection algorithms such as Mask-RCNN and constraints.
YOLO-v5 were employed to identify occupied parking spaces
within the lot. Various methods, including HAAR cascade-
A smart parking system, a component of India's
based classifiers, DNN-based systems utilizing ResNet Intelligence Transportation System (ITS), integrates various
classifiers, and RCNN with IoU, were tested for detecting technologies such as communication, information
vehicles within allotted slots. The data collected was stored in processing, electronics, and control. Incorporating these
CSV format for analysis. technologies into India's transportation system yields
numerous benefits. Advancements like radio frequency
This project aims to provide insights into detecting parking identification (RFID), Internet of Things (IoT)-based
space availability and analyzing parking data to optimize time solutions, and artificial intelligence (AI) methods, including
and fuel efficiency. In the Mask-RCNN approach, pre- machine learning, deep learning, and computer vision, have
occupied spaces are denoted by red boxes, while green boxes been successfully implemented [3]. This research project
represent available parking spots. Similarly, YOLOv5 was focuses on designing a cost-effective automated off-street
utilized to count cars in video frames and identify available parking system to enhance efficiency for patrons.
parking spaces. The YOLO Annotation Toolbox facilitated the
extraction of parking space coordinates from recorded video The main objective of this work is to develop a system by
frames, which were then visualized in QGIS for further which the parked and unoccupied spaces within the parking
analysis. lot can be detected. It's also known that multiple automated
parking systems are already designed and implemented but
Keywords—Parking management system, Object detection those systems cannot be applied in India directly. So,
algorithms,Mask-RCNN, YOLOv5, data analysis, Q GIS, Real- developing a cost-effective parking system is the main
time data handling, computer vision, urban mobility. objective of this project, where the use of sensors is limited
as the maintenance cost of those sensors is extremely high.
I. INTRODUCTION Instead of this, there are the following sub-objectives of this
The automobile industry report highlights India's work-
remarkable growth from producing 22.93M vehicles Detection of the vehicles within the video frame
annually in 1733 to a US $32.73B car market by FY 2021, using a Camera sensor.
projected to reach US $54.8B by FY 2027 [1]. This growth is
paralleled by an increase in vehicles, commercial buildings, Locate the parking spaces in the marked as well as
and connecting roadways, making transportation hubs unmarked parking lots.
essential to modern society. Identify the presence or absence of the vehicles
However, with the surge in vehicles, traffic congestion within the allotted parking space.
and parking problems have escalated. Modern transportation
To find patterns and insights by parking data
infrastructure and parking facilities struggle to keep pace,
analysis.
exacerbated by India's status as a developing country.
www.ijisrt.com
International Journal of Innovative Science and Research Technology
II. LITERATURE REVIEW The parking lot occupancy status is shown on the different
platforms as-
In this section, we review previous research on
automatic smart parking management systems. The study
aims to offer insights into the extent of previous work and
the diverse approaches employed in designing and
implementing such systems. Various methods have been
utilized across different studies to address unique challenges
such as parking space availability, traffic congestion,
weather conditions, and parking schemes. The literature
review is structured into distinct methodologies, each
addressing specific aspects of smart parking management.
A. RFID based Parking System
Using Radio Frequency Identification (RFID)
technology, devices can instantly read information encoded
in tags. Consisting of an antenna and microprocessor, RFID
facilitates tracking and identification of tags attached to
vehicles. This system employs RFID readers, antennas, and
tags for managing various operations such as collecting
vehicle reports and monitoring parking occupancies [4]. Figure 2: Parking Occupancy Status on Telegram bot
Software enables efficient check-in and check-out of B. IoT Based Smart Parking Solution
vehicles, reducing congestion near parking lots. By utilizing IoT has popularized in Smart Cities, addressing issues
RFID tags, waiting times at parking gates are minimized, like traffic congestion, road safety, and smart parking
allowing only tagged vehicles to park and enhancing solutions. An IoT-based cloud-integrated system was
security while preventing unauthorized access. proposed to develop an automated parking solution,
The RFID system utilizes multiple technologies for enabling users to locate and book parking spaces via mobile
automatic vehicle identification and data capture. Generally, devices before entering the lot [6]. IoT connects physical
the components that are used in the RFID system are RFID objects through the internet, allowing them to behave in
tags, RFID readers, and antenna. An antenna is primarily lifelike manners by performing computation, sensing, and
responsible for transmitting the data to the RFID reader and communication. Cloud computing serves as the platform for
storing the data in the database system. Additionally, a local hosting IoT applications, forming a "Cloud of Things"
host computer system is essentially required for the RFID (CoT) for remote monitoring, accessing, and controlling
system. The RFID reader picks up the signal from the tag objects. This system can be implemented for indoor and
and reformats it so that it can be read. Tag data is outdoor parking systems using sensors like Geomagnetic,
transmitted via signal interference once it has been Fiber Bragg Grating, and Ultrasonic sensors, with
observed. To accomplish this, a database is connected to the Geomagnetic sensors wirelessly communicating parked
host computer system in order to store and preserve the vehicle status by sensing changes in the magnetic field [7].
data. In this research, a central database is used to control The hardware and their uses in IoT based parking
parking lot input and output. management systems are shown in table –
Anusooya G et. al. [5] suggested transferring the real-
time parking occupancy information to the website, mobile
application, and the telegram bot app using raspberry pi
communicating with the google app engine.
www.ijisrt.com
International Journal of Innovative Science and Research Technology
Generally, an ultrasonic sensor is used for outdoor When the image is captured from the camera, image
parking systems because they are cost effective and come processing is done to mean the act of arbitrarily altering an
with better accuracy. XBee sensors provide a large range of image to conform to an aesthetic standard or to provide
signal transfer distances (40 m indoor capacities and 120 m evidence for a preferred reality, and noise reduction is
outdoor capacities). The Uno module provides better generally accomplished by an image filtering technique. The
memory management and is compatible with the XBee reference image is taken initially, and the captured image is
radio. Light emitting diodes (LEDs) are used because of subtracted from the reference image to check the changes
their visibility efficiency from every direction and mostly and similarities between the two before further processing is
for their power efficiency. done.
For the removal of generated noise, morphological
processes, i.e., dilation and erosion, are employed. The
image is converted into a grey image, and image
enhancement techniques are used. Then, corners are
identified and compared by using edge detectors to check
for similarities and differences. The whole system can be
divided into the following sequential manner-System
Initialization, Image Acquisition, Image Segmentation,
Image Enhancement, Image Detection.
www.ijisrt.com
International Journal of Innovative Science and Research Technology
D. Machine Vision based Automated Parking System classification task can be viewed as a binary problem. These
Machine learning-based technology has been methods can be classified into 2 major categories-
extensively researched in recent years due to its flexibility
and cost-effectiveness. Computer Vision is the subset of Feature extraction-based methods
'artificial intelligence' (AI) technologies that enable Deep learning-based methods
computers and systems to generate relevant information
from visual inputs such as digital images and videos. Feature extraction-based methods:
Growth in AI and innovation in neural networks and deep All the images acquired by the camera are
learning led to machines surpassing humans in various tasks segmented into individual parking spaces as a pre-
related to labelling and detecting objects. The production of processing step. The image is typically scaled, and
massive amounts of data is the primary driver behind the histogram equalization tasks are performed to make it more
acceleration of computer vision technology, which is used suitable for feature extraction. In the feature extraction step,
to train the model and make the model robust. In the context one or more feature vectors are extracted from the images,
of smart parking solutions, Computer vision technique- such as Local Phase Quantization (LPR), Local Binary
based methods have been tested to overcome challenges as Pattern (LBP) and Histogram of oriented gradient (HOG)
mentioned- a.) Marking and detection of parking slots. b.) [18]. Then a classifier (support vector machine (SVM),
Classification of the parking slot based on the occupancy of multilayer perception (MLP), etc.) is used for training the
parking spaces. c.) Detection and counting the number of model and feature vectors from the images and the ground
vehicles present in the parking lot [11]. Magnetometers and truth of each image is fed to train the classifier. Then this
ultrasonic sensors are no longer necessary because a single trained model is used to perform predictions based on
camera can monitor a larger area. Furthermore, the camera's unseen images. Almeida et al. proposed to use Local Phase
installation and maintenance costs are less, and it can help Quantization (LPQ) and LBP as feature vectors and SVM as
with extra tasks like detecting theft and looking into unusual the classifier. Later, Almeida et al. used LPQ and LBP as
driver behavior [12, 13]. feature descriptors and an ensemble of SVMs was used as a
Numerous publicly accessible datasets are accessible for classifier on the PKLot dataset. In Suwignyo et al. [19],
advancing the research on computer vision-based parking LBP has been used as a feature extractor and KNN and
management systems. Some of them are as- PKLot Dataset SVMs are tested as a classifier for the parking management
[14], CNRPark, CNRPark-EXT, PLDs dataset [15,16,17]. solution. In Dizon et al., as feature descriptors, LBP and
www.ijisrt.com
International Journal of Innovative Science and Research Technology
www.ijisrt.com
International Journal of Innovative Science and Research Technology
www.ijisrt.com
International Journal of Innovative Science and Research Technology
The second stage is associated with feature extraction from Single-stage object detection algorithms are a class of
the selected candidate region using 'Scale-Invariant Feature computer vision models designed to detect objects within
Transform' (SIFT) and HOG algorithms. The third stage is images or videos in a single pass without the need for region
associated with the classification task, whose main objective proposal. These algorithms are efficient and fast, making
is to predict the class label of the selected objects. The them suitable for real-time applications. Unlike two-stage
classifiers used for such purposes are obtained from algorithms, which typically involve region proposal
machine learning, i.e., 'support vector machine' (SVM) and followed by object classification, single-stage algorithms
AdaBoost. algorithms etc. Classification accuracy is directly predict object bounding boxes and class labels from
basically measured by calculating the precision and recall input images.
estimates. 'HOG + SVM' and 'HOG + Cascade' One popular single-stage object detection algorithm is
combinations have been used for such purposes. YOLO (You Only Look Once). YOLO [30] divides the
Based on DNNs, modern object detection algorithms have input image into a grid and predicts bounding boxes and
been classified into the following 2 categories- class probabilities for each grid cell. This approach allows
YOLO to detect multiple objects in a single forward pass,
Two-stage detection algorithms making it highly efficient.
Single-stage detection algorithms Another example is SSD (Single Shot MultiBox
Detector) [31], which uses a similar approach to YOLO but
Two-stage object detection algorithms are used in introduces multiple feature maps at different scales to detect
computer vision to identify objects in images or videos. objects of various sizes. SSD achieves high accuracy by
They consist of two main stages: region proposal and object combining information from multiple feature maps at
classification. In the region proposal stage, potential object different resolutions.
regions are generated using techniques like selective search Overall, single-stage object detection algorithms offer a
or edge boxes. These regions are then passed to the object balance between speed and accuracy, making them well-
classification stage. Here, the algorithm determines the suited for real-time applications where fast inference is
presence of objects and assigns them to specific classes crucial. They continue to be an active area of research in the
using deep learning methods like Convolutional Neural field of computer vision, with ongoing efforts to improve
Networks (CNNs). Object classification involves analyzing their efficiency and accuracy.
the content of each proposed region and assigning
probability scores to different object classes. After
classification, the algorithm refines the bounding boxes of
detected objects to improve localization accuracy.
Techniques like non-maximum suppression are used to
remove redundant bounding boxes and select the most likely
object detections based on their confidence scores. Overall,
two-stage object detection algorithms are powerful tools for
accurately identifying and localizing objects in complex
scenes, with applications in autonomous driving,
surveillance, and video object tracking.
RCNN, Fast RCNN, Faster RCNN [28] and Mask RCNN
[29] are the popular algorithms as 2 stage object detection
algorithms. Figure 16: A simplified illustration of the YOLO Object Detection
Pipeline
www.ijisrt.com
International Journal of Innovative Science and Research Technology
1
mAP= n
(5)
n ∑ AP ( i )
i=0
TP
precision= (1)
TP+ FP
Recall: Recall is the proportion of true positives to actual
(relevant) objects
TP
recall= (2)
TP+ F N
F1 Score: F1 score is de_ned as the weighted average of
be compared using mAP. mAP provides researchers and
precision and recall values. The range of its values is 0 to 1,
engineers working in computer vision with a single primary
with 0 denoting the lowest accuracy. Alternatively, the F1
metric that considers both precision and recall when
score is the measure to evaluate the balance between
evaluating models.
precision and recall.
IV. SETUP AND METHODOLOGY
2∗Precision All the design parameters are looked at, and a preliminary
F 1 Score= (3)
Precision+ Recall set-up for an experiment and its challenges are described-
A. Setup of Camera Sensor:
As a result of network and hardware advancements,
desktop computing has been surpassed by the burgeoning
mobile computing industry, in which smartphones, tablets,
and computers play a significant role in people's lives. It
also features several sensors such as microphone,
gyroscope, accelerometer, digital camera, digital compass,
GPS, enabling the development of apps to help with daily
tasks.
Precision-Recall Curve: The performance of an object Figure 18: Sensors Embedded in a Smartphone [32]
detection model is assessed using this plot of precision (y- B. Data Collection
axis) and recall (x-axis). The area under this curve is called For the project, a mobile camera (Redmi Note 10 Pro)
AUC. was used to record video of the parking area, which was
mounted on a tripod stand and placed on the two-story
Average Precision: The average precision (AP), which building near the
represents the average of all the precision for a class object parking lot. The
tested for different IoU thresholds, is the compressed way to captured area
represent the AUC. Mathematically, AP is defined as- belongs to the travel
companies
associated with the
n−1 'Indian Institute of
AP=∑ [ recalls ( k )−recalls ( k+ 1 ) ]∗Precision(k )(4 Technology', Kanpur
k=0 (IIT Kanpur). The
) height and
orientation of the
www.ijisrt.com
International Journal of Innovative Science and Research Technology
tripod stand were kept constant to _x the frame size of the Figure 21: Steps involved in Yolo Annotation Tool
video. The video data is collected for 4 hours from 11 a.m.
to 3 p.m. each day from Wednesday, 04/01/2033, to The 'main.py' python file draws the bounding box around
Tuesday, 17/01/2023, through a two-story building near IIT objects on the image and stores top-left and bottom-right
Kanpur main gate no. 2. The OpenCamera Android points in the txt file format. Example of txt file below-
application was used to capture and store the data, and the
video resolution was set to a high-definition frame rate
(HD) at 1,280 x 720 (16:9, 0.92 MP). The image Figure 22: Annotation data using Yolo Annotation Tool
corresponding to the setup of the camera is shown. A power
bank was also attached to the camera to provide a power The convert.py and process.py python files are used to
supply during the whole period of recording. convert the annotations in the specific format used by the
Figure 19: Camera
Setup on the roof of the building YOLO algorithm in the training process.
C. Methodology:
This section includes information about the model The process of marking the parking slots is represented
architecture, a justification for the model selection, and a as follows-
detailed mathematical description of all the steps that were
taken throughout the entire process.
www.ijisrt.com
International Journal of Innovative Science and Research Technology
of ∩¿
IoU =Area ¿
Area of ∪¿ ¿
(6)
Figure 24: Intersection over Union
www.ijisrt.com
International Journal of Innovative Science and Research Technology
Figure 27: Area Chart Week 1 - Count of Vehicles w.r.t. time Figure 29: Parking Slot Utilization Frequency Considering 14 Days
Dataset
The above choropleth map represents the utilization of
pre-defined parking slots by different vehicles over 14 days.
The range interval is set to 20 minutes. The color map
shows the rate of parking space utilization for each parking
space.
www.ijisrt.com
International Journal of Innovative Science and Research Technology
Future Prospect
Figure 31: Week 2 Average Occupancy of Parking Spaces Since the approach mentioned in this work is in its
initial stages toward the final goal, many advancements can
be made. Some of which are discussed subsequently.
Insights: The above choropleth maps represent the average The network architectures employed in this project
occupancy duration for each of the slots per day by using consist of classic object detection algorithms, i.e., Mask
the color map. The yellow color shows the least value, RCNN and YOLOv5. There are some other nascent object
which progressed towards blue color representing the detection algorithms that are much more time-efficient and
maximum value. cost-effective.
A camera is a device that records visual data, usually in
i. In the first week, slot number 17 and 19 are the the form of images or videos, and is frequently employed
least occupied as compared to other parking for tasks like object detection and classification. Contrarily,
spaces. a multimodal system incorporates various types of sensors
ii. In the next week, slot number 17, 18 and 19 are or information sources, such as cameras, 'Light detection
least occupied as they are at the end of the parking and ranging' (LiDAR), radar, or other sensors, to increase
lot. the system's accuracy and robustness.
iii. Due to maintenance work at slot number 13, its Video observation using an object tracking algorithm
total parking duration is also less in both weeks. may help to obtain individual vehicle trajectories as well as
iv. On average, those parking spaces are more the transition of the parking lot occupancy. This data might
occupied, which are nearer to the connecting road be useful to get information related to considering the
or to the building. factors that are important to select to analyze the parking
behavior of the patrons in the parking lot.
Significance of the Work
This research venture fulfils its objective to develop a ACKNOWLEDGMENT
functional system that could take the input data captured I want to thank my friends Prashant, Kiran, Diksha, Govind,
from a camera in the form of videos and images (frames) Ibaad and Unnat for their help in various parts of my
and process them to predict the occupied and unoccupied research and for making my stay on the campus memorable.
parking spaces within the parking lot. Until this section, the I would especially want to thank Prashant for helping me to
work on this project has met the requirement by utilizing get introduced to all the initial details of the thesis
object detection algorithms and OpenCV. The approach objectives and possible outcomes and methods and Diksha
proposed in this work takes the input as an image or video, for the support and help during the time of articulation, and
uses the Yolo Annotator Tool to locate the parking spaces, for providing useful corrections. Also, I would like to thank
and passes it through an object detection algorithm to get my seniors Sujata, Avadh, Rupesh, and Milaa ma'am for
the parking occupancy status. QGIS software is also used to their support and time. I cannot describe in words the
create the shapefile of the parking spaces and merge it with motivation, fun, and encouragement I have received from
the CSV data generated from the processed frames or videos these people.
to get insights from the parking data. This kind of system
forms an end-to-end architecture for real-world and real-
time applications. Additionally, it establishes a baseline V. REFERENCES
against which future technologies can be evaluated.
www.ijisrt.com
International Journal of Innovative Science and Research Technology
www.ijisrt.com
International Journal of Innovative Science and Research Technology
www.ijisrt.com