# Two-Stage Efficient Parking Space Detection Method Based on Deep Learning and Computer Vision
## 2 Research Content
### Key Point Detection  
In order to accurately identify key points, we need to train a key point detector D first. Through the literature review, we find that YoloV11 [40,41] is the most advanced universal target detector based on DCNN at the moment. It can achieve quite high detection accuracy, and the operation speed is also very fast. Based on the comprehensive consideration of accuracy and speed, our key point detector is based on YoloV11.  
Figure 2: (**a**) The original image; (**b**) image generated by rotating it 60 degrees and increasing the brightness to 1.5 times that of the original image. (**c**) training image.  
In order to train the detector, we need to prepare training samples. Fortunately, the ps2.0 dataset training set is a large data set specifically designed for detecting key points of parking spaces, and the training set includes 2290 training images in five categories: indoor parking lot, outdoor normal daylight, outdoor rainy, outdoor shadow, and outdoor street light. It basically includes various scenes that can be encountered in reality, and for each mark point \(P_{i}\), a \(p\times p\) box is selected as the true boundary box of mark point \(P_{i}\), with \(P_{i}\) as the center. The target box used by YoloV11 is 56 pixels long and 56 pixels wide.  
We want the classifier to be able to recognize the key points of any rotation angle in any time period. In order to achieve this goal, we can rotate each training image by \(j\) degree each time and change the brightness of the image to \(\lambda_{i}\) times that of the original image; \(i=1,2,3\ldots n\). In particular, key points of parking spaces with different brightness levels and rotation angles are addressed by applying rotation and brightness transformations to the original data. These enhancements not only expand the dataset for training but also ensure robustness against overfitting. The available data after data enhancement are \(\frac{n\pi}{j}\) times the size of the original data. Figure 2a shows the original image, while Figure 2b shows the image rotated by 30 degrees and with brightness reduced to 50% of the original image. The key points are shown in black, and the regions where the key points are located are highlighted in red.  
When training the key point detector, the label data we input add a class of labels to the original ps2.0 data set. The key point detector will also look for the anchor frame of the vehicle while looking for the key point anchor frame of the parking space. The purpose of this is to remove the parking space of the existing vehicle in the subsequent parking space inference. Figure 2c is the training image. Label data category 0 represents the key point of the parking space, label data 1 represents the vehicle, and the target anchor frame of each category is stored with four data points, which, respectively, represent the target center position, the target width, and the target height.  
Based on the key point detector D of YoloV11, the corresponding training parameters are set as follows: the angle \(j\) of each rotation of the original image is set to 20 degrees; the variation range of image brightness is \(\lambda_{i}\)e[0.2, 1.8]; the batch size is set to 64; the learning rate starts from 0.0001; and the learning rate is divided by 10 for every 50,000 training times.  
Figure 3: Flow chart.