# Video-Based Parking Occupancy Detection for Smart Control System
## 2 Materials and Methods
### Detection Model  
#### 2.2.1 Yolo  
Traditional object detection uses a sliding window to detect whether the subwindow has detected a target. However, methods that rely on classifiers and sliding windows to detecting targets may require long-term training and produce too many bounding boxes. The purpose of a single-shot object recognition algorithm such as YOLO is to achieve immediate recognition without sacrificing accuracy. These algorithms are able to handle complex tasks, such as pedestrian, license-plate, vehicle, and traffic-sign detection [36; 37; 38; 39; 40; 41]. YOLO is an end-to-end object detection network. Unlike R-CNNs [42], the proposed technique does not rely on regional proposals. Instead, it detects objects by using CNN and cuts the original image into an \(S\times S\) nonrepetitive network. A grid image in which \(S\) varies according to image size and various anchor boxes is generated in each grid, and the neuron learns the offset of anchor boxes from the bounding boxes of actual objects. This method can detect bounding boxes and categories of multiple objects within images without region proposals or resorting to simplistic regression of entire images to bounding boxes. \[\text{IOU}=\frac{\textit{DectionResult}\ \cap\ \textit{GroundTruth}}{ \textit{DectionResult}\ \cup\ \textit{GroundTruth}} \tag{1}\]  
YOLO cuts the original image into \(S\times S\) nonrepetitive grid images, where \(S\) is the number of grids determined by users. The neural network uses anchor boxes to estimate the center of vehicles in a grid that is responsible for predicting vehicles. In each grid, the bounding box is estimated to generate four coordinates: \(t_{x},t_{y},t_{w}\), and \(t_{h}\); \(t_{x}\) and \(t_{y}\) represent the central coordinates of the predicted bounding boxes. \(t_{w}\) and \(t_{h}\) represent the width and height of the predicted bounding boxes, respectively. Figure 6: Streetlight model. YOLO's actual operation is as follows: For each grid, the model predicts five variables, i.e., \(t_{x},t_{y},t_{w},t_{h}\), and \(t_{o}\), and \(t_{x}\) and \(t_{y}\) for ground truth and anchor center point offsets \(t_{w}\) and \(t_{h}\) for length and width, respectively, to represent object confidence. As displayed in Figure 7, \(t_{x},t_{y},t_{w},t_{h}\), and \(t_{o}\), and \(t_{x}\) and \(t_{y}\) for ground truth and anchor center point offsets \(t_{w}\) and \(t_{h}\) for length and width, respectively, to represent object confidence. As displayed in Figure 7, \(b_{x}\), \(b_{y}\), \(b_{w}\), and \(b_{n}\) are the actual bounding box of the objects. When cells deviate from the upper left of insulator images by \((c_{x},c_{y})\) then \(p_{w}\) and \(p_{h}\) are the length and width of the anchors, respectively. The bounding box prediction standard is intersection over union (IOU), which is used to measure the accuracy of object detectors on datasets. The optimal situation is IOU = 1, signifying that a predicted bounding box completely coincides with the bounding box of a real insulator. The characteristics of the overlapping area are used in bounding boxes, which fits real objects to calculate the area. To enhance the detection accuracy of small objects, YOLO v3 uses a Feature Pyramid Network [43] upsampling and fusion approach for object detection, signifying top-down architecture with lateral connections developed for building high-level semantic feature maps on all scales. YOLO is based on Darknet-53 [28], adopts full convolution, and takes advantage of the residual structure of the residual neural network (ResNet) [44] to enable model fitting on the embedded device and lighter and accurate detection with YOLO. Darknet-53 is trained on ImageNet for 1000 object types [45]. In deep learning, the general trend is to increase network depth and computation complexity to increase the network performance. However, several real-time applications, such as self-driving cars, augmented reality, and real-time object recognition, require faster networks.