An Intelligent Smart Parking System Using Convolutional Neural Network

literature.


Introduction
There are many definitions for a smart city.A simple definition is that a smart city incorporates numerous technologies to provide a better life for citizens and improve the quality of services that are provided by the government [1,2].One of the goals of a smart city is to optimize all available resources for better civic life.It has been argued that simply providing more technologies creates a smart city, but the real value of a smart city lies in how these technologies are used [2][3][4].The readiness of infrastructures, environmental initiatives, and the ability of people to be able to thrive are crucial characteristics of a smart city [4].Figure 1 illustrates the various attributes of a real smart city [5].
In Saudi Arabia, the government has started to build smart cities such as The Line City in Neom to achieve numerous goals.The main objectives of these projects are as follows: (1) Transform traditional municipal services into smart ones to provide high-level services for citizens (2) Improve the growth of the economy by attracting global investors in the country (3) Provide long-term sustainability for the environment (4) Enhance safety and security for the citizens In accordance with Vision 2030, a strategic framework developed by the government in Saudi Arabia to diversify its economy and develop many public service sectors, numerous smart city initiatives have been announced by the Saudi government.These initiatives, including the development of waste management and smart parking systems, can be extremely beneficial in reaching the aforementioned objectives.The government seeks reliable solutions for the complex issues and challenges associated with the development and execution of its plan.
Transportation management has become a particularly important issue in the present.The number of automobiles in Saudi Arabia has increased rapidly in recent years, which has raised concerns about fuel emission.The issue requires urgent solutions that provide environmental sustainability and reduce the impact of climate change.Searching for parking spaces leads to unnecessary fuel consumption, which harms the environment.The wasted time spent parking can also cause frustration for drivers, especially in big and busy cities such as Riyadh and Jeddah.Cities need feasible and reliable smart parking systems.Several solutions for smart parking have been developed to utilize available parking spaces in a city more effectively [6][7][8][9].These systems are aimed at providing cost-effective solutions that will significantly reduce and minimize human labor [6].
This article contributes to the problem by developing and presenting a novel approach for a smart car parking system that can be efficiently managed.This method is very cost-effective since there is no need to install sensors; it just requires one camera to provide real-time information about the parking area, either in images or video streams.These images or video streams are processed to identify the total number of vehicles in the parking area and to verify whether there are vacant spaces.Then, instructions are provided to drivers about the vacant spaces and where to park their vehicles.The proposed system employs a convolutional neural network tool called Alex-Net.The AlexNet tool consists of eight layers: five convolutional layers and three fully connected layers.These are depicted in Figure 2 [10].Details about the proposed approach are provided in Section 3.
The remainder of this article is organized as follows: Section 2 presents the related work, and Section 3 provides details about the presented algorithm.Discussion and results are presented in Section 4, while Section 5 provides the conclusion.

