=Paper= {{Paper |id=Vol-3237/paper-pet |storemode=property |title=Comparison of Visual Occupancy Detection Approaches for Parking Lots and Dedicated Containerized REST-API Server Application |pdfUrl=https://ceur-ws.org/Vol-3237/paper-pet.pdf |volume=Vol-3237 |authors=Andrej Petričko,Pavle Dakić,Valentino Vranić |dblpUrl=https://dblp.org/rec/conf/sqamia/PetrickoDV22 }} ==Comparison of Visual Occupancy Detection Approaches for Parking Lots and Dedicated Containerized REST-API Server Application== https://ceur-ws.org/Vol-3237/paper-pet.pdf
Comparison of Visual Occupancy Detection
Approaches for Parking Lots and Dedicated
Containerized REST-API Server Application
Andrej Petričko1,† , Pavle Dakić1,*,† and Valentino Vranić1
1
 Institute of Informatics, Information Systems and Software Engineering, Faculty of Informatics and Information
Technologies, Slovak University of Technology in Bratislava, Slovakia


                                         Abstract
                                         With the development of new technology, the urban infrastructure, which is necessary to meet the
                                         social, economic, and physical needs of the population, is also gradually improving. Therefore, cities
                                         face significant urban planning challenges. With the increasing population and number of cars on
                                         the road parking space occupancy detection techniques are of great importance for efficient parking
                                         space management. Knowing the availability of parking spaces within a city in real-time and informing
                                         residents can be of great help in reducing the number of car park councils, reducing traffic congestion in
                                         cities, or improving the scalability of car parks and the time needed to find empty parking space. In many
                                         car parks, ground sensors are used to determine occupancy status. However, this requires the installation
                                         and maintenance of these sensors in every parking space. This can be expensive, especially in car parks
                                         with a large number of available spaces. With increasing computing power, new approaches to parking
                                         space occupancy detection using computer vision are emerging. However, these approaches are tailored
                                         to the site of application. In this work, we propose a comparison of two general approaches: classification
                                         and object detection. The reliability, precision, and scalability of these approaches are compared using
                                         a REST-API server application implemented in Python. In order to get as close as possible to general
                                         use, we use docker, which enables us easier develop and deploy this application independently of the
                                         hardware.

                                         Keywords
                                         Parking occupancy detection, Computer Vision, Docker, CI/CD, REST-API, Object Detection, Classifica-
                                         tion




1. Introduction
Parking in cities can sometimes be difficult or even impossible due to the increasing number of
cars. The number of cars on the road is increasing more and more with every year. Some parking
lots are full and others are almost empty. This ineffective management and not informing the
public of parking lot occupancy information often leads to traffic problems such as congestion.
People often struggle to find empty space and spent a lot of time driving around. The solution

SQAMIA 2022: Workshop on Software Quality, Analysis, Monitoring, Improvement, and Applications, September 11–14,
2022, Novi Sad, Serbia
*
  Corresponding author.
†
  These authors contributed equally.
" xpetricko@stuba.sk (A. Petričko); pavle.dakic@stuba.sk (P. Dakić); vranic@stuba.sk (V. Vranić)
 0000-0002-4096-2541 (A. Petričko); 0000-0003-3538-6284 (P. Dakić); 0000-0001-9044-4593 (V. Vranić)
                                       © 2022 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0).
    CEUR
    Workshop
    Proceedings
                  http://ceur-ws.org
                  ISSN 1613-0073
                                       CEUR Workshop Proceedings (CEUR-WS.org)




                                                                                                        13:1
could be provided by smart parking lots, that could be able to inform in real-time about their
occupancy status. There are many parking lots, with occupancy detection using sensors [1, 2],
which is not a resource-effective solution. Advances in computer technology, which have
brought computer vision, allow us to find more efficient and versatile solutions using cameras [3,
4, 5].


2. Methods for occupancy detection
For parking lot occupancy detection are existing several methods. One group can be described
as detection with the use of some sensors and a second group that is using machine learning
and computer vision.

2.1. Sensor occupancy detection
Nowadays the most used approach to detecting the occupancy of parking spaces is by using
sensors. This approach relies on the use of different types of sensors, which are located above
or directly in each parking space.
   The occupancy detection approach using sensor-based parking spaces is very accurate and
reliable, but a major disadvantage of these solutions is the cost required to build such a solution,
as each parking space needs its own sensor to detect occupancy. Although there are solutions
where a single tracking device can be used for multiple parking spaces [2] in large parking
areas, a large number of these tracking devices are still required. Along with the construction
costs, the costs of later maintenance must also be taken into account [6]. Furthermore, such
solutions are at the same time, due to external environmental influences, mostly installed in
interior parking lots. It is therefore not feasible to install hundreds of sensors in outdoor parking
areas or streets.

2.2. Computer vision occupancy detection
Advances in deep learning have revolutionized machine learning by delivering unmatched
performance and methods for automatically extracting properties from images without the need
for human intervention. This allows the computer to quickly process video input to classify it
or learn to find objects [7].
   The use of computer vision methods in the field of intelligent car parks makes it possible
to create less costly solutions with the help of several cameras and computing equipment,
and at the same time, they allow you to view the current situation in the car park from these
cameras [7, 3]. This approach can also be used in places where camera systems are already
installed.

Segmentation and classification
In segmentation and classification, the processed image is first divided into smaller images called
patches based on the segmentation mask. The segmentation mask contains the coordinates of




                                                13:2
Figure 1: Segmentation mask (left) and patches (right). Source: 1 .




Figure 2: Parking object detection using Object Detection.Source: 2 .


the individual parking spaces. An illustration of a segmentation mask and patches can be seen
in the figure 1.
   After segmentation, each patch is processed using the selected machine learning algorithm
and classified into specific classes, e.g. occupied or free.

2.3. Object detection
Object detection allows us to identify and locate objects in an image. With this approach whole
image is processed by an object detection neural network. The output of this neural network is
a list of bounding boxes with corresponding labels of objects that were found in the image.




1
    http://cnrpark.it
2
    https://www.pixevia.com/smart-parking-occupancy




                                                      13:3
Figure 3: Architecture scheme of solution using sensors. Source: [2].


3. Related Works
The topic of smart parking spaces and occupancy detection is due to the growing number of
vehicles in traffic is still a lively topic and therefore there is already more research dealing with
different approaches to addressing this issue.

3.1. Occupancy detection papers using sensors
Since this method is widely used there are many studies that develop and investigate parking
occupancy detection solutions using sensors [8, 2].
   The architecture of these solutions consists of the use of several different devices. Peripheral
devices consisting of an Arduino UNO microcontroller, which had two infrared proximity
sensors and two ultrasonic sensors, were placed in the parking spaces themselves. The Arduino
UNO has very low energy consumption, so it was possible to power them from a battery. These
peripherals were tasked with collecting data from the sensors and sending them to central
devices using Bluetooth Low Energy. In this solution, the peripheral device was able to monitor
up to 8 parking spaces. The central devices were Raspberry Pi microcomputers, which stored
sensor data in an SQLite3 database running on them. These devices then sent the collected data
to the back-end using an Internet connection. This architecture can be seen in the following
figure 3.




                                                13:4
Figure 4: Solution architecture scheme using interspace correlation. Source: [9].


  Peripheral data had to be collected periodically to reduce energy consumption. Therefore, it
was necessary to implement communication between the peripheral devices and the central
device at certain intervals. The central device then communicated with the server on the
backend using the Rest API protocol.

3.2. Parking space occupancy detection using computer vision and interspace
     correlation
This technique [9] proposes a method of detecting parked vehicles in space based on the input
video recorded by the camera. The empty spaces can be distinguished from the occupied ones
by means of an 8-class SVM classifier, based on the method of Support Vector machine, with
probabilistic outputs. The interspace relationship and the SVM classifier outputs associated
with the Markov Random Field (MRF) framework are also taken into account. The result is
much better detection performance, even if there are significant effects of occlusion and shading
on the stage.
   This system consists of four parts: data preprocessing, low-level feature extraction, multi-class
SVM recognition, and MRF-based correction. The input image is first pre-processed and divided
into small samples, each of which contains 3 parking spaces. The Gaussian model is then used
to obtain the probability of the earth occurring in pixels in the samples. These probabilities
are further used as input values for a trained multi-class SVM classifier, which analyzes and
classifies samples into 8 parking condition classes. Finally, Markov’s Random Field (MRF) is
used to resolve conflicts between two neighboring sites in order to improve recognition.




                                                 13:5
Figure 5: System architectur. Source: [5].


3.3. Parking space occupancy detection using video with intelligent control
     system
In this work[5], the automatic regulation of street lighting plays a major role in detecting the
occupancy of the car park in the outdoor environment. The intelligent vehicle tracking or
detection application can also be used to control lighting in the evenings. This study uses a
Jetson TX2 microcomputer to develop a method that can accurately identify the occupancy
of street parking spaces along with street lighting control. The proposed method uses the
YOLO model of the neural network version 3 backup to MobileNet version 2. This solution was
verified using the data file CNRPark + EXT, the simulated model, and real scenes captured by
the camera.
   The input video uses built-in hardware to connect directly to an existing street camera system.
Detection includes high-performance deep learning algorithms that detect pedestrians and
vehicles. Vehicles and parking spaces are delimited from the sequential image using the YOLO
model, and their overlapping areas are then calculated, which are used to identify the occupancy
status. Street lamps are automatically switched to low light or high light levels depending on
the detection results. All this functionality is handled by the Jetson TX2 microcomputer.
   Some proposed methods [10] using YOLO detection use the midpoint of the object boundary
to determine the occupancy of a parking space. If this point is located in the parking space
area, the space is marked as occupied. The model achieved great accuracy, but the midpoint
could lead to an incorrect evaluation of the actual condition of the parking space due to the
perspective of the camera.
   To resolve perspective errors, a YOLO detection method with object overlap identification
has been proposed to improve occupancy detection results.




                                              13:6
Figure 6: Examples of occlusions in processed images.


4. Challenges and problems
Computer vision is a powerful tool for detecting the occupancy of parking areas, but in order
to create a suitable model with reliable detection, we must address the problems that occur in
image processing, which can cause inaccuracies.
   These problems include changing ambient light conditions: different intensities of sunlight
during the day, street lighting, and weather: sunny, rainy, snow, which affect the brightness
and colors of the image. Other problems may be caused by occlusions in the image. Here we
can include, for example, trees, street lights, open parts of the vehicle, a poorly parked vehicle,
or its shadow. The camera itself must also be taken into account, such as its location: height,
angle, or optical properties, which strongly affect the image quality.


5. Prototype
A big problem with many existing solutions is that they are tailored to the environment. In our
work, we try to create a generally applicable tool for detecting the occupancy of parking spaces.
   The goal is to create a REST-API server application that could be located independently
outside a specific parking lot and at the same time would not be tied to only one parking
lot. Parking lots that would like to use occupancy detection services then only send image
information using HTTP requests to a specified server endpoint. This application then processes
the video inputs and sends a response with the detection result. At the same time, it stores
these detection results in a database.
   The detection results can then be used to inform the public or smart cities through another
endpoint or graphical user interface.
   In the application, we want to implement resource usage logging for future comparison of
two occupancy detection methods.




                                               13:7
Figure 7: Basic scheme of proposed server aplication.


5.1. Docker containers
The application is implemented in containers in docker, which allows us to be independent
of hardware and easy development with deployment. The second advantage of dock and
containerization is the ability to scale resources and thus we can analyze how many resources
the application needs [11].
  Docker image we have made consists of 3 separated containers:
    • Python Django Server - This container contains the main part of the server, all functional
      logic, and application occupancy detection logic
    • PostgreSQL - In this container is the database for the server for storing data about
      parking lots and occupancy.
    • Graphana - This container is intended for the implementation of a simple user interface
      for displaying data in a database.

5.2. Used network models for occupancy detection
Within the application, we use two basic approaches to detect occupancy, classification and
object detection
   For classification, we use a model with AlexNet architecture. This model showed excellent
results in the field of classification and computer vision. It was also used for classification on
the set CNRPark [12]. To speed up training, we use a pre-trained network from the beginning,
to which I apply transfer learning. This network has also been adapted to our problem, ie the
classification of two trios, an occupied position or a vacancy.
   To detect objects in the image we use the Faster RCNN detector type with the ResNet50 FPN
network model. It is a network built on the VGG-19 network, with the fact that it is enriched




                                               13:8
with residual connections between the internal blocks.
   A pre-trained network is used, whose inputs and outputs are adapted to our needs. In this
case, the number of inputs is the size of the input image and the number of detected objects is 2.
The vehicles whose bounding boxes are found will be detected and compared with the positions
of parking spaces to determine occupancy.


6. Conclusion
We have approached the problem of parking occupancy detection, which is a big problem
in traffic management in big cities. Our solution, that we propose is a general parking lot
occupancy detection approach using a decentralized rest-API server.
   So far, we have implemented a working docker image with a functional CUDA-capable
container for the Rest server. In the rest-API server, we have implemented all needed parking
lot management models and occupancy detection using segmentation and classification. For
classification, we have implemented endpoints for the training network model and for occupancy
detection.
   After implementing the second occupancy detection method using object detection we plan
to compare those methods with experiments.
   In this server application, we want to compare those two approaches using a set of experiments.
We plan to do qualitative experiments such as accuracy of detection on the same and different
data sets and quantitative experiments to measure time for setting up, time that the application
needs to process one detection, and average application response time. Also, we want to analyze
the resource usage of these approaches so we will compare the amount of GPU and RAM that
is used by the detection process.


Acknowledgments
The work reported here was supported by the Scientific Grant Agency of Slovak Republic
(VEGA) under grant No. VG 1/0759/19 and the Operational Programme Integrated Infrastructure
for the project: Advancing University Capacity and Competence in Research, Development
and Innovation (ACCORD), ITMS code 313021X329, co-funded by the European Regional
Development Fund (ERDF) Grant Number: 313011W988.


References
 [1] T. Perković, P. Šolić, H. Zargariasl, D. Čoko, J. Rodrigues, Smart parking sensors: State
     of the art and performance evaluation, Journal of Cleaner Production 262 (2020) 121181.
     doi:10.1016/j.jclepro.2020.121181.
 [2] K. Marso, D. Macko, A new parking-space detection system using prototyping devices
     and bluetooth low energy communication, International Journal of Engineering and
     Technology Innovation 9 (2019) 108.
 [3] P. Dakić, V. Todorović, V. Vranić, Financial justification for using ci/cd and code analysis
     for software quality improvement in the automotive industry, in: 2022 IEEE Zooming




                                              13:9
     Innovation in Consumer Technologies Conference (ZINC), 2022, pp. 149–154. doi:10.
     1109/ZINC55034.2022.9840702.
 [4] G. Amato, F. Carrara, F. Falchi, C. Gennaro, C. Vairo, Car parking occupancy detection
     using smart camera networks and deep learning, in: 2016 IEEE Symposium on Computers
     and Communication (ISCC), IEEE, 2016, pp. 1212–1217.
 [5] L.-C. Chen, R.-K. Sheu, W.-Y. Peng, J.-H. Wu, C.-H. Tseng, Video-based parking occupancy
     detection for smart control system, Applied Sciences 10 (2020) 1079.
 [6] P. Dakić, L. Filipović, M. Starčević, and, Application of fundamental analysis in investment
     decision making: example of a domestic business entity, in: ITEMA 2019, Association of
     Economists and Managers of the Balkans - Udekom Balkan, 2019. doi:10.31410/itema.
     s.p.2019.149.
 [7] M. Kročka, P. Dakić, V. Vranić, Extending parking occupancy detection model for night
     lighting and snowy weather conditions, in: 2022 IEEE Zooming Innovation in Consumer
     Technologies Conference (ZINC), 2022, pp. 203–208. doi:10.1109/ZINC55034.2022.
     9840556.
 [8] T. Perković, P. Šolić, H. Zargariasl, D. Čoko, J. J. Rodrigues, Smart parking sensors: state
     of the art and performance evaluation, Journal of Cleaner Production 262 (2020) 121181.
 [9] Q. Wu, C. Huang, S.-y. Wang, W.-c. Chiu, T. Chen, Robust parking space detection
     considering inter-space correlation, in: 2007 IEEE International Conference on Multimedia
     and Expo, IEEE, 2007, pp. 659–662.
[10] D. Acharya, W. Yan, K. Khoshelham, Real-time image-based parking occupancy detection
     using deep learning., in: Research@ Locate, 2018, pp. 33–40.
[11] I. C. Education, Docker, 2022. URL: https://www.ibm.com/cloud/learn/docker.
[12] G. Amato, F. Carrara, F. Falchi, C. Gennaro, C. Meghini, C. Vairo, Deep learning for
     decentralized parking lot occupancy detection, Expert Systems with Applications 72 (2017)
     327–334.




                                             13:10