Obstacle detection method, system and medium for automatic parking
By combining camera visual detection and ultrasonic radar measurement, and using the SSD network model to determine the location of obstacles, the problem of real-time and accuracy of obstacle detection in automatic parking is solved, fast and high-precision obstacle detection is achieved, and is suitable for automatic parking. Vehicle obstacle avoidance and parking space validity judgment.
Patent Information
- Application Number
- CN202010419317.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-05-18
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2040-05-18
AI Technical Summary
Existing obstacle detection methods are insufficient in real-time performance in automatic parking technology, and it is difficult to take into account the detection accuracy of large and small obstacles.
Combining camera visual detection and ultrasonic radar measurement, the SSD network model is used to determine the location of obstacles, and data set training, model pruning and quantification are used to improve detection speed and accuracy.
It achieves high-precision detection of large and small obstacles, improves the detection speed, doubles the running speed, and reduces the accuracy by about 1%. It reduces the amount of calculation while ensuring accuracy, and is suitable for obstacle avoidance in automatic parking. and parking space validity judgment.
Smart Images

Figure CN111611906B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of obstacle detection, and in particular to an obstacle detection method, system and medium for automatic parking. Background Art
[0002] As my country's economy becomes more prosperous and people's living standards continue to improve, there are more and more vehicles. As a result, urban space seems to be getting smaller, and finding parking spaces and parking have become common problems in people's lives. As a result, automatic parking technology has emerged. In automatic parking technology, obstacle recognition is a key technical link. It can help the system determine the effectiveness of parking spaces and prevent collisions between vehicles and obstacles. Existing obstacle detection methods are either insufficient in real time or cannot take into account the accuracy of large and small obstacles. Summary of the invention
[0003] In view of the above problems, the present invention provides an obstacle detection method, system and medium for automatic parking, which can take into account the detection accuracy of large and small obstacles and has a high detection speed.
[0004] The technical solution is as follows: an obstacle detection method for automatic parking, characterized in that it includes the following steps:
[0005] Step 1: Collect images through the camera, detect obstacles based on visual detection, and obtain obstacle information;
[0006] Step 2: Read the obstacle information measured by the ultrasonic radar;
[0007] Step 3: Determine the location of the obstacle by combining the obstacle information obtained by camera vision detection and ultrasonic radar measurement.
[0008] Furthermore, step 1 specifically includes the following steps:
[0009] Step 101: construct a data set, which includes image data collected according to the required scene and obstacle annotation files;
[0010] Step 102: Establish an SSD network model, use the data set to train the SSD network model, and obtain a trained SSD network model;
[0011] Step 103: Perform pruning and quantization operations on the trained SSD network model;
[0012] Step 104: calibrate the camera to obtain the image coordinate system and the world coordinate system and the relationship between them;
[0013] Step 105: Input the image captured by the camera into the trained SSD network model, output the obstacles detected in the image, and mark the obstacles with the minimum circumscribed rectangle;
[0014] Step 106: According to the relationship between the image coordinate system and the world coordinate system, the minimum circumscribed rectangle of the obstacle is converted into the world coordinate system to obtain the obstacle information in the world coordinate system.
[0015] Furthermore, in step 3, the obstacle information obtained through camera visual detection is matched with the obstacle information obtained through ultrasonic radar measurement. For obstacle information with consistent information after matching, the obstacle information obtained through ultrasonic radar measurement is output as the final detection result; for obstacle information with inconsistent information after matching, the obstacle information obtained through camera visual detection is output as the final detection result.
[0016] Furthermore, in step 101, the annotation file includes the category and location information of the car, pedestrian, and ice cream bucket in the picture.
[0017] Furthermore, in step 101, the data set is divided into a test set, a training set, and a validation set according to a certain ratio. The test set is used for training, the test set is used to test whether the detection of the SSD network model is effective, and the validation set is used to monitor the training effect of the SSD network model.
[0018] Furthermore, in step 102, the established SSD network model includes:
[0019] Input layer, used to input images;
[0020] Convolutional layer conv1a, the input image is convolved to output a feature map, the number of channels is 16, the group is 1, the convolution kernel size is 3, and the convolutional layer conv1a is connected to the convolutional layer conv1b;
[0021] Convolutional layer conv1b performs convolution operation on the output of convolutional layer conv1a and outputs feature map with 16 channels, 4 groups and 3 convolution kernels. Convolutional layer conv1b is connected to pooling layer Pooling1.
[0022] Pooling layer Pooling1, which performs pooling operation on the output of convolution layer conv1b. Pooling layer Pooling1 is connected to convolution layer conv2a.
[0023] Convolutional layer conv2a performs convolution operation on the output of pooling layer Pooling1, with the number of channels being 32, group being 1, and the convolution kernel size being 3. Convolutional layer conv2a is connected to convolutional layer conv2b;
[0024] Convolutional layer conv2b performs convolution operation on the output of convolutional layer conv2a and outputs feature map with 32 channels, 4 groups and 3 convolution kernel size. Convolutional layer conv2b is connected to pooling layer Pooling2.
[0025] Pooling layer Pooling2, which performs pooling operation on the output of convolution layer conv2b, and pooling layer Pooling2 is connected to convolution layer conv3a;
[0026] Convolutional layer conv3a performs convolution operation on the output of pooling layer Pooling2, with 64 channels, 1 group, and 3 convolution kernels. Convolutional layer conv3a is connected to convolutional layer conv3b.
[0027] Convolutional layer conv3b performs convolution operation on the output of convolutional layer conv3a and outputs feature map with 64 channels, 4 groups and 3 convolution kernels. Convolutional layer conv3b is connected to pooling layer Pooling3.
[0028] Pooling layer Pooling3 performs pooling operation on the output of convolution layer conv3b. Pooling layer Pooling3 is connected to convolution layer conv4a.
[0029] Convolutional layer conv4a performs convolution operation on the output of pooling layer Pooling3, with the number of channels being 128, group being 1, and the convolution kernel size being 3. Convolutional layer conv4a is connected to convolutional layer conv4b;
[0030] Convolutional layer conv4b performs convolution operation on the output of convolutional layer conv4a and outputs feature map with 256 channels, 4 groups and 3 convolution kernels. Convolutional layer conv4b is connected to pooling layer Pooling4.
[0031] Pooling layer Pooling4 performs pooling operation on the output of convolution layer conv34. Pooling layer Pooling4 is connected to convolution layer conv5a.
[0032] Convolutional layer conv5a performs convolution operation on the output of pooling layer Pooling4, with the number of channels being 512, group being 1, and the convolution kernel size being 3. Convolutional layer conv5a is connected to convolutional layer conv5b;
[0033] Convolutional layer conv5b performs convolution operation on the output of convolutional layer conv5a and outputs feature map with 512 channels, 4 groups and 3 convolution kernels. Convolutional layer conv5b is connected to pooling layer Pooling5.
[0034] Pooling layer Pooling5 performs pooling operation on the output of convolution layer conv5b. Pooling layer Pooling5 is connected to pooling layer Pooling6.
[0035] Pooling layer Pooling6, which performs pooling operation on the output of pooling layer Pooling5, and pooling layer Pooling6 is connected to pooling layer Pooling67;
[0036] Convolution layer Output1, convolution operation is performed on the output of convolution layer conv4b, the number of channels is 256, the group is 1, the convolution kernel size is 1, and the convolution layer Output1 is connected to the PriorBox layer PriorBox1, the convolution layer Loc1, and the convolution layer Conf1;
[0037] PriorBox layer PriorBox1 is used to deploy the pre-selected box in the feature map output by the convolution layer Output1. PriorBox layer PriorBox1 is connected to the fully connected layer Mbox_prior;
[0038] Convolution layer Loc1, convolution operation is performed on the output of convolution layer Output1, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolution layer Loc1 is connected to the fully connected layer Mbox_conf;
[0039] Convolutional layer Conf1, convolution operation is performed on the output of convolutional layer Output1, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolutional layer Conf1 is connected to the fully connected layer Mbox_loc;
[0040] Convolution layer Output2, convolution operation is performed on the output of convolution layer conv5b, the number of channels is 256, the group is 1, the convolution kernel size is 1, and the convolution layer Output2 is connected to the PriorBox layer PriorBox2, the convolution layer Loc2, and the convolution layer Conf2;
[0041] PriorBox layer PriorBox2 is used to deploy the pre-selected box in the feature map output by the convolutional layer Output2. PriorBox layer PriorBox2 is connected to the fully connected layer Mbox_prior;
[0042] Convolution layer Loc2, convolution operation is performed on the output of convolution layer Output2, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolution layer Loc2 is connected to the fully connected layer Mbox_conf;
[0043] Convolutional layer Conf2, convolution operation is performed on the output of convolutional layer Output2, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolutional layer Conf2 is connected to the fully connected layer Mbox_loc;
[0044] Convolution layer Output3 performs convolution operation on the output of pooling layer Pooling5, with the number of channels being 256, group being 1, and the convolution kernel size being 1. Convolution layer Output3 is connected to PriorBox layer PriorBox3, convolution layer Loc3, and convolution layer Conf3.
[0045] PriorBox layer PriorBox3 is used to deploy the pre-selected box in the feature map output by the convolution layer Output3. PriorBox layer PriorBox3 is connected to the fully connected layer Mbox_prior;
[0046] Convolution layer Loc3, convolution operation is performed on the output of convolution layer Output3, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolution layer Loc3 is connected to the fully connected layer Mbox_conf;
[0047] Convolutional layer Conf3, performs convolution operation on the output of convolutional layer Output3, with the number of channels being 24, group being 1, and the convolution kernel size being 1. Convolutional layer Conf3 is connected to the fully connected layer Mbox_loc;
[0048] Convolution layer Output4 performs convolution operation on the output of pooling layer Pooling6, with the number of channels being 256, group being 1, and the convolution kernel size being 1. Convolution layer Output4 is connected to PriorBox layer PriorBox4, convolution layer Loc4, and convolution layer Conf4.
[0049] PriorBox layer PriorBox4 is used to deploy the pre-selected box in the feature map output by the convolution layer Output4. PriorBox layer PriorBox4 is connected to the fully connected layer Mbox_prior;
[0050] Convolution layer Loc4, convolution operation is performed on the output of convolution layer Output4, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolution layer Loc4 is connected to the fully connected layer Mbox_conf;
[0051] Convolutional layer Conf4, convolution operation is performed on the output of convolutional layer Output4, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolutional layer Conf4 is connected to the fully connected layer Mbox_loc;
[0052] Convolution layer Output5 performs convolution operation on the output of pooling layer Pooling7, with the number of channels being 256, group being 1, and the convolution kernel size being 1. Convolution layer Output5 is connected to PriorBox layer PriorBox5, convolution layer Loc5, and convolution layer Conf5.
[0053] PriorBox layer PriorBox5 is used to deploy the pre-selected box in the feature map output by the convolution layer Output5. PriorBox layer PriorBox5 is connected to the fully connected layer Mbox_prior;
[0054] Convolution layer Loc5, convolution operation is performed on the output of convolution layer Output5, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolution layer Loc5 is connected to the fully connected layer Mbox_conf;
[0055] Convolutional layer Conf5, convolution operation is performed on the output of convolutional layer Output5, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolutional layer Conf5 is connected to the fully connected layer Mbox_loc;
[0056] The fully connected layer Mbox_conf is connected to the outputs of the convolutional layers Loc1, Loc2, Loc3, Loc4, and Loc5 respectively. The output of the fully connected layer Mbox_conf is processed by the reshape layer, the softmax layer, and the Flatten layer, and then connected to the output layer DetectionOutput.
[0057] The fully connected layer Mbox_loc is connected to the outputs of the convolutional layers Conf1, Conf2, Conf3, Conf4, and Conf5, and then connected to the output layer DetectionOutput;
[0058] The fully connected layer Mbox_prior is connected to the outputs of PriorBox layer PriorBox1, PriorBox layer PriorBox2, PriorBox layer PriorBox3, PriorBox layer PriorBox4, and PriorBox layer PriorBox5, and is connected to the output layer DetectionOutput;
[0059] The output layer DetectionOutput is used to output the detection results of the SSD network model.
[0060] Furthermore, in step 103, pruning the trained SSD network model includes the following steps:
[0061] Step 103-1: Add L1 regularization constraints to the loss function of the trained SSD network model, and perform network training using the weights of the trained SSD network model as initial values;
[0062] Step 103-2: Add L1 regularization constraint to the loss function of the SSD network model trained in the previous step, and perform network training using the weights of the SSD network model trained in the previous step as initial values;
[0063] Step 103 - 3 : loop through step 103 - 2 to reset the weights with smaller absolute values to 0.
[0064] Further, in step 103, the trained weights are represented as 32-bit floating point numbers, and the trained SSD network model is quantized to map the 32-bit floating point weights to 8-bit integers in binary, i.e., 0-255, which are represented by the following formula:
[0065] x quantized =x float ÷x scale +x zero_point
[0066] In the formula, x quantized is the quantized value, x float is any weight in the weight of a convolutional layer in the SSD network model, expressed as:
[0067]
[0068] in, and are the minimum and maximum weights of a convolutional layer in the SSD network model, respectively. scale is the scaling ratio, expressed as:
[0069]
[0070] In the formula, x zero_point is the number corresponding to the weight of 0 before and after quantization, expressed as
[0071]
[0072] Furthermore, in step 104, when the captured image is calibrated, a homography matrix of the image coordinate system and the world coordinate system is obtained, and the image coordinate system and the world coordinate system are associated through the homography matrix to achieve mutual conversion between the coordinates of the associated image coordinate system and the world coordinate system.
[0073] Furthermore, in step 3, for the obstacle obtained through camera visual detection, the midpoint of the minimum circumscribed rectangle is used as the position of the obstacle.
[0074] An obstacle detection system for automatic parking, characterized in that it includes a memory, a processor, and a program stored in the memory and executable on the processor, wherein when the processor executes the program, the obstacle detection method for automatic parking as described above is implemented.
[0075] A computer-readable storage medium having a program stored thereon, characterized in that when the program is executed by a processor, the obstacle detection method for automatic parking as described above is implemented.
[0076] The obstacle detection method for automatic parking provided by the present invention finally determines the position of the obstacle by combining the obstacle information obtained by the camera visual detection and the ultrasonic radar measurement. The target that the radar can easily detect is a large target, such as a car, and the radar is difficult to detect a small target, such as a person, an ice cream bucket or a smaller target. For the small target that is difficult to detect by the radar, the camera visual recognition result shall prevail; for the detected pedestrians and ice cream buckets, the midpoint of the minimum circumscribed rectangle is taken as the position of the obstacle, and the position of the obstacle detected by the ultrasonic radar is taken as the standard for large targets such as vehicles; the camera visual detection method of the present invention, in order to further improve the running speed of the network, performs pruning and quantization operations on the trained SSD network model, removes unimportant weights through pruning, and performs calculations on the quantized integer weights through quantization operations, which occupies a smaller bandwidth and has a faster calculation speed. After pruning and quantization operations, the running speed is increased by 1 times and the accuracy is reduced by about 1%. While ensuring the accuracy, the amount of calculation can be reduced, so that the visual detection result can be quickly obtained;
[0077] The present invention can be used to avoid obstacles and determine the validity of parking spaces. During automatic parking, if a parking space is detected, the present invention can be used to determine whether there are obstacles inside the parking space, and then determine whether the parking space is available. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] Figure 1 is a main flow chart of an obstacle detection method for automatic parking of the present invention;
[0079] Figure 2 It is a specific flow chart of step 1;
[0080] Figure 3 Schematic diagram of obstacles detected by the SSD network model. DETAILED DESCRIPTION
[0081] See Figure 1 , an obstacle detection method for automatic parking of the present invention at least comprises the following steps:
[0082] Step 1: Collect images through the camera, detect obstacles based on visual detection, and obtain obstacle information;
[0083] Step 2: Read the obstacle information measured by the ultrasonic radar;
[0084] Step 3: Determine the location of the obstacle by combining the obstacle information obtained by camera vision detection and ultrasonic radar measurement.
[0085] See Figure 2 Specifically in this embodiment, step 1 specifically includes the following steps:
[0086] Step 101: Construct a data set. The data set includes image data collected according to the required scene and annotation files of obstacles. The annotation files include the category and location information of cars, pedestrians, and ice cream buckets in the pictures. In addition, the data set is divided into a test set, a training set, and a validation set according to a certain ratio. The test set is used for training. The test set is used to test whether the detection of the SSD network model is effective. The validation set is used to monitor the training effect of the SSD network model.
[0087] Step 102: Establish an SSD network model, use the data set to train the SSD network model, and obtain a trained SSD network model. Specifically, the established SSD network model includes:
[0088] Input layer, used to input images;
[0089] Convolutional layer conv1a, the input image is convolved to output a feature map, the number of channels is 16, the group is 1, the convolution kernel size is 3, and the convolutional layer conv1a is connected to the convolutional layer conv1b;
[0090] Convolutional layer conv1b performs convolution operation on the output of convolutional layer conv1a and outputs feature map with 16 channels, 4 groups and 3 convolution kernels. Convolutional layer conv1b is connected to pooling layer Pooling1.
[0091] Pooling layer Pooling1, which performs pooling operation on the output of convolution layer conv1b. Pooling layer Pooling1 is connected to convolution layer conv2a.
[0092] Convolutional layer conv2a performs convolution operation on the output of pooling layer Pooling1, with the number of channels being 32, group being 1, and the convolution kernel size being 3. Convolutional layer conv2a is connected to convolutional layer conv2b;
[0093] Convolutional layer conv2b performs convolution operation on the output of convolutional layer conv2a and outputs feature map with 32 channels, 4 groups and 3 convolution kernel size. Convolutional layer conv2b is connected to pooling layer Pooling2.
[0094] Pooling layer Pooling2, which performs pooling operation on the output of convolution layer conv2b, and pooling layer Pooling2 is connected to convolution layer conv3a;
[0095] Convolutional layer conv3a performs convolution operation on the output of pooling layer Pooling2, with 64 channels, 1 group, and 3 convolution kernels. Convolutional layer conv3a is connected to convolutional layer conv3b.
[0096] Convolutional layer conv3b performs convolution operation on the output of convolutional layer conv3a and outputs feature map with 64 channels, 4 groups and 3 convolution kernels. Convolutional layer conv3b is connected to pooling layer Pooling3.
[0097] Pooling layer Pooling3 performs pooling operation on the output of convolution layer conv3b. Pooling layer Pooling3 is connected to convolution layer conv4a.
[0098] Convolutional layer conv4a performs convolution operation on the output of pooling layer Pooling3, with the number of channels being 128, group being 1, and the convolution kernel size being 3. Convolutional layer conv4a is connected to convolutional layer conv4b;
[0099] Convolutional layer conv4b performs convolution operation on the output of convolutional layer conv4a and outputs feature map with 256 channels, 4 groups and 3 convolution kernels. Convolutional layer conv4b is connected to pooling layer Pooling4.
[0100] Pooling layer Pooling4 performs pooling operation on the output of convolution layer conv34. Pooling layer Pooling4 is connected to convolution layer conv5a.
[0101] Convolutional layer conv5a performs convolution operation on the output of pooling layer Pooling4, with the number of channels being 512, group being 1, and the convolution kernel size being 3. Convolutional layer conv5a is connected to convolutional layer conv5b;
[0102] Convolutional layer conv5b performs convolution operation on the output of convolutional layer conv5a and outputs feature map with 512 channels, 4 groups and 3 convolution kernels. Convolutional layer conv5b is connected to pooling layer Pooling5.
[0103] Pooling layer Pooling5 performs pooling operation on the output of convolution layer conv5b. Pooling layer Pooling5 is connected to pooling layer Pooling6.
[0104] Pooling layer Pooling6, which performs pooling operation on the output of pooling layer Pooling5, and pooling layer Pooling6 is connected to pooling layer Pooling67;
[0105] Convolution layer Output1, convolution operation is performed on the output of convolution layer conv4b, the number of channels is 256, the group is 1, the convolution kernel size is 1, and the convolution layer Output1 is connected to the PriorBox layer PriorBox1, the convolution layer Loc1, and the convolution layer Conf1;
[0106] PriorBox layer PriorBox1 is used to deploy the pre-selected box in the feature map output by the convolution layer Output1. PriorBox layer PriorBox1 is connected to the fully connected layer Mbox_prior;
[0107] Convolution layer Loc1, convolution operation is performed on the output of convolution layer Output1, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolution layer Loc1 is connected to the fully connected layer Mbox_conf;
[0108] Convolutional layer Conf1, convolution operation is performed on the output of convolutional layer Output1, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolutional layer Conf1 is connected to the fully connected layer Mbox_loc;
[0109] Convolution layer Output2, convolution operation is performed on the output of convolution layer conv5b, the number of channels is 256, the group is 1, the convolution kernel size is 1, and the convolution layer Output2 is connected to the PriorBox layer PriorBox2, the convolution layer Loc2, and the convolution layer Conf2;
[0110] PriorBox layer PriorBox2 is used to deploy the pre-selected box in the feature map output by the convolutional layer Output2. PriorBox layer PriorBox2 is connected to the fully connected layer Mbox_prior;
[0111] Convolution layer Loc2, convolution operation is performed on the output of convolution layer Output2, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolution layer Loc2 is connected to the fully connected layer Mbox_conf;
[0112] Convolutional layer Conf2, convolution operation is performed on the output of convolutional layer Output2, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolutional layer Conf2 is connected to the fully connected layer Mbox_loc;
[0113] Convolution layer Output3 performs convolution operation on the output of pooling layer Pooling5, with the number of channels being 256, group being 1, and the convolution kernel size being 1. Convolution layer Output3 is connected to PriorBox layer PriorBox3, convolution layer Loc3, and convolution layer Conf3.
[0114] PriorBox layer PriorBox3 is used to deploy the pre-selected box in the feature map output by the convolution layer Output3. PriorBox layer PriorBox3 is connected to the fully connected layer Mbox_prior;
[0115] Convolution layer Loc3, convolution operation is performed on the output of convolution layer Output3, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolution layer Loc3 is connected to the fully connected layer Mbox_conf;
[0116] Convolutional layer Conf3, performs convolution operation on the output of convolutional layer Output3, with the number of channels being 24, group being 1, and the convolution kernel size being 1. Convolutional layer Conf3 is connected to the fully connected layer Mbox_loc;
[0117] Convolution layer Output4 performs convolution operation on the output of pooling layer Pooling6, with the number of channels being 256, group being 1, and the convolution kernel size being 1. Convolution layer Output4 is connected to PriorBox layer PriorBox4, convolution layer Loc4, and convolution layer Conf4.
[0118] PriorBox layer PriorBox4 is used to deploy the pre-selected box in the feature map output by the convolution layer Output4. PriorBox layer PriorBox4 is connected to the fully connected layer Mbox_prior;
[0119] Convolution layer Loc4, convolution operation is performed on the output of convolution layer Output4, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolution layer Loc4 is connected to the fully connected layer Mbox_conf;
[0120] Convolutional layer Conf4, convolution operation is performed on the output of convolutional layer Output4, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolutional layer Conf4 is connected to the fully connected layer Mbox_loc;
[0121] Convolution layer Output5 performs convolution operation on the output of pooling layer Pooling7, with the number of channels being 256, group being 1, and the convolution kernel size being 1. Convolution layer Output5 is connected to PriorBox layer PriorBox5, convolution layer Loc5, and convolution layer Conf5.
[0122] PriorBox layer PriorBox5 is used to deploy the pre-selected box in the feature map output by the convolution layer Output5. PriorBox layer PriorBox5 is connected to the fully connected layer Mbox_prior;
[0123] Convolution layer Loc5, convolution operation is performed on the output of convolution layer Output5, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolution layer Loc5 is connected to the fully connected layer Mbox_conf;
[0124] Convolutional layer Conf5, convolution operation is performed on the output of convolutional layer Output5, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolutional layer Conf5 is connected to the fully connected layer Mbox_loc;
[0125] The fully connected layer Mbox_conf is connected to the outputs of the convolutional layers Loc1, Loc2, Loc3, Loc4, and Loc5 respectively. The output of the fully connected layer Mbox_conf is processed by the reshape layer, the softmax layer, and the Flatten layer, and then connected to the output layer DetectionOutput.
[0126] The fully connected layer Mbox_loc is connected to the outputs of the convolutional layers Conf1, Conf2, Conf3, Conf4, and Conf5, and then connected to the output layer DetectionOutput;
[0127] The fully connected layer Mbox_prior is connected to the outputs of PriorBox layer PriorBox1, PriorBox layer PriorBox2, PriorBox layer PriorBox3, PriorBox layer PriorBox4, and PriorBox layer PriorBox5, and is connected to the output layer DetectionOutput;
[0128] The output layer DetectionOutput is used to output the detection results of the SSD network model.
[0129] In the convolution layer of the SSD network model in this embodiment, convolution operation, Relu operation, and BatchNorm operation are included.
[0130] Table 1 below shows the structure of the SSD network model in this embodiment. The feature extraction layers are layers 1 to 14 in the table, the prediction layers are layers 15 to 40 in the table, and the output layer is layer 41 in the table. In the SSD network model in this embodiment, the following methods are used to ensure accuracy while reducing the amount of calculation: (1) In the feature extraction part, the number of channels in the first few layers is set to be small, while the number of subsequent layers is large; (2) In the feature extraction part, the group of conv1b, conv2b, conv3b, conv4b, and conv5b layers is set to 4; (3) In the output part, a smaller number of layers is used, and there is only 1 layer in this model; (4) In the output part, the convolution kernel size is set to 1; (5) The parameters of the Priorbox layer are modified according to the size of the obstacle in the image, specifically, the size of the pre-selected box of the Priorbox layer is modified. The pre-selected box is used to match the object in the image. If the intersection of the pre-selected box and the object is relatively large, the match is successful, and then its category is determined by the classification part.
[0131]
[0132]
[0133]
[0134] Table 1
[0135] Step 103: Perform pruning and quantization operations on the trained SSD network model.
[0136] Specifically, pruning the trained SSD network model includes the following steps.
[0137] Step 103-1: Add L1 regularization constraints to the loss function of the trained SSD network model, and perform network training using the weights of the trained SSD network model as initial values;
[0138] Step 103-2: Add L1 regularization constraint to the loss function of the SSD network model trained in the previous step, and perform network training using the weights of the SSD network model trained in the previous step as initial values;
[0139] Step 103 - 3 : loop through step 103 - 2 to reset the weights with smaller absolute values to 0.
[0140] An L1 regularization constraint is added to the loss function of the trained SSD network model network, and the weights saved by the trained SSD network model are used as the initial values for training. Adding L1 regularization during training can make the weight values more sparse, that is, more values are 0. Then use the result of this step as the initial value, and gradually reset the weights with small absolute values to 0, that is, the weights are pruned. The number of weights set to 0 in this network is 56.2%. The main computational amount of the SSD algorithm lies in the dense matrix multiplication operation of the convolutional layer. After pruning, there are a large number of 0s in the weights of the network, so the dense matrix multiplication can be converted into sparse matrix multiplication, which can increase the speed by about twice.
[0141] The trained weights are represented as 32-bit floating-point numbers. The trained SSD network model is quantized to map the 32-bit floating-point weights to 8-bit integers in binary, that is, 0-255. Integers occupy less bandwidth and have faster computing speeds, which can be expressed by the following formula:
[0142] x quantized =x float ÷x scale +x zero_point
[0143] In the formula, x quantized is the quantized value, x float is any weight in the weight of a convolutional layer in the SSD network model, expressed as:
[0144]
[0145] in, and are the minimum and maximum weights of a convolutional layer in the SSD network model, respectively.
[0146] In the formula, x scale is the scaling ratio, expressed as:
[0147]
[0148] In the formula, x zero_point is the number corresponding to the weight of 0 before and after quantization, expressed as
[0149]
[0150] Step 104: when calibrating the captured image, a homography matrix of the image coordinate system and the world coordinate system is obtained, and the image coordinate system and the world coordinate system are associated through the homography matrix to achieve mutual conversion between the coordinates of the associated image coordinate system and the world coordinate system.
[0151] Step 105: Input the image captured by the camera into the trained SSD network model, output the obstacles detected in the image, and mark the obstacles with the minimum circumscribed rectangle;
[0152] Step 106: According to the relationship between the image coordinate system and the world coordinate system, the minimum circumscribed rectangle of the obstacle is converted into the world coordinate system to obtain the obstacle information in the world coordinate system.
[0153] Figure 3 shows a schematic diagram of the SSD network model detecting obstacles. As can be seen in the figure, it detects cars, people, and ice cream buckets respectively, and marks these obstacles with the minimum circumscribed rectangle.
[0154] Specifically, in step 3, the obstacle information obtained by camera vision detection is matched with the obstacle information obtained by ultrasonic radar measurement. For obstacle information with consistent information after matching, the obstacle information obtained by ultrasonic radar measurement is output as the final detection result; for obstacle information with inconsistent information after matching, the obstacle information obtained by camera vision detection is output as the final detection result, wherein, for obstacles obtained by camera vision detection, the midpoint of the minimum circumscribed rectangle is used as the position of the obstacle.
[0155] The obstacle detection method for automatic parking provided by the present invention finally determines the position of the obstacle by combining the obstacle information obtained by the camera visual detection and the ultrasonic radar measurement. The target that the radar can easily detect is a large target, such as a car, and the radar is difficult to detect a small target, such as a person, an ice cream bucket or a smaller target. For the small target that is difficult to detect by the radar, the camera visual recognition result shall prevail; for the detected pedestrians and ice cream buckets, the midpoint of the minimum circumscribed rectangle is taken as the position of the obstacle, and the position of the obstacle detected by the ultrasonic radar is taken as the standard for large targets such as vehicles; the camera visual detection method of the present invention, in order to further improve the running speed of the network, performs pruning and quantization operations on the trained SSD network model, removes unimportant weights through pruning, and performs calculations on the quantized integer weights through quantization operations, which occupies a smaller bandwidth and has a faster calculation speed. After pruning and quantization operations, the running speed is increased by 1 times and the accuracy is reduced by about 1%. While ensuring the accuracy, the amount of calculation can be reduced, so that the visual detection result can be quickly obtained;
[0156] The present invention can be used to avoid obstacles and determine the validity of parking spaces. During automatic parking, if a parking space is detected, the present invention can be used to determine whether there are obstacles inside the parking space, and then determine whether the parking space is available.
[0157] In an embodiment of the present invention, an obstacle detection system for automatic parking is also provided, including a memory, a processor, and a program stored in the memory and executable on the processor. When the processor executes the program, the obstacle detection method for automatic parking as described above is implemented.
[0158] In the implementation of the obstacle detection system for automatic parking, the memory and the processor are directly or indirectly electrically connected to realize data transmission or interaction. For example, these elements can be electrically connected to each other through one or more communication buses or signal lines, such as through a bus connection. The memory stores computer-executable instructions for implementing the data access control method, including at least one software function module that can be stored in the memory in the form of software or firmware. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory.
[0159] The memory may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc. The memory is used to store programs, and the processor executes the programs after receiving the execution instruction.
[0160] The processor may be an integrated circuit chip having the ability to process signals. The above-mentioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc. The methods, steps, and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0161] In an embodiment of the present invention, a computer-readable storage medium is also provided, on which a program is stored. When the program is executed by a processor, the obstacle detection method for automatic parking as described above is implemented.
[0162] Those skilled in the art will appreciate that the embodiments of the embodiments of the present invention may be provided as methods, systems, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0163] The embodiments of the present invention are described with reference to flowcharts and / or block diagrams of methods, systems, devices, and computer program products according to the embodiments of the present invention. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate a device for implementing the functions specified in the flowchart.
[0164] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in the flowchart.
[0165] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operation steps are executed on the computer or other programmable terminal device to produce computer-implemented processing, whereby the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in the flowchart.
[0166] The obstacle detection method for automatic parking in a moving background, the obstacle detection system for automatic parking and the application of a computer-readable storage medium provided by the present invention are introduced in detail above. The principle and implementation mode of the present invention are explained in detail using specific examples herein. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation mode and the scope of application. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. An obstacle detection method for automatic parking, characterized in that: The following steps are involved: Step 1: Collect images through the camera, detect obstacles based on visual detection, and obtain obstacle information; Step 2: Read the obstacle information measured by the ultrasonic radar; Step 3: Determine the location of the obstacle by combining the obstacle information obtained by camera vision detection and ultrasonic radar measurement; Step 1 specifically includes the following steps: Step 101: construct a data set, which includes image data collected according to the required scene and obstacle annotation files; Step 102: Establish an SSD network model, use the data set to train the SSD network model, and obtain a trained SSD network model; Step 103: Perform pruning and quantization operations on the trained SSD network model; Step 104: calibrate the camera to obtain the image coordinate system and the world coordinate system and the relationship between them; Step 105: Input the image captured by the camera into the trained SSD network model, output the obstacles detected in the image, and mark the obstacles with the minimum circumscribed rectangle; Step 106: According to the relationship between the image coordinate system and the world coordinate system, the minimum circumscribed rectangle of the obstacle is converted into the world coordinate system to obtain the obstacle information in the world coordinate system; In step 102, the established SSD network model includes: Input layer, used to input images; Convolutional layer conv1a, the input image is convolved to output a feature map, the number of channels is 16, the group is 1, the convolution kernel size is 3, and the convolutional layer conv1a is connected to the convolutional layer conv1b; Convolutional layer conv1b performs convolution operation on the output of convolutional layer conv1a and outputs feature map with 16 channels, 4 groups and 3 convolution kernels. Convolutional layer conv1b is connected to pooling layer Pooling1. Pooling layer Pooling1, which performs pooling operation on the output of convolution layer conv1b. Pooling layer Pooling1 is connected to convolution layer conv2a. Convolutional layer conv2a performs convolution operation on the output of pooling layer Pooling1, with the number of channels being 32, group being 1, and the convolution kernel size being 3. Convolutional layer conv2a is connected to convolutional layer conv2b; Convolutional layer conv2b performs convolution operation on the output of convolutional layer conv2a and outputs feature map with 32 channels, 4 groups and 3 convolution kernel size. Convolutional layer conv2b is connected to pooling layer Pooling2. Pooling layer Pooling2, which performs pooling operation on the output of convolution layer conv2b, and pooling layer Pooling2 is connected to convolution layer conv3a; Convolutional layer conv3a performs convolution operation on the output of pooling layer Pooling2, with 64 channels, 1 group, and 3 convolution kernels. Convolutional layer conv3a is connected to convolutional layer conv3b. Convolutional layer conv3b performs convolution operation on the output of convolutional layer conv3a and outputs feature map with 64 channels, 4 groups and 3 convolution kernels. Convolutional layer conv3b is connected to pooling layer Pooling3. Pooling layer Pooling3 performs pooling operation on the output of convolution layer conv3b. Pooling layer Pooling3 is connected to convolution layer conv4a. Convolutional layer conv4a performs convolution operation on the output of pooling layer Pooling3, with the number of channels being 128, group being 1, and the convolution kernel size being 3. Convolutional layer conv4a is connected to convolutional layer conv4b; Convolutional layer conv4b performs convolution operation on the output of convolutional layer conv4a and outputs feature map with 256 channels, 4 groups and 3 convolution kernels. Convolutional layer conv4b is connected to pooling layer Pooling4. Pooling layer Pooling4 performs pooling operation on the output of convolution layer conv34. Pooling layer Pooling4 is connected to convolution layer conv5a. Convolutional layer conv5a performs convolution operation on the output of pooling layer Pooling4, with the number of channels being 512, group being 1, and the convolution kernel size being 3. Convolutional layer conv5a is connected to convolutional layer conv5b; Convolutional layer conv5b performs convolution operation on the output of convolutional layer conv5a and outputs feature map with 512 channels, 4 groups and 3 convolution kernels. Convolutional layer conv5b is connected to pooling layer Pooling5. Pooling layer Pooling5 performs pooling operation on the output of convolution layer conv5b. Pooling layer Pooling5 is connected to pooling layer Pooling6. Pooling layer Pooling6, which performs pooling operation on the output of pooling layer Pooling5. Pooling layer Pooling6 is connected to pooling layer Pooling67. Convolution layer Output1, convolution operation is performed on the output of convolution layer conv4b, the number of channels is 256, the group is 1, the convolution kernel size is 1, and the convolution layer Output1 is connected to the PriorBox layer PriorBox1, the convolution layer Loc1, and the convolution layer Conf1; PriorBox layer PriorBox1 is used to deploy the pre-selected box in the feature map output by the convolution layer Output1. PriorBox layer PriorBox1 is connected to the fully connected layer Mbox_prior; Convolution layer Loc1, convolution operation is performed on the output of convolution layer Output1, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolution layer Loc1 is connected to the fully connected layer Mbox_conf; Convolutional layer Conf1, performs convolution operation on the output of convolutional layer Output1, with the number of channels being 24, group being 1, and the convolution kernel size being 1. Convolutional layer Conf1 is connected to the fully connected layer Mbox_loc; Convolution layer Output2, convolution operation is performed on the output of convolution layer conv5b, the number of channels is 256, the group is 1, the convolution kernel size is 1, and the convolution layer Output2 is connected to the PriorBox layer PriorBox2, the convolution layer Loc2, and the convolution layer Conf2; PriorBox layer PriorBox2 is used to deploy the pre-selected box in the feature map output by the convolutional layer Output2. PriorBox layer PriorBox2 is connected to the fully connected layer Mbox_prior; Convolution layer Loc2, convolution operation is performed on the output of convolution layer Output2, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolution layer Loc2 is connected to the fully connected layer Mbox_conf; Convolutional layer Conf2, convolution operation is performed on the output of convolutional layer Output2, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolutional layer Conf2 is connected to the fully connected layer Mbox_loc; Convolution layer Output3 performs convolution operation on the output of pooling layer Pooling5, with the number of channels being 256, group being 1, and the convolution kernel size being 1. Convolution layer Output3 is connected to PriorBox layer PriorBox3, convolution layer Loc3, and convolution layer Conf3. PriorBox layer PriorBox3 is used to deploy the pre-selected box in the feature map output by the convolution layer Output3. PriorBox layer PriorBox3 is connected to the fully connected layer Mbox_prior; Convolution layer Loc3, convolution operation is performed on the output of convolution layer Output3, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolution layer Loc3 is connected to the fully connected layer Mbox_conf; Convolutional layer Conf3, performs convolution operation on the output of convolutional layer Output3, with the number of channels being 24, group being 1, and the convolution kernel size being 1. Convolutional layer Conf3 is connected to the fully connected layer Mbox_loc; Convolution layer Output4 performs convolution operation on the output of pooling layer Pooling6, with the number of channels being 256, group being 1, and the convolution kernel size being 1. Convolution layer Output4 is connected to PriorBox layer PriorBox4, convolution layer Loc4, and convolution layer Conf4. PriorBox layer PriorBox4 is used to deploy the pre-selected box in the feature map output by the convolution layer Output4. PriorBox layer PriorBox4 is connected to the fully connected layer Mbox_prior; Convolution layer Loc4, convolution operation is performed on the output of convolution layer Output4, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolution layer Loc4 is connected to the fully connected layer Mbox_conf; Convolutional layer Conf4, convolution operation is performed on the output of convolutional layer Output4, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolutional layer Conf4 is connected to the fully connected layer Mbox_loc; Convolution layer Output5 performs convolution operation on the output of pooling layer Pooling7, with the number of channels being 256, group being 1, and the convolution kernel size being 1. Convolution layer Output5 is connected to PriorBox layer PriorBox5, convolution layer Loc5, and convolution layer Conf5. PriorBox layer PriorBox5 is used to deploy the pre-selected box in the feature map output by the convolution layer Output5. PriorBox layer PriorBox5 is connected to the fully connected layer Mbox_prior; Convolution layer Loc5, convolution operation is performed on the output of convolution layer Output5, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolution layer Loc5 is connected to the fully connected layer Mbox_conf; Convolutional layer Conf5, convolution operation is performed on the output of convolutional layer Output5, the number of channels is 24, the group is 1, the convolution kernel size is 1, and the convolutional layer Conf5 is connected to the fully connected layer Mbox_loc; The fully connected layer Mbox_conf is connected to the outputs of the convolutional layers Loc1, Loc2, Loc3, Loc4, and Loc5 respectively. The output of the fully connected layer Mbox_conf is processed by the reshape layer, the softmax layer, and the Flatten layer, and then connected to the output layer DetectionOutput. The fully connected layer Mbox_loc is connected to the outputs of the convolutional layers Conf1, Conf2, Conf3, Conf4, and Conf5, and then connected to the output layer DetectionOutput; The fully connected layer Mbox_prior is connected to the outputs of PriorBox layer PriorBox1, PriorBox layer PriorBox2, PriorBox layer PriorBox3, PriorBox layer PriorBox4, and PriorBox layer PriorBox5, and is connected to the output layer DetectionOutput; The output layer DetectionOutput is used to output the detection results of the SSD network model; In step 101, the annotation file includes the category and location information of the car, pedestrian, and ice cream bucket in the picture; the data set is divided into a test set, a training set, and a validation set according to a certain ratio, the test set is used for training, the test set is used to test whether the detection of the SSD network model is effective, and the validation set is used to monitor the training effect of the SSD network model; in step 104, when the collected image is calibrated, the homography matrix of the image coordinate system and the world coordinate system is obtained, and the image coordinate system and the world coordinate system are associated through the homography matrix to realize the mutual conversion between the coordinates of the associated image coordinate system and the world coordinate system; In step 103, pruning the trained SSD network model includes the following steps: Step 103-1: Add L1 regularization constraints to the loss function of the trained SSD network model, and perform network training using the weights of the trained SSD network model as initial values; Step 103-2: Add L1 regularization constraint to the loss function of the SSD network model trained in the previous step, and perform network training using the weights of the SSD network model trained in the previous step as initial values; Step 103 - 3 : loop through step 103 - 2 to reset the weights with smaller absolute values to 0.
2. The obstacle detection method for automatic parking according to claim 1, characterized in that: In step 3, the obstacle information obtained through camera visual detection is matched with the obstacle information obtained through ultrasonic radar measurement. For obstacle information with consistent information after matching, the obstacle information obtained through ultrasonic radar measurement is output as the final detection result; for obstacle information with inconsistent information after matching, the obstacle information obtained through camera visual detection is output as the final detection result.
3. The obstacle detection method for automatic parking according to claim 1, characterized in that: In step 103, the trained weights are represented as 32-bit floating point numbers, and the trained SSD network model is quantized to map the 32-bit floating point weights to 8-bit integers in binary, i.e., 0-255, which are represented by the following formula: x quantized =x float ÷x scale +x zero_point In the formula, x quantized is the quantized value, x float is any weight in the weight of a convolutional layer in the SSD network model, expressed as: in, and are the minimum and maximum weights of a convolutional layer in the SSD network model, respectively. scale is the scaling ratio, expressed as: In the formula, x zero_point is the number corresponding to the weight of 0 before and after quantization, expressed as 4. The obstacle detection method for automatic parking according to claim 2, characterized in that: In step 3, for the obstacle obtained through camera vision detection, the midpoint of the minimum circumscribed rectangle is used as the position of the obstacle.
5. An obstacle detection system for automatic parking, characterized in that: The invention comprises a memory, a processor and a program stored in the memory and executable on the processor, wherein the obstacle detection method for automatic parking as claimed in claim 1 is implemented when the processor executes the program.
6. A computer-readable storage medium having a program stored thereon, characterized in that: When the program is executed by a processor, the obstacle detection method for automatic parking as claimed in claim 1 is implemented.