Related Work
Biyik et al. [1] analyzed several proposed smart parking algorithms from a technical point of view, emphasizing their sensors and systems.Their objective was to deliver a comprehensive study of these methods.The authors claimed that the Internet of Things (IoT) technologies shall be used and given more attention in implementing smart car parking systems.Also, sensors are used as a major player in collecting information for the smart parking system.Interested readers can refer to [1] for more information.
In [2], Patil et al. proposed a method for detecting vacant spaces in parking areas and managing automobiles that entered and left those areas.IR sensors were utilized to detect vehicles that moved in or moved out.A simple circuit was implemented to detect empty parking spaces and direct drivers to those spaces.However, this system was not costeffective since every vehicle needed to have an IR sensor installed on it.In addition, human labor was still needed to operate and manage the system.In their proposal, a microcontroller, Arduino Uno R3, was used to connect all IR sensors together to process the collected data.A Wi-Fi module of MCU ESP 8266 was utilized to provide Internet service.The authors claimed that their model was an IoTbased approach since Internet service was employed and utilized.The proposed method herein is more cost-effective since it utilizes only a single camera, and there is no need for human labor as all operations are fully automated.In addition, Internet service is not required as all operations are handled automatically through a machine that runs the proposed system.Both systems, the proposed one herein 2 Journal of Sensors and the implemented one in [2], provide the same functions; however, the presented system in this article is more costeffective and easier to maintain.Readers can refer to [2] for more information about the developed method.Bassam and Samann [3] proposed a smart parking system using an optical character recognition (OCR) method.This system was implemented in three stages which included (1) detecting a vacant parking space based on OCR, (2) notifying drivers using an IoT mechanism, and (3) utilizing Simple Mail Transfer Protocol (SMTP) for smart parking meters.Every parking space was assigned a character, and vacant spaces were detected by a camera that was installed above the parking area.A morphology filter was introduced to improve the system's performance by removing unwanted objects, whether big or small.Eight different images were used to test the accuracy of the proposed method, and it was found to be more than 90% accurate.However, this approach required every parking space to be labeled with a specific character, and it is costly as well.The presented algorithm in this article is fully automated and requires no labor to operate it at all.It similarly utilizes a Wiener filter to enhance the processing operation.Furthermore, the proposed approach determines how many vehicles are parked and how many vacant spaces exist with over 97% accuracy, according to the conducted simulation tests.Readers can refer to [3] for additional information.
Nadipalli et al. [4] also presented an approach for a smart car parking system that employed IoT technology.The method involved using IR sensors to detect vehicles and available spaces.A microcontroller and a Wi-Fi modem were also utilized to carry out this approach.A cloud-based server updated the received sensor data and checked for vacant spaces online.This method updated its information every 10 seconds through the cloud-based server.This approach provided no real-time information since there was a delay of 10 seconds.When the microcontroller went down or there was no Wi-Fi, this method became completely useless [4].On the other hand, the presented algorithm in this article relies on a single machine that can run a whole parking area.It can be used anywhere under any type of circumstance unless there is a power outage.In addition, it provides real-time data through captured images or video streams.
In [5], Subramanian and Subashini proposed a ticketbased smart car parking method utilizing IoT technologies and a mobile application.Sensors were installed in parking areas to provide real-time information about vacant parking spaces.An SMS service was utilized to send notifications to drivers to inform them about vacant space allocations, directions, and billing rates.These sensors were installed in every parking lane to collect data.The system utilized an antenna and Internet service to operate and function properly.Hence, it would not work if no Internet was detected.Moreover, it was costly since multiple sensors were required to collect data.In this article, the presented algorithm requires no Internet service to operate as the camera is connected directly to the machine that holds the system.In addition, instructions for vacant spaces are provided as well.This system reaches over 97% of accuracy as proved by the applied simulation tests.
Mohammadi et al. [6] implemented another method for securing a parking lot system using MATLAB and an image 3 Journal of Sensors hashing technique.It contained two stages, one for scanning the parking area and another for securing data.The method showed the status of the parking area to drivers and motorists before entering and provided directions to available parking spaces.The hashing method was utilized to secure the system itself.A Raspberry Pi microcontroller was utilized to detect vehicles.An SD card and a board module were also employed to increase the rate of reliability of the implemented method.The authors utilized a 32byte hashing key for authenticating purposes.In addition, no sensors were used to reduce the cost.The authors performed only two scenarios while four scenarios were conducted using the proposed system in this article.Readers can refer to [6] for more information.
Sharma and Singh [11] implemented a fuzzy-based method for energy-aware WSN-based framework for smart parking systems.This design increased the network stability period by nearly 91.75% when compared with a low-energy adaptive clustering hierarchy (LEACH) protocol.In addition, it gained around 39% enhancement compared to the quantum ABC protocol.Readers can refer to [11] for additional information.
Alharbi et al. in [12] highlighted the influence of parking vehicles on some streets and vital places in cities during traffic jams.In addition, they provided an automatic prereservation process for vacant parking spaces.This approach utilized an optical character recognition (OCR) algorithm to detect plate numbers and offered a web application.The authors applied their method in some streets in Saudi Arabia to reduce congestion.Interested readers can refer to [12] for additional information.
Beed et al. in [13] presented a hierarchical Bayesian model to solve the multiobjective route optimization problem.This model worked with multinomial distribution and Dirichlet's distribution prior to refining the weights in order to resolve the considered issue.
Tabassum in [14] discussed a strategy to integrate the public transportation facilities provided by Riyadh metro with an element of smart city to form a Riyadh smart city (RSO) application.This integration process relied on a location-based service where a passenger was delivered.In addition, a web application was utilized to provide needed information to the passengers within their point of access.Readers can refer to [14] for additional information.

The Proposed Algorithm
In this section, details of the presented approach are provided.Figure 3 illustrates the approach in a flowchart.
Figure 4 depicts a general parking lot map structure.The parking lot accommodates 10 vehicles in every lane; so in total, there are 60 vehicles.
The proposed system starts by taking data from the installed camera which provides real-time information.These images or video streams are fed into the algorithm, which starts the processing.If no vacant spaces are available, the system displays a message saying that the parking lot is fully occupied, and drivers must search for alternatives.The gate at the entrance remains closed.If there are empty spaces, the system opens the gate and provides directions to vacant spots where drivers may park their vehicles.The system additionally displays the total number of vehicles currently parked and the number of vacant spaces.The proposed algorithm is demonstrated as follows: The advantages that can be obtained from the presented system are as follows: (i) Very cost-effective (ii) Environmentally friendly since it decreases fuel consumption, power, and energy dissipated (iii) Easy to maintain and operate (iv) It can be integrated with other systems easily (v) Additional features such as checking the parking area ahead of arrival, booking a vacant space, and adding billing components can be added with minor changes in the system design The proposed system requires fewer operations to run and manage its features; thus, its execution time is less when compared to other methods in the literature.Furthermore, it is cost-effective as it utilizes only a single camera that sends its data in real-time to the connected machine.This system is intelligent since it employs the convolutional neural network tool to train itself and adapt to any type of conditions and circumstances that may exist such as a traffic accident or car failure inside the parking lot or a vehicle that parks in the driveway which could lead to a deadlock.Once an abnormal activity inside the parking area is detected, then the considered team such as the administration team is alerted and notified to take proper action.Since the implemented system depends and relies on a single camera, thus its fault tolerance can be considered low.This drawback is resolved by having a backup camera that comes up immediately once the system detects no inputs from the main camera for a long time.An alternative way is to rely on a human intervention to take control manually if the installed camera goes down for any reason.

Results and Discussion
Numerous simulation experiments were carried out in MATLAB to verify the workflow of the developed algorithm and test its accuracy and efficiency.These experiments were conducted on a machine that runs Windows 11.The machine was an 8th-generation Intel Ship with a 2 GHz processor and 16 GB of RAM.Two figures were drawn using a software that is compatible with Windows 11.In these two figures, vehicles are represented as X during the simulation runs, where X can refer to a vehicle of any size or a motorcycle.Four different scenarios are presented in this article to demonstrate the effectiveness of the proposed approach.Scenario 1 represents a full parking lot in which there is no vacant space while Scenario 2 demonstrates a scenario where there are vacant spaces in one of the lanes and a driver is directed there.In addition, two real parking lots with vehicles were downloaded from Google [15] and utilized to validate       6 Journal of Sensors reaching its maximum capacity.The proposed algorithm a new vehicle and provides outputs as depicted in Figures 6 and 7.
The developed approach shows the nearest available lane that has vacant spaces (lane 6) and displays the total number of parked vehicles in it as well.Figure 5 shows three subgraphs while Figure 6 shows four subgraphs.This occurred since there was no vacant lane in Scenario 1 to display while Figure 6 displays that there are vacant spaces in lane 6, and this lane is shown in the subgraphs as well.Hence, the developed approach detected the lane and displayed it with its current parked vehicles.

