Parking space detection method and device, computer readable storage medium and vehicle
By optimizing the post-processing stage and backbone network of the YOLOv5-OBB model and combining the positional correlation between parking spaces and parking space corners, the parking space detection method was improved, solving the accuracy problem of traditional methods under changes in lighting, and achieving efficient parking space detection on an embedded platform.
Patent Information
- Application Number
- CN202511627208.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-07
- Publication Date
- 2026-02-24
AI Technical Summary
Existing parking space detection methods based on traditional computer vision have high requirements for environmental conditions and poor detection accuracy, especially when the lighting conditions change. Furthermore, deep learning-based methods have slow inference time and high resource consumption on embedded platforms.
By optimizing the post-processing stage of the YOLOv5-OBB model, the positional correlation between parking spaces and parking corners is introduced to construct a correlation coefficient model. Combined with the improved RFB module, CA mechanism and SPPF module, the backbone network is optimized and the GELU activation function is adopted to improve detection accuracy.
The accuracy and speed of parking space detection were improved under complex lighting conditions, meeting the deployment requirements of embedded platforms. The detection accuracy was improved by 8.4%, and the inference speed was increased by 2.87 FPS.
Smart Images

Figure CN121564684A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of vehicle control technology, and in particular to a parking space detection method, detection device, computer-readable storage medium, and vehicle. Background Technology
[0002] Autonomous parking systems are crucial for self-driving cars, with parking space detection being a key component. Among related technologies, traditional computer vision techniques such as edge detection, corner detection, histogram analysis, and feature matching are used for parking space detection. However, this method is highly dependent on environmental conditions and suffers from poor accuracy in parking space detection. Summary of the Invention
[0003] This application aims to at least partially address one of the technical problems in the related art. Therefore, the first objective of this application is to propose a parking space detection method based on an improved YOLOv5-OBB algorithm, thereby improving the accuracy of parking space detection.
[0004] The second objective of this application is to provide a computer-readable storage medium.
[0005] The third objective of this application is to propose a parking space detection device.
[0006] The fourth objective of this application is to propose a vehicle.
[0007] To achieve the above objectives, the first aspect of this application proposes a parking space detection method applied to vehicles. The method includes: a post-processing stage of optimizing the YOLOv5-OBB model based on the positional correlation between parking spaces and corners of parking spaces to obtain a parking space detection model; acquiring environmental image information of the environment in which the vehicle is located, and inputting the environmental image information into the parking space detection model to output the parking spaces in the environment in which the vehicle is located.
[0008] The parking space detection method according to embodiments of this application is applied to vehicles. The method includes a post-processing stage that optimizes the YOLOv5-OBB model based on the positional correlation between parking spaces and parking space corners to obtain a parking space detection model. In practical applications, environmental image information of the vehicle's environment is acquired and input into the parking space detection model to output the parking spaces within the vehicle's environment. Therefore, this method, based on the improved YOLOv5-OBB algorithm, improves parking space detection accuracy.
[0009] In addition, the parking space detection method according to the above embodiments of this application may also have the following additional technical features: According to one embodiment of this application, the post-processing stage of optimizing the YOLOv5-OBB model based on the positional correlation between parking spaces and parking space corners includes: constructing a correlation coefficient model based on the positional correlation between parking spaces and parking space corners; setting the correlation coefficient module in the post-processing stage of the YOLOv5-OBB model so that after the image information is input into the parking space detection model, the parking space detection model calculates the correlation coefficient between the detected parking space frame and the preset parking space corner frame based on the correlation coefficient model, so as to adjust the confidence of the corresponding parking space based on the correlation coefficient.
[0010] According to one embodiment of this application, the correlation coefficient between the detected parking space frame and the preset parking space corner frame is calculated based on the correlation coefficient model, including: obtaining the Euclidean distance between the center point of the parking space frame and the center point of the preset parking space corner frame to obtain a first distance; obtaining the maximum diagonal length between the diagonal length of the parking space frame and the diagonal length of the preset parking space corner frame to obtain a second distance; obtaining the ratio between the first distance and the second distance to obtain a first value; and obtaining the correlation coefficient corresponding to the first value based on an exponential function.
[0011] According to one embodiment of this application, adjusting the confidence level of a corresponding parking space based on the correlation coefficient includes: increasing the confidence level of the parking space when the correlation coefficient is greater than a preset coefficient.
[0012] According to one embodiment of this application, the parking space detection method further includes: replacing the Focus module in the backbone network of the YOLOv5-OBB model with a function based on a standard convolutional network, replacing the SSP module in the backbone network of the YOLOv5-OBB model with a function based on the SPPF module, and using the GELU activation function as the activation function of the backbone network of the YOLOv5-OBB model to optimize the backbone network of the YOLOv5-OBB model.
[0013] According to one embodiment of this application, the parking space detection method further includes: introducing a receptive field module into the backbone network of the YOLOv5-OBB model to optimize the backbone network of the YOLOv5-OBB model, wherein the receptive field module includes multiple convolutional branches set in parallel, and the convolutional kernels and / or dilatations of the multiple convolutional branches are different.
[0014] According to one embodiment of this application, the parking space detection method further includes: introducing a coordinated attention mechanism at the back end of the backbone network and the upsampling stage of the neck network of the YOLOv5-OBB model, respectively, to optimize the YOLOv5-OBB model.
[0015] To achieve the above objectives, a second aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the parking space detection method described above.
[0016] According to embodiments of this application, a computer-readable storage medium stores thereon a computer program that, when executed by a processor, implements the above-described parking space detection method, thereby improving the accuracy of parking space detection. To achieve the above objectives, a third aspect of this application proposes a parking space detection device for use in vehicles. The device includes: an optimization module for optimizing the post-processing stage of the YOLOv5-OBB model based on the positional correlation between parking spaces and corners of parking spaces to obtain a parking space detection model; an acquisition module for acquiring environmental image information of the environment in which the vehicle is located; and a detection module for inputting the environmental image information into the parking space detection model to output the parking spaces in the environment in which the vehicle is located.
[0017] The parking space detection device according to an embodiment of this application is applied to a vehicle. The device optimizes the YOLOv5-OBB model in its post-processing stage based on the positional correlation between the parking space and the corner of the parking space, obtaining a parking space detection model. An acquisition module acquires environmental image information of the vehicle's environment. A detection module inputs this environmental image information into the parking space detection model to output the parking spaces within the vehicle's environment. Therefore, this device performs parking space detection based on the improved YOLOv5-OBB algorithm, improving the accuracy of parking space detection.
[0018] To achieve the above objectives, a fourth aspect of this application provides a vehicle including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the above-described parking space detection method.
[0019] According to the embodiments of this application, when the processor executes the computer program stored in the memory, the vehicle implements the above-described parking space detection method, thereby improving the accuracy of parking space detection.
[0020] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0021] Figure 1 This is a flowchart of a parking space detection method according to an embodiment of this application; Figure 2 This is a system architecture diagram of a YOLOv5-OBB model according to an embodiment of this application; Figure 3This is a schematic diagram illustrating the calculation of the correlation coefficient according to an embodiment of this application; Figure 4 This is a schematic diagram of the network architecture of an SPP module according to an embodiment of this application; Figure 5 This is a schematic diagram of the network architecture of an SPPF module according to an embodiment of this application; Figure 6 This is a schematic diagram of a Gaussian error linear unit activation function and a Sigmoid linear unit activation function according to an embodiment of this application; Figure 7 This is a diagram of an improved sensory field block structure according to an embodiment of this application; Figure 8 The calculation process of coordinated attention (CA) according to one embodiment of this application; Figure 9 This is a connection diagram of the parking space detection device according to an embodiment of this application; Figure 10 This is a schematic diagram of the vehicle connection according to an embodiment of this application. Detailed Implementation
[0022] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.
[0023] The following description, with reference to the accompanying drawings, outlines the parking space detection method, detection device, computer-readable storage medium, and vehicle proposed in embodiments of this application.
[0024] Most current vehicle parking assistance systems on the market are based on chips with very high computing power and various sensors. To develop a lower-cost autonomous parking system, it is necessary to develop it based on embedded chips with lower computing power. The parking space detection methods used in this technology are described in detail below.
[0025] Previous parking space detection methods were mainly based on traditional computer vision techniques, such as edge detection, corner detection, histograms, and feature matching. These methods are only suitable for parking space scenarios with very good lighting conditions, and they perform poorly when dealing with different parking lot lighting conditions and variations in the appearance of parking spaces.
[0026] In recent years, deep learning-based methods have been able to extract high-level features from input images and perform location estimation and classification of parking spaces. Deep learning-based methods are mainly divided into object detection methods and semantic segmentation methods. Object detection methods are further divided into one-stage and two-stage detection. One-stage object detection methods can predict the position, type, and orientation of parking space corners, and then group the corners using geometric rules to infer the existence of parking spaces. However, this method can only detect vertical and parallel rectangular parking spaces. The two-stage object detection method, DeepPS (DeepProposals for Scene Understanding), first uses YOLOv2 to detect parking space corners, and then obtains parking space type and orientation matching through a local image classification network and templates. This method can effectively detect different types of parking spaces, but it requires two deep neural networks, which makes the inference time too slow and the model parameters too large, making it unsuitable for embedded endpoint deployment. Semantic segmentation-based methods improve parking space detection, but the algorithm consumes a lot of resources.
[0027] To address at least one of the aforementioned technical problems, this application proposes a parking space detection method. This method optimizes the post-processing stage of the YOLOv5-OBB model based on the correlation between parking spaces and parking space corners, thereby improving parking space detection accuracy through the improved YOLOv5-OBB algorithm. The parking space detection method of this application will be described in detail below with reference to the accompanying drawings.
[0028] Figure 1 This is a flowchart of a parking space detection method according to an embodiment of this application.
[0029] like Figure 1 As shown, the parking space detection method of this application embodiment is applied to a vehicle, and the method includes: S1 is the post-processing stage of optimizing the YOLOv5-OBB model based on the positional correlation between parking spaces and corners of parking spaces, resulting in a parking space detection model.
[0030] Specifically, the YOLOv5-OBB (You Only Look Once version 5 - Oriented BoundingBoxes, YOLOv5 - Rotating Object Detection) model is based on the YOLOv5 (YouOnlyLookOncev5) model, adding object box angle prediction to predict rotated object boxes. It has five versions with different model sizes: n, s, m, l, and x, corresponding to different network depths and widths. Its network structure is as follows... Figure 2 As shown.
[0031] For input: Four images were stitched into one image using CutMix (crop-stitch / cut-blend), Mosic (crop-stitch / cut-blend), and other advanced data augmentation methods, with random adaptive padding. This not only enriched the dataset but also reduced batch size and training algorithm requirements, and optimized the model's detection performance for small objects, robustness, and generalization. Adaptive anchor frame computation and adaptive image scaling methods were also used.
[0032] The backbone network, CSPDarknet (Cross Stage Partial Darknet), is primarily used to extract features from the input image. The Focus module is used for feature extraction to reduce the number of computational parameters. The CSP module optimizes the computationally intensive problem caused by repeated gradient information in the network and better integrates features extracted by the previous network.
[0033] The PAN (Path Aggregation Network) module is used to fuse different feature modules. The FPN (Feature Pyramid Network) provides high-level semantic information through upsampling, combining it with low-level detailed information to achieve cross-scale feature fusion. PAN provides localization features and low-level semantic information through downsampling, providing and aggregating cross-level semantic information within the feature pyramid. This allows the network to better capture the detailed features and contextual information of the target, thereby improving the accuracy and robustness of target detection.
[0034] Output: Prediction is performed on feature maps of different sizes, where 52×52, 26×26 and 13×13 feature maps predict large, medium and small targets respectively.
[0035] Using regression to predict angles may lead to predictions that exceed our defined range, resulting in an angular distance boundary problem that produces a large loss value. Therefore, the YOLOv5-OBB model uses a cyclic smoothing label method. The angular regression method is converted into a classification form, directly discrete continuous problems, avoiding boundary cases. In this way, since the classification results are finite, they will not exceed the defined range. This also solves the problem that the classification loss cannot measure the angular distance between the prediction result and the label; if the GT (ground truth) is 0 degrees, then when we predict it as 1 degree and -90 degrees, the loss value is the same, as shown in equation (1):
[0036] The window function must satisfy properties such as periodicity, symmetry, monotonicity, and maximum value. It can generally be an impulse function, a rectangular function, a trigonometric function, or a Gaussian function. It is the radius of the window function. This represents the angle of the current bounding box. The window function setting allows the model to measure the angular distance between the predicted label and the ground truth label; that is, the closer the predicted value is to the true value within a certain range, the smaller the loss value. Furthermore, the problem of angular periodicity is solved by introducing periodicity, even when 89 degrees and -90 degrees are adjacent.
[0037] This paper uses a pre-trained YOLOv5-OBB model as a parking space detection model for automatic parking space recognition in autonomous driving. Currently, the accuracy of parking space detection drops significantly when the training data includes warehouse corners. The inventors found that this decrease in accuracy can be attributed to the spatial overlap between different categories of warehouse corners and parking spaces. Therefore, the model faces the challenge of accurately defining the bounding boxes and category labels of these objects during both the training and testing phases. This not only leads to a decrease in bounding box accuracy but also causes confusion in the category labels.
[0038] Therefore, optimizing the detection of parking space corners is crucial. Currently, post-processing algorithms primarily emphasize non-maximum suppression methods, which filter out target boxes with confidence scores below a predefined threshold, as well as boxes with significant positional overlap determined by intersection exceeding union metric. Utilizing prior knowledge, we observed that most parking spaces align with parking space corners and exhibit strong positional correlation. To avoid false positives due to low confidence scores caused by building occlusion at parking space corners, this application optimizes the post-processing stage of the YOLOv5-OBB model based on the positional correlation between parking spaces and parking space corners. This involves introducing a correlation assessment between parking spaces and parking space corners during post-processing to improve the YOLOv5-OBB model's parking space detection accuracy.
[0039] S2, acquire environmental image information of the vehicle's environment, and input the environmental image information into the parking space detection model to output the parking spaces in the vehicle's environment.
[0040] In other words, in practical applications, the environmental image information actually collected is input into the parking space detection model. The parking space detection model processes the image to detect and output the parking spaces that exist in the current environment, so as to serve the parking control of vehicles.
[0041] This embodiment proposes a location rule-based NMS (Non-Maximum Suppression) penalty for the correlation between parking spaces and reservoir corners, further improving the accuracy of parking space detection.
[0042] In some embodiments of this application, the post-processing stage of optimizing the YOLOv5-OBB model based on the positional correlation between parking spaces and parking space corners includes: constructing a correlation coefficient model based on the positional correlation between parking spaces and parking space corners; setting the correlation coefficient module in the post-processing stage of the YOLOv5-OBB model so that after the image information is input into the parking space detection model, the parking space detection model calculates the correlation coefficient between the detected parking space frame and the preset parking space corner frame based on the correlation coefficient model, so as to adjust the confidence of the corresponding parking space based on the correlation coefficient.
[0043] Specifically, a correlation coefficient model is constructed to assess the positional correlation between parking spaces and parking space corners. This model can be represented by a formula. The correlation coefficient model is used to identify the correlation between multiple parking space bounding boxes in the detection output, obtaining the correlation coefficient between the parking space bounding box and the preset parking space corner bounding box. Based on the correlation coefficient, the confidence score of the corresponding parking space is adjusted to mitigate the impact of reduced confidence scores caused by visual obstruction due to parking space angles. For example, when the correlation coefficient is high, the confidence score of the parking space is increased; when the correlation coefficient is low, the confidence score of the parking space is not adjusted. Specifically, the adjustment step size can be determined based on the correlation coefficient, and the confidence score of the parking space can be adjusted accordingly.
[0044] In some embodiments of this application, the correlation coefficient between the detected parking space frame and the preset parking space corner frame is calculated based on the correlation coefficient model, including: obtaining the Euclidean distance between the center point of the parking space frame and the center point of the preset parking space corner frame to obtain a first distance; obtaining the maximum diagonal length between the diagonal length of the parking space frame and the diagonal length of the preset parking space corner frame to obtain a second distance; obtaining the ratio between the first distance and the second distance to obtain a first value; and obtaining the correlation coefficient corresponding to the first value based on an exponential function.
[0045] Specifically, to explain the locational correlation between parking spaces and corners of parking areas, a penalty factor, namely the correlation coefficient, is introduced into the correlation coefficient model. This was incorporated into existing post-processing algorithms. Drawing inspiration from the application of the DIOU (Distance-IoU) loss function in modeling the spatial similarity between two target frames, the concept of centroid distance was introduced.
[0046] like Figure 3 As shown, by calculating the centroid distance between the parking space frame and the preset parking space corner frame, as well as the diagonal length of their target frames, the correlation field number was constructed to establish the formula for calculating the correlation coefficient K: (2) in, Represents the center point of the parking space frame. Preset the center point of the corner frame of the storage location. This represents the distance between the center points of two detection frames. Represents the diagonal length of the parking space frame. This represents the diagonal length of the preset storage location corner frame. It is the correlation coefficient between two spatial locations. The stronger the spatial correlation between two target frames of different categories, the better. The larger the calculated value, the better.
[0047] In some embodiments of this application, the confidence level of the corresponding parking space is adjusted based on the correlation coefficient, including: increasing the confidence level of the parking space when the correlation coefficient is greater than a preset coefficient.
[0048] In other words, when the K value is large (high correlation), its confidence level is increased, thereby increasing the chances of the parking space surviving in the NMS. Specific methods for increasing the confidence level include multiplicative enhancement and weighted average methods.
[0049] For example, when using the multiplicative enhancement method to increase confidence levels, the formula is as follows: adjusted_score =original_score *(1+α*K) (3) Wherein, `original_score` represents the original prediction confidence score of the model. `K` represents the calculated correlation coefficient, ranging from (0, 1). `α` represents the preset enhancement coefficient, for example, `α=0`: indicates no belief in prior knowledge, with no change in confidence score; `α=0.5`: indicates that prior knowledge has a moderate influence, which can increase the confidence score by up to 50% (when `K=1`); `α=1.0`: indicates that prior knowledge has a significant influence, which can increase the confidence score by up to 100% (i.e., double).
[0050] When using the weighted average method to increase the confidence level, the adjustment formula is as follows: adjusted_score =(1-β)*original_score+β*K (4) Where β represents the preset weight coefficient, ranging from [0, 1], indicating the degree of trust in prior knowledge. For example: β=0: completely dependent on model score; β=0.3: more biased towards model score, but incorporating some prior knowledge; β=0.7: more biased towards prior knowledge; β=1: completely dependent on prior knowledge, ignoring model score. original_score represents the original prediction confidence of the model. K represents the calculated correlation coefficient, ranging from (0, 1).
[0051] Furthermore, a relevance threshold K_threshold can be preset. After calculating the relevance coefficient, the confidence level is increased only when the relevance coefficient K exceeds K_threshold; that is, enhancement is only performed when the relevance is strong enough. For example, setting K_threshold = 0.5 means that prior knowledge is considered valid and enhanced only when the normalized distance between the parking space and the corner of the underground parking garage is sufficiently close (K>0.5). For boxes with weak relevance, they are left as is or even slightly penalized to avoid enhancing incorrect associations, thus preventing weakly related or irrelevant boxes from being incorrectly enhanced, resulting in greater accuracy.
[0052] In some embodiments of this application, the parking space detection method further includes: replacing the Focus module in the backbone network of the YOLOv5-OBB model with a function based on a standard convolutional network, replacing the SSP module in the backbone network of the YOLOv5-OBB model with a function based on the SPPF module, and using the GELU activation function as the activation function of the backbone network of the YOLOv5-OBB model to optimize the backbone network of the YOLOv5-OBB model.
[0053] Specifically, in the YOLOv5-OBB model, a Focus module is introduced before the input layer of the backbone network. This module selectively samples each other element from the feature layers of the image, effectively reducing the image size by two while increasing the number of channels from 3 to 12. These channels are then concatenated through a concatenation operation. To optimize computational efficiency and accelerate model inference, this embodiment strategically replaces the Focus operation with a standard convolution operation, which has… The convolution kernel and two strides. This strategic replacement not only addresses potential compilation issues associated with the Focus operator on certain embedded chip platforms, but also significantly reduces the computational load.
[0054] In standard convolutional networks, the SPP (Spatial Pyramid Pooling) module is a pooling layer used to perform pooling operations on input feature maps at different scales. Its main purpose is to address the problem of mismatched receptive field sizes in CNNs (Convolutional Neural Networks) when objects of different sizes appear in an image. The core idea of the SPP module is to create pooling layers at different scales to capture feature information at different scales. It was introduced into the YOLOv3-SPP network, achieving feature fusion at different scales and significantly improving the network's detection accuracy. Figure 4 As shown, the SPP structure processes input features in parallel through convolution kernels of varying sizes. and The system uses a max pooling layer and then concatenates different output features to achieve feature aggregation at different scales. The SPPF (Spatial Pyramid Pooling-Fast) module is an improved version of the SPP module, combining a Feature Pyramid Network (FPN). FPN addresses the scale invariance problem in object detection by fusing feature maps from different layers to process targets at different scales. The difference between SPPF and SPP is that SPPF sequentially inputs the output features into a pool of size 1. In the three max-pooling layers, the outputs of each layer are concatenated and then joined together. The outputs of each layer are concatenated, as shown below. Figure 5 As shown, SPPF has lower computational intensity and is faster than SPP. In this embodiment, the SPP structure is replaced by the more efficient SPPF structure.
[0055] In the YOLOv5-OBB model, the GELU (Gaussian Error Linear Unit) activation function replaces the SiLU (Sigmoid Linear Unit) activation function in the backbone network CBS structure, improving the network's generalization ability. GELU combines the characteristics of dropout, zoneout, and ReLU (Rectified Linear Unit), and its calculation formula is Equation (5). At the input end, the GELU activation function exhibits approximately linear characteristics, which can better adapt to most features of the input data and improve the model's learning and expressive capabilities. A comparison of SiLU and GELU functions is shown below. Figure 6 As shown.
[0056] (5) In some embodiments of this application, the parking space detection method further includes: introducing a receptive field module into the backbone network of the YOLOv5-OBB model to optimize the backbone network of the YOLOv5-OBB model, wherein the receptive field module includes multiple convolutional branches set in parallel, and the convolutional kernels and / or dilatation rates of the multiple convolutional branches are different.
[0057] Specifically, during autonomous parking, linguistic information about corner locations is needed. Since corners are small targets, they overlap with the rectangular bounding box of the parking space, leading to an overall decrease in the model's accuracy in detecting corners and parking spaces. In YOLOv5's three detection output heads, The feature maps contain richer details, which is helpful for detecting small targets such as corners. However, due to the smaller receptive field of the feature maps, they lack richer contextual and linguistic information. To increase the receptive field and contextual linguistic information, an improved RFB (Receptive Field Block) module is introduced into the YOLOv5-OBB model. The RFB module contains convolutional layers with kernels of different sizes, which form different multi-branch structures of the improved RFB. To improve the detection accuracy of small targets, cavity convolutions of different sizes are introduced, giving the model a stronger feature representation capability.
[0058] like Figure 7 As shown, the improved RFB module first passes through The convolution passes the previously output feature map, changes the number of channels in the feature map, adjusts the number of output channels, and introduces an activation function to increase non-linearity and improve the model's expressive power. Then, in each branch, zero-convolutions with dilation rates of 1, 3, and 5 are mapped to increase the model's receptive field. Finally, the feature map outputs from the three branches are concatenated and passed through... The convolutional output achieves the fusion of different features. Finally, a shortcut operation is added to create skip connections, which are residual connections used to prevent gradient vanishing and gradient exploding problems during training.
[0059] In some embodiments of this application, the parking space detection method further includes introducing a coordinated attention mechanism at the back end of the backbone network and the upsampling stage of the neck network of the YOLOv5-OBB model, respectively, to optimize the YOLOv5-OBB model.
[0060] Specifically, in poorly lit underground parking garages or at night, the outlines of parking spaces cannot be identified. The neck network structure of the YOLOv5-OBB model, which relies heavily on deep feature fusion, leads to the loss of a large amount of detail, resulting in numerous false negatives and false negatives. To improve the recognition rate and reduce the impact of lighting conditions, this paper introduces a Coordinate Attention (CA) mechanism in the backbone network backend and the up-adoption stage of feature extraction. However, most current attention mechanisms typically employ global max pooling or average pooling, which leads to the loss of spatial information of objects. In contrast, the CA mechanism not only simply incorporates channel attention but also integrates spatial attention, allowing positional information to be incorporated into the channel attention mechanism.
[0061] The CA mechanism consists of two main parts: coordinate information embedding and coordinate attention generation. For example... Figure 8 As shown, given input X, two space expansions using the pooling kernel are used. and Each channel is encoded separately along both the horizontal and vertical coordinates. The outputs are concatenated and then sent to a shared [system / platform]. Convolutional transformation. The concatenated feature maps are fed into a batchnorm and non-linear transformation to encode spatial information in the vertical and horizontal directions. The output is then split into two independent tensors. Two additional tensors are used... Convolution transformation converts them into their respective forms with the input. Tensors with the same number of channels are used to obtain... and Then, under the sigmoid activation function, two attention weight maps are obtained along the spatial direction, each with long-term dependencies in a specific direction. Finally, the input feature map is multiplied by the two weights to improve the representativeness of the feature map.
[0062] As a specific embodiment of this application, to address the problems of low spatial detection accuracy and slow inference speed during autonomous parking, an improved YOLOv5-OBB algorithm is proposed. First, to improve model inference speed, the Focus and SSP modules in the backbone network are replaced with more efficient ordinary convolution and SPPF modules, and the SiLU activation function is replaced with GELU. Second, an improved RFB module is introduced to increase the receptive field of view. Then, a CA mechanism is introduced to improve the off-site detection effect in low-light environments. Finally, a position rule-based NMS penalty is proposed to address the correlation between parking spaces and reservoir corners, further improving parking space detection accuracy. The core content includes the following: 1. Improved RFB and CA modules have been added to the original Yolov5-OBB algorithm to enhance the model's generalization ability in complex scenes such as darkness. At the same time, the Focus and SSP structures have been replaced to reduce the number of parameters in the calculation and speed up the model inference.
[0063] 2. Model the correlation between the simultaneous occurrence of parking spaces and storage corners (such as garage corners, turns, etc.) based on existing prior knowledge, and set a penalty factor. This improves the confidence level of parking space and storage corner detection.
[0064] 3. Using standard target detection evaluation methods, comparative and ablation experiments were conducted on the original algorithm on a self-made parking space detection dataset and a publicly available dataset. The results show that the algorithm is competitive in terms of real-time performance and detection accuracy in complex scenarios such as nighttime.
[0065] Compared to the original YOLOv5-OBB model, this model improves mAP (mean Average Precision) by 8.4%. When the model size is reduced by 1M, FPS (Frames Per Second) increases by 2.87, meeting the deployment requirements of automotive embedded platforms. To deploy the model on embedded platforms with limited algorithmic capabilities, future research will optimize the network structure, employing methods such as model pruning or knowledge extraction to reduce the number of model parameters and further improve inference speed.
[0066] Therefore, the improved YOLOV5-OBB model outperforms previous models in detection environments with small targets and weak lighting, and has strong robustness, detection and recognition capabilities. At the same time, it simplifies the algorithm model, improves the computation speed, and reduces the consumption of algorithm resources.
[0067] In summary, the parking space detection method according to the embodiments of this application, applied to vehicles, includes a post-processing stage of optimizing the YOLOv5-OBB model based on the positional correlation between parking spaces and parking space corners to obtain a parking space detection model. In practical applications, environmental image information of the vehicle's environment is acquired and input into the parking space detection model to output the parking spaces within the vehicle's environment. Therefore, this method, based on the improved YOLOv5-OBB algorithm, improves the accuracy of parking space detection.
[0068] Corresponding to the above embodiments, this application also proposes a computer-readable storage medium.
[0069] The computer-readable storage medium of this application embodiment stores a computer program thereon, which, when executed by a processor, implements the above-described parking space detection method.
[0070] According to embodiments of this application, a computer-readable storage medium stores thereon a computer program that, when executed by a processor, implements the above-described parking space detection method, thereby improving the accuracy of parking space detection.
[0071] Corresponding to the above embodiments, this application also proposes a parking space detection device.
[0072] like Figure 9 As shown, the parking space detection device of this application embodiment is applied to a vehicle. The device includes: an optimization module 10, an acquisition module 20, and a detection module 30.
[0073] The optimization module 10 is used to optimize the post-processing stage of the YOLOv5-OBB model based on the positional correlation between the parking space and the corner of the parking space to obtain the parking space detection model; the acquisition module 20 is used to acquire the environmental image information of the vehicle's environment; and the detection module 30 is used to input the environmental image information into the parking space detection model to output the parking space in the vehicle's environment.
[0074] According to one embodiment of this application, the optimization module 10 optimizes the post-processing stage of the YOLOv5-OBB model based on the positional correlation between parking spaces and corners of parking spaces, specifically used for: constructing a correlation coefficient model based on the positional correlation between parking spaces and corners of parking spaces; and setting the correlation coefficient module in the post-processing stage of the YOLOv5-OBB model. The detection module 30 is specifically used to, after inputting image information into the parking space detection model, calculate the correlation coefficient between the detected parking space frame and the preset parking space corner frame based on the correlation coefficient model, so as to adjust the confidence of the corresponding parking space based on the correlation coefficient.
[0075] According to one embodiment of this application, the detection module 30 calculates the correlation coefficient between the detected parking space frame and the preset parking space corner frame based on the correlation coefficient model. Specifically, it is used to: obtain the Euclidean distance between the center point of the parking space frame and the center point of the preset parking space corner frame to obtain a first distance; obtain the maximum diagonal length between the diagonal length of the parking space frame and the diagonal length of the preset parking space corner frame to obtain a second distance; obtain the ratio between the first distance and the second distance to obtain a first value; and obtain the correlation coefficient corresponding to the first value based on an exponential function.
[0076] According to one embodiment of this application, the detection module 30 adjusts the confidence level of the corresponding parking space based on the correlation coefficient, specifically for: increasing the confidence level of the parking space when the correlation coefficient is greater than a preset coefficient.
[0077] According to one embodiment of this application, the optimization module 10 is further configured to: replace the Focus module in the backbone network of the YOLOv5-OBB model with a function based on a standard convolutional network, replace the SSP module in the backbone network of the YOLOv5-OBB model with a function based on the SPPF module, and use the GELU activation function as the activation function of the backbone network of the YOLOv5-OBB model to optimize the backbone network of the YOLOv5-OBB model.
[0078] According to one embodiment of this application, the optimization module 10 is further configured to: introduce a receptive field module into the backbone network of the YOLOv5-OBB model to optimize the backbone network of the YOLOv5-OBB model, wherein the receptive field module includes multiple convolutional branches set in parallel, and the convolutional kernels and / or dilatations of the multiple convolutional branches are different.
[0079] According to one embodiment of this application, the optimization module 10 is further configured to: introduce a coordinated attention mechanism at the back end of the backbone network and the upsampling stage of the neck network of the YOLOv5-OBB model, respectively, to optimize the YOLOv5-OBB model.
[0080] It should be noted that for details not disclosed in the parking space detection device of this application embodiment, please refer to the details disclosed in the parking space detection method of the above embodiment of this application, which will not be repeated here.
[0081] The parking space detection device according to an embodiment of this application is applied to a vehicle. The device optimizes the YOLOv5-OBB model in its post-processing stage based on the positional correlation between the parking space and the corner of the parking space, obtaining a parking space detection model. An acquisition module acquires environmental image information of the vehicle's environment. A detection module inputs this environmental image information into the parking space detection model to output the parking spaces within the vehicle's environment. Therefore, this device performs parking space detection based on the improved YOLOv5-OBB algorithm, improving the accuracy of parking space detection.
[0082] Corresponding to the above embodiments, this application also proposes a vehicle like Figure 10 As shown, the vehicle 100 in this embodiment includes a memory 110, a processor 120, and a computer program stored in the memory 110 and executable on the processor 120. When the processor 120 executes the computer program, it implements the above-described parking space detection method.
[0083] According to the embodiments of this application, when the processor executes the computer program stored in the memory, the vehicle implements the above-described parking space detection method, thereby improving the accuracy of parking space detection.
[0084] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.
[0085] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0086] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0087] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0088] In this application, unless otherwise expressly specified and limited, the terms "installation," "connection," "joining," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components, unless otherwise expressly limited. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.
[0089] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.
Claims
1. A parking space detection method, characterized in that, Applied to vehicles, the method includes: The post-processing stage of the YOLOv5-OBB model is optimized based on the positional correlation between parking spaces and corners of parking spaces to obtain a parking space detection model. The system acquires environmental image information of the vehicle's location and inputs the environmental image information into the parking space detection model to output the parking spaces within the vehicle's location.
2. The parking space detection method according to claim 1, characterized in that, The post-processing stage of optimizing the YOLOv5-OBB model based on the location correlation between parking spaces and corners includes: A correlation coefficient model is constructed based on the location correlation between parking spaces and corners of parking spaces; The correlation coefficient module is set in the post-processing stage of the YOLOv5-OBB model so that after the image information is input into the parking space detection model, the parking space detection model calculates the correlation coefficient between the detected parking space frame and the preset parking space corner frame based on the correlation coefficient model, and adjusts the confidence of the corresponding parking space based on the correlation coefficient.
3. The parking space detection method according to claim 2, characterized in that, The correlation coefficient between the detected parking space frame and the preset parking space corner frame is calculated based on the correlation coefficient model, including: The Euclidean distance between the center point of the parking space frame and the center point of the preset parking space corner frame is obtained to get the first distance; The maximum diagonal length between the diagonal length of the parking space frame and the diagonal length of the preset parking space corner frame is obtained to obtain the second distance; Obtain the ratio between the first distance and the second distance to get a first value; The correlation coefficient corresponding to the first value is obtained based on the exponential function.
4. The parking space detection method according to claim 3, characterized in that, The confidence level of the corresponding parking space is adjusted based on the correlation coefficient, including: If the correlation coefficient is greater than a preset coefficient, the confidence level of the parking space is increased.
5. The parking space detection method according to claim 1, characterized in that, Also includes: The Focus module in the backbone network of the YOLOv5-OBB model is functionally replaced based on a standard convolutional network, and the SSP module in the backbone network of the YOLOv5-OBB model is functionally replaced based on the SPPF module. The GELU activation function is used as the activation function of the backbone network of the YOLOv5-OBB model to optimize the backbone network of the YOLOv5-OBB model.
6. The parking space detection method according to claim 3, characterized in that, Also includes: A receptive field module is introduced into the backbone network of the YOLOv5-OBB model to optimize the backbone network. The receptive field module includes multiple convolutional branches set in parallel, and the convolutional kernels and / or dilatations of the multiple convolutional branches are different.
7. The parking space detection method according to claim 3, characterized in that, Also includes: A coordinated attention mechanism is introduced at the back end of the backbone network and the upsampling stage of the neck network of the YOLOv5-OBB model to optimize the YOLOv5-OBB model.
8. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the parking space detection method according to any one of claims 1-7.
9. A parking space detection device, characterized in that, Applied to vehicles, the device includes: The optimization module is used to optimize the post-processing stage of the YOLOv5-OBB model based on the positional correlation between parking spaces and corners of parking spaces, so as to obtain the parking space detection model. The acquisition module is used to acquire environmental image information of the vehicle's surroundings. The detection module is used to input the environmental image information into the parking space detection model to output the parking space in the environment where the vehicle is located.
10. A vehicle, characterized in that, The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the parking space detection method according to any one of claims 1-7.
Citation Information
Patent Citations
Unmanned aerial vehicle detection method and system based on vehicle detection model
CN114299404A
Parking space identification method and device, vehicle and storage medium
CN115880656A
Parking space identification method and device, terminal equipment and storage medium
CN117557978A
Parking space detection method and system
US20240227785A1