# Two-Stage Efficient Parking Space Detection Method Based on Deep Learning and Computer Vision
## 2 Research Content
### Local Image Discrimination  
When the key point of the image is obtained, we save the result of each image in a Python list. The structure of the list is expressed as [\"Imgname1.jpg\", num of Bounding box, [Bounding box], \"Imgname2.jpg\", num of Bounding box, [Bounding box]...] The list records the number of key points in each image obtained by the key point detector D, as well as the identification box of the area where the key point is located. The center point of each identification box is the key point of the parking space we need. If the confidence of the key point in the image is greater than \(\delta\), the region where the key point \(P_{i}\) is located is considered as the target region. Assuming that P\({}_{1}\) and P\({}_{2}\) are key points with confidence greater than \(\delta\) in the same image, we need to identify whether they can form valid entry lines. First, as shown in Figure 4a,b, (a) represents the correct vertical parking space entrance line, while (b) represents the correct horizontal parking space entrance line. If P\({}_{1}\) and P\({}_{2}\) can form a vertical entrance line for the parking space, then \(P_{1}\) and \(P_{2}\) should meet the length constraint condition t\({}_{1}\leq\) 1P\({}_{1}\) P\({}_{2}\)\(\leq\) t\({}_{2}\); if P\({}_{1}\) and P\({}_{2}\) can form a horizontal entrance line for the parking space, then \(P_{1}\) and \(P_{2}\) should meet the length constraint condition t\({}_{3}\leq\) 1P\({}_{1}\)P\({}_{2}\)\(\leq\) t\({}_{4}\), where t\({}_{1}\), t\({}_{2}\), t\({}_{3}\), and t\({}_{4}\) are hyperparameters depending on the actual length of the entrance line of the real parking space and the resolution of the panoramic camera. As shown in Figure 4c,d, (c) represents the first erroneous inference of the parking space entrance line, while (d) represents the second incorrect inference of the parking space entrance line. The reason for these two types of errors is that in order to identify the  
Figure 4: Schematic diagram of key points of parking space. (Note: the target box of the key point of the parking space identified by the YoloV11 detector is marked with a red square box, the black dot is the key point of the parking space, the key point of the parking space is in the center of the red box, and the yellow dashed line represents the entrance line of the parking space.) (**a**) Correct vertical parking space entrance line; (**b**) correct level parking space entrance line. (**c**) The first erroneous inference; (**d**) the second erroneous inference. entrance line of the parking space more comprehensively, the values of \(t_{1},\ t_{2},\ t_{3},\ \text{and}\ t_{4}\) are appropriately increased. Even if the entrance line of the parking space formed by the two key points can meet the constraints between the lengths, it is still likely to fail to form an effective entrance line. For example, in Figure 4c, the length constraint of the entrance line of the parking space can be satisfied, but they still cannot form an effective entrance line, because there are additional key points between, satisfying the formula  
\[\frac{x_{i}-x_{1}}{x_{2}-x_{1}}=\frac{y_{i}-y_{1}}{y_{2}-y_{1}} \tag{1}\]  
At the same time, \(x_{i}\in(x_{1},x_{2})\) and \(y_{i}\in(y_{1},y_{2})\), where the coordinates of \(\mathcal{P}_{1}\) on the image are \((x_{1},y_{1})\), the coordinates of \(\mathcal{P}_{2}\) on the image are \((x_{2},y_{2})\), and the coordinates of \(\mathcal{P}_{i}\) on the image are \((x_{i},y_{i})\). When the key points identified by the classifier meet the above two conditions at the same time, we still cannot simply think that \(\mathcal{P}_{1}\) and \(\mathcal{P}_{2}\) can form an effective parking space entrance line. For example, in Figure 4d, the two key points \(\mathcal{P}_{1}\) and \(\mathcal{P}_{2}\) meet the above conditions 1 and 2, but cannot form a feasible parking space entrance line because they are on both sides of the target vehicle. Therefore, we must also confirm whether the parking space is clockwise or counterclockwise.