# Detection of Parking Slots Based on Mask R-CNN
## 5 Experimental Result
### Evaluating the Performance of Parking-Slot Detection  
To facilitate the study of vision-based parking-slot detection, [PERSON] et al. [16] established the public dataset [49] of AVM images and made it publicly available to the research community. Previous approaches used a single type of AVM images for training and testing, but the quality of the fisheye image stitching algorithm affects the detection of marking-points. As shown in Figure 19, the clarity and stitching effect of Figure 19 are significantly better than that of Figure 19. To test the generalizability of the proposed approach, we divided the training samples into three groups, of which groups 1 and 2 each had 4000 AVM images that were from our experimental vehicle and the public dataset [49], respectively; 2000 AVM images were randomly selected from group 1 and group 2, respectively, which were used to form group 3. The initial learning rate was set to 0.0001 and the training epoch was 300, the corresponding Mask R-CNN model--M1, M2, M3--were obtained by training, respectively. \begin{table}
\begin{tabular}{c c} \hline \hline
**Method** & **Speed (fps)** \\ \hline Mask R-CNN & 2 \\ Faster R-CNN & 7 \\ SSD & 18 \\ YOLO v1 & 22 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Marking-points detection speed among different methods. Figure 18: Marking-points detection performances among different methods. This paper trains the Mask R-CNN model by reducing the loss function between the predicted value and the real label. The loss function of Mask R-CNN is defined as follows:  
\[loss=L_{cls}+L_{box}+L_{mask} \tag{4}\]  
where \(L_{cls}\) indicates the classification error, \(L_{box}\) is the bounding box regression error, \(L_{mask}\) indicates the mask error. Figure 20 shows the loss during the entire training. It can be seen that three models converge to 0.05 when they are trained to the 300 th epoch, indicating that the proposed method for detecting marking-points based on Mask R-CNN has certain robustness. Table 2 shows the slot-detection performances among different methods. The test dataset consists of 256 AVM images from the experimental vehicle and the public dataset [49], which includes various types of parking slots under complex illumination. Precision, recall, accuracy and F1 scores in Formulas (5)-(8) are utilized as performance measures. \[\text{precision}=\frac{\text{ture positives}}{\text{ture positives}+\text{ false positives}} \tag{5}\]  
\[\text{recall}=\frac{\text{ture positives}}{\text{ture positives}+\text{ false negatives}} \tag{6}\]  
Figure 19: AVM images with different stitching effects. (**a**) From our experimental vehicle; (**b**) from the public dataset [49]. Figure 20: Loss of Mask R-CNN models with different training datasets. \[\text{accuracy}=\frac{\text{ture positives}+\text{ture negatives}}{\text{ture positives}+\text{ture negatives}+\text{false positives}+\text{false negatives}} \tag{7}\]  
\[\text{F1}=2\cdot\frac{\text{precision}\cdot\text{recall}}{\text{precision}+ \text{recall}} \tag{8}\]  
It can be seen that compared with traditional corner detector and line detection, the three Mask R-CNN models have better performance, of which the accuracy, precision, recall and F1 scores of M3 are 93.4%, 94.5%, 92.7% and 93.5%, respectively. The main reason is that Mask R-CNN has a strong ability to extract image features of marking-points, especially in underground parking slots or at night, where the light is dim or in the presence of reflected light. The accuracy of the method in [PERSON] et al. [16] was lower than that of M3--only 88.8%--because if slot marking's contrast with the ground is not remarkable, parking slots are classified as free space. In addition, the method can detect only two parking types: perpendicular and parallel parking. Faster R-CNN cannot detect the four vertices of parking slots when the complete parking slots are often unable to be presented in the AVM images, and the lane lines are often mistakenly regarded as the parking lines; therefore, its accuracy is only 82.2%.