Scenario 4.
In this scenario, the parking lot includes dedicated parking spaces for trucks in lane 5 and lane 6.This is depicted in Figure 11.The parking lot contains 82 spaces in total: 10 spaces for trucks and the rest for other vehicles, as shown on the left side of Figure 11.The figure also shows that the parking lot has 28 vacant spaces for regular vehicles and 6 vacant spaces for trucks.Hence, there are 34 vacant spaces in total.Note that regular vehicles are considered in this scenario, but trucks can be considered as well.
Figure 12 shows the output images of Scenario 4 as obtained from the implemented algorithm in this article.Figure 13 depicts the numerical results.
Figure 13 demonstrates that the proposed approach searches every lane to find vacant spaces and it starts from lane 1 to lane 4. Lane 1 has vacant spaces, and they are detected by the implemented algorithm.
Since the proposed algorithm in this article only requires one camera to operate and its outputs, it is incredicost-effective.Other developed works in the literature reviewed above use IoT sensors, a far more expensive technology, to detect vacant spaces.In contrast, because CAMs are so inexpensive, the method that is being provided here costs practically nothing.A camera with a high-quality lens costs less than $20 in Saudi Arabia.In addition, the effective-ness of the alternative methods relies on Internet or Wi-Fi services which is a disadvantage.The operations would suffer if any of these services were to go down for any reason, and they might even become temporarily unavailable.On the other hand, because the CAM is directly connected to the operating system, the proposed algorithm in this work does not require Internet or Wi-Fi access to function.This guarantees that there will not be any service interruptions   9 Journal of Sensors unless an operating computer experiences an unforeseen problem.Even this situation, the proposed approach is still more practical the methods that have been discussed in the literature.In terms of the methodology used, utilized equipment, accuracy, and cost, Table 1 compares the proposed system in this paper with relevant works from the literature.

Conclusion
The presented approach in this article is highly useful for traffic management in smart cities, as illustrated by the previous scenarios.It is easy to operate and maintain and can be utilized anywhere.In addition to the parking services, a billing system can be easily integrated into the technology to determine a rate and charge drivers for access to the parking lot.The integration of a driver notification system is also possible with minor adjustments.MATLAB is used to validate the proposed method, and its results show that the novel method proposed here performs as intended and produces accepted outputs.

Figure 1 :
Figure 1: Concept of the real smart city.
of parked cars and the number of vacant spaces Increase the number of parked cars and decrease the number of vacant slots Give directions for vacant spaces in a determined lane Find which lanes have vacant spaces Display a message says all parking spaces are occupied

Figure 3 :
Figure 3: Flowchart of the presented approach.

4. 1 .
Scenario 1.Figure 5 illustrates Scenario 1 in which the parking lot is full, and drivers should search for another one.This parking lot accommodates 60 vehicles in 6 lanes as shown in Figure 5.The system shows a message to drivers to inform them about the status of the parking lot and keeps the gate closed.

4. 2 . 1 .
Scenario 2. The parking lot is already occupied with 53 vehicles, and it can accommodate 7 vehicles before Input: Real-time images.Output: Number of parked cars, number of vacant spaces, and directions to these spaces.Scan the parking lot every time a vehicle enters or leaves.2. If no vacant spaces are available, then 3. Display a message to inform drivers and keep gate closed.4. Else 5. Open the gate.6. Remove noise from captured image.7. Transform the resultant image into a gray image.8. Determine the dimensions of the parking area.9. End of preprocessing phase.10.Assign a number of vacant spaces to a threshold variable.11.Subtract captured image of current parking area from the parking map structure.12. Apply AlexNet for deep learning objective.13.For i =1: length of parking area 14.For j =1: width of parking area 15.Do the following: 16.Find resultant image from subtraction process and compare it with the threshold.17.If result > threshold, then: 18. Place 1 in the current index, 19.Else 20.Place 0. 21.End 22. End 23.End 24.Check which lanes have vacant spaces to direct drivers to the nearest one.25.Display instructions for drivers or motorists to park their vehicles in the detected lane.26.End of algorithm.Algorithm 1: Smart parking and management system.
Figure 8  demonstrates the real parking lot with vehicles on the left side and its corresponding map construction on the right side.This parking lot accommodates a maximum of 53 vehicles, and it currently has 32 vacant spaces.

Figures 9 Figure 6 :
Figures 9 and 10 depict the obtained outputs for Scenario 3.The proposed approach seeks vacant spaces in all lanes and selects one to which drivers are directed.In Scenario 3, lane 1 has vacant spaces.After the driver is directed to that

Figure 7 :Figure 8 :
Figure 7: Complete status of the parking lot.
Current parking area with 82 slotsGeneral view of the real parking lot Lane 1 is available with vacant slot Parking lot map structure

Figure 13 :
Figure 13: The obtained numerical results of Scenario 4.