# Video-Based Parking Occupancy Detection for Smart Control System
## 3 Experimental Results
### Network  
To illustrate the effectiveness of the proposed algorithm, from the CNRPark + EXT dataset divided into two sets, we randomly selected approximately 205 images as our training set, which contained three dates and weather conditions for nine cameras. For the testing set, the image annotation tool Labellmg was used to label six types of classes, and the obtained images were used as the ground truth for testing. Figure 14: Images of the automatic streetlight control system, which switched from dim night settings to a high state during object detection. In the daytime simulation, the LEDs were not illuminated. (**a**) In the nighttime representation, the dim LEDs were illuminated. (**b**) When an object was detected by the detection model form camera, the first set of high LEDs was illuminated, whereas the rest remained in the dim mode. (**c**) Only the second set of LEDs glowed at the high setting, and (**d**) the rest remained in a dim state. Figure 15: Streetlight control with the Jetson TX2. A sequence of images showed (**a**) the red car driving into the parking grid. (**b**) The model began to determine whether the red car occupied the space. (**c,d**) The voting mechanism verified that the red and blue cars stopped at parking grids. In this study, we compared our method with other current object detection algorithms including Mask R-CNN, sliding window, and CNN. Tables 1 and 2 present the accuracy and the mean occupancy error (MOE) [25] among the networks. The sliding window and CNN used the window sliding method to scan whole images to obtain parking space occupancy status. Although this method achieved high accuracy on the dataset, detection with the sliding window was slow. Mask R-CNN adopted the risk priority number method to obtain the candidate bounding boxes, and both accuracy and detection speed improved significantly. However, the requirements for real-time detection were still not met. Object detection and localization through YOLO were performed within one step, and high-accuracy real-time processing was achieved. For testing purposes, the test subset of the CNRPark + EXT dataset was used. The accuracy is used to evaluate the performance of the identification task. It is calculated as the number of all correct predictions divided by the total number of the dataset and the best accuracy is 1.0, which is calculated as follows:  
\[\text{Accuracy}=\frac{T_{P}+T_{N}}{T_{P}+T_{N}+F_{N}+F_{P}} \tag{7}\]  
where \(T_{P}\), \(F_{N}\), \(F_{P}\), and \(T_{N}\) represent the number of true positives, false negatives, false positives, and true negatives, respectively. Following other counting benchmarks, we used MOE, where \(N\) is the total number of test images, \(C^{gt}\) is the actual count, \(C^{pred}\) is the predicted count of the \(n\)-th image, and \(num\_slots_{n}\) is the total number of parking lots in the current scene. This evaluation metric is expressed as a percentage, defined as follows:  
\[\text{MOE}=\frac{1}{N}\sum_{n=1}^{N}\frac{\left|C_{n}^{gt}-C_{n}^{pred}\right| }{num\_slots_{n}} \tag{8}\]  
The purpose of our method was to identify occupancy status on parking grids, and therefore, high accuracy of bounding boxes fitting objects is crucial for calculations of the area. The precision and recall value of YOLO v3 on the CNRPark + EXT dataset was 99.81% and 98.64%, respectively, and the average processing time of each image was 41 ms on the Jetson TX2. For the Jetson TX2, we used MobileNet v2 to reduce parameters and release CPU memory. Table 3 depicts the compared frames per second (FPS). The number of parameters in Darknet-53 was 14 times that of MobileNet v2. In theory, the parameters are simplified 14 times, and the speed significantly improves. However, Table 3 reveals that this only resulted in an upgrade from 2.3 to 1.8 FPS on the Jetson TX2, which only increased the speed by 1.3 times, because the implementation of the depthwise convolutional algorithm had not been well optimized on MobileNet.