A slope recognition method, device, terminal and readable storage medium
By using a deep learning neural network model to acquire two-dimensional image data from the vehicle's front-facing camera, road slope values can be identified, solving the problems of low accuracy and high cost in existing technologies and achieving efficient and low-cost slope identification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN STREAMING VIDEO TECH
- Filing Date
- 2023-08-22
- Publication Date
- 2026-06-09
Smart Images

Figure CN117197213B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of computer vision technology, and in particular relates to a slope recognition method, device, terminal and readable storage medium. Background Technology
[0002] During vehicle operation, recognizing road slope values effectively helps drivers understand surrounding road conditions, reminding them to adjust the throttle and gears for uphill and downhill driving, thus improving driving comfort. Furthermore, for vehicles equipped with autonomous driving or driver assistance systems, recognizing road slope values also helps these systems optimize distance measurement accuracy between the vehicle and surrounding vehicles, enhancing driving safety.
[0003] In related technologies, there are two main methods for identifying road surface slope values: one is to obtain the vehicle's speed and acceleration and calculate the road surface slope value according to relevant conversion formulas; the other is to install radar sensors on the vehicle and use radar detection information to calculate the road surface slope value. However, the first identification method has a low accuracy rate for complex road conditions due to the reliance on vehicle speed and acceleration information alone. The second identification method is difficult to popularize because radar is expensive and the process of calculating the road surface slope value using radar detection information is complex. Summary of the Invention
[0004] This application provides a slope recognition method, device, terminal, and readable storage medium, which can solve the problems of low recognition accuracy and high cost of current slope recognition methods.
[0005] The first aspect of this application provides a slope identification method, the slope identification method comprising:
[0006] The vehicle acquires two-dimensional image data of the road environment in which the vehicle is currently located by the vehicle's front-facing camera.
[0007] The two-dimensional image data is input into a preset three-dimensional slope regression model to obtain a three-dimensional plane fitting equation corresponding to the two-dimensional image data. The preset three-dimensional slope regression model is a deep learning neural network model including a backbone network module, a feature transformation module, and a three-dimensional slope prediction module. The backbone network module is used to extract features from the two-dimensional image data to obtain a forward-looking feature map corresponding to the two-dimensional image data. The feature transformation module is used to transform the forward-looking feature map into a bird's-eye view feature map. The three-dimensional slope prediction module is used to perform image processing on the bird's-eye view feature map to obtain a three-dimensional plane fitting equation corresponding to the two-dimensional image data.
[0008] The road surface slope value corresponding to the current environment of the vehicle is calculated based on the three-dimensional plane fitting equation.
[0009] A second aspect of this application also provides a slope recognition device, the slope recognition device comprising:
[0010] The acquisition unit is used to acquire two-dimensional image data obtained by the vehicle's front-facing camera from image acquisition of the road environment in which the vehicle is currently located.
[0011] A fitting unit is used to input the two-dimensional image data into a preset three-dimensional slope regression model to obtain a three-dimensional plane fitting equation corresponding to the two-dimensional image data; wherein, the preset three-dimensional slope regression model is a deep learning neural network model including a backbone network module, a feature transformation module, and a three-dimensional slope prediction module; the backbone network module is used to extract features from the two-dimensional image data to obtain a forward view feature map corresponding to the two-dimensional image data; the feature transformation module is used to transform the forward view feature map into a bird's-eye view feature map; the three-dimensional slope prediction module is used to perform image processing on the bird's-eye view feature map to obtain a three-dimensional plane fitting equation corresponding to the two-dimensional image data;
[0012] The calculation unit is used to calculate the road surface slope value corresponding to the current environment of the vehicle based on the three-dimensional plane fitting equation.
[0013] A third aspect of this application also provides a terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the slope recognition method as described in the first aspect above.
[0014] A fourth aspect of this application also provides a readable storage medium storing a computer program that, when executed by a processor, implements the steps of the slope recognition method as described in the first aspect above.
[0015] In this embodiment, two-dimensional image data of the road environment in which the vehicle is currently located is obtained by acquiring images from the vehicle's front-facing camera. This two-dimensional image data is then input into a preset three-dimensional slope regression model to obtain a three-dimensional plane fitting equation corresponding to the two-dimensional image data. Next, the road surface slope value corresponding to the road environment in which the vehicle is currently located is calculated based on the three-dimensional plane fitting equation, thus realizing road surface slope value recognition based on monocular vision. Furthermore, this application directly predicts the road surface slope value corresponding to the road environment in which the vehicle is currently located from the two-dimensional image data acquired by the front-facing camera based on a deep learning neural network model. The road surface slope value can be calculated accurately in real time without the need for vehicle speed and radar detection information, thereby reducing the cost of slope recognition while ensuring the accuracy of road surface slope value recognition. Attached Figure Description
[0016] Figure 1 This is a schematic diagram illustrating the implementation process of the slope recognition method provided in the embodiments of this application.
[0017] Figure 2 A schematic diagram of the structure of the preset three-dimensional slope regression model provided in the embodiments of this application.
[0018] Figure 3 A schematic diagram of the slope identification process of the preset three-dimensional slope regression model provided in the embodiments of this application.
[0019] Figure 4 This is a schematic diagram illustrating the specific implementation process of training a three-dimensional slope regression model to be trained, as provided in an embodiment of this application.
[0020] Figure 5 This is a schematic diagram of the structure of the three-dimensional slope regression model to be trained, provided in an embodiment of this application.
[0021] Figure 6 This is a schematic diagram of the sampling points provided in the embodiments of this application.
[0022] Figure 7 This is a schematic diagram illustrating the calculation process of the self-attention module provided in an embodiment of this application.
[0023] Figure 8 This is a schematic diagram of the slope recognition device provided in the embodiments of this application.
[0024] Figure 9 A schematic diagram of the terminal structure provided in an embodiment of this application. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0026] It should be understood that in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0027] Furthermore, in the description of this application and the appended claims, the terms "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0028] References to "one embodiment" or "some embodiments" in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized.
[0029] During vehicle operation, recognizing road slope values effectively helps drivers understand surrounding road conditions, reminding them to adjust throttle and gears for uphill and downhill driving, thus improving driving comfort. Furthermore, for vehicles equipped with autonomous driving or driver assistance systems, the recognized road slope values can help these systems optimize distance measurement accuracy between the vehicle and surrounding vehicles, enhancing driving safety.
[0030] Currently, there are two main methods for identifying road surface slope values: one is to obtain the vehicle's speed and acceleration and calculate the road surface slope value using relevant conversion formulas; the other is to install radar sensors on the vehicle and use radar detection information to calculate the road surface slope value. However, the first identification method has low accuracy in complex road conditions due to the low cost of radar and the complexity of calculating the road surface slope value using radar detection information, making its widespread adoption difficult.
[0031] To address the aforementioned technical problems, embodiments of this application provide a slope recognition method, apparatus, terminal, and computer-readable storage medium. The slope recognition method can be executed by the slope recognition device on the terminal. In these embodiments, the terminal can be a vehicle, computer, server, or other intelligent terminal used for road slope recognition; this application does not impose any limitations on this.
[0032] See Figure 1 As shown, the slope identification method in this application embodiment may include steps 101 to 103.
[0033] Step 101: Obtain two-dimensional image data of the road environment in which the vehicle is currently located by the vehicle's front-facing camera.
[0034] It should be noted that this application does not limit the type of vehicle; it can be a car in the traditional sense or a robot capable of walking on roads.
[0035] The aforementioned two-dimensional image data can be an RGB image, and it belongs to a two-dimensional image from a forward-looking perspective, that is, a two-dimensional image in the direction of vehicle travel.
[0036] Step 102: Input the two-dimensional image data into the preset three-dimensional slope regression model to obtain the three-dimensional plane fitting equation corresponding to the two-dimensional image data.
[0037] In the embodiments of this application, such as Figure 2 and Figure 3 As shown, the aforementioned preset three-dimensional slope regression model is a deep learning neural network model that includes a backbone network module 21, a feature transformation module 22, and a three-dimensional slope prediction module 23.
[0038] The backbone network module 21 includes multiple convolutional layers for extracting features from the two-dimensional image data to obtain the forward view feature map corresponding to the two-dimensional image data. ,in, Indicates the height of the forward-view feature map, This represents the width of the forward-looking feature map. This represents the number of channels in the forward-view feature map.
[0039] In one embodiment, the backbone network module 21 described above can be implemented using a VGG convolutional network or a ResNet convolutional network, and this application does not impose any restrictions on this.
[0040] The aforementioned feature transformation module 22 is used to transform the forward view feature map output by the backbone network module 21 into a bird's-eye view feature map. That is, transforming the forward-looking feature map along the vehicle's direction of travel into a feature map from a bird's-eye view (BEV) perspective. .
[0041] Specifically, for any coordinate point on the forward-looking feature map ( u , v (This can be achieved through the inverse perspective transformation formula) The characteristics of this point Projected into BEV space .
[0042] in, The scale factor, representing the forward view and the BEV view, can be obtained through camera calibration. Furthermore, during camera calibration, the homography matrix can be calculated based on the calibration image, and then the scale factor can be obtained by decomposing the homography matrix using the Singular Value Decomposition (SVD) method.
[0043] The above This represents the camera's pitch angle matrix. K Indicates camera intrinsic parameters. h The camera mounting height is indicated, and it can be obtained by calibrating the camera.
[0044] The aforementioned three-dimensional slope prediction module 23 may include multiple convolutional layers and at least one fully connected layer, used to perform image processing on the aforementioned bird's-eye view feature map to obtain the three-dimensional plane fitting equation corresponding to the two-dimensional image data.
[0045] In this embodiment, the expression for the three-dimensional plane fitting equation corresponding to the above-mentioned two-dimensional image data can be: The aforementioned three-dimensional slope prediction module 23 can obtain the three-dimensional plane fitting equation corresponding to the two-dimensional image data by outputting the feature vector containing the prediction results of the equation coefficients A1, B1, C1, and D1.
[0046] Step 103: Calculate the road surface slope value corresponding to the current environment of the vehicle based on the above three-dimensional plane fitting equation.
[0047] In this embodiment of the application, after obtaining the three-dimensional plane fitting equation... Then, based on the formula for the angle between two planes... The road surface slope value corresponding to the current road environment of the vehicle can be calculated. The road surface slope value A larger slope indicates a steeper road surface. A smaller value indicates a smoother road surface.
[0048] Where the equation coefficients A2, B2, C2, and D2 are the equation coefficients of the standard plane, and this standard plane can be represented by the normal vector (0, 0, 1), that is, A2=0, B2=0, C2=1; therefore, the formula for the angle between the two planes can be simplified to: .
[0049] With the development of deep learning, neural network models have made significant progress in the field of computer vision. Many algorithms based on convolutional neural networks or Transformers have been successfully implemented and widely applied across various industries. Neural network models, driven by massive amounts of data, abstract semantic information and learn more expressive features. This application leverages the powerful expressive capabilities of neural network models to transform two-dimensional image information (i.e., the aforementioned two-dimensional image data) into a three-dimensional world. Using three-dimensional features to characterize real-world scenes, the calculated slope values are more accurate. Road slope values can be calculated accurately in real time without requiring vehicle speed or radar detection information, thus reducing the cost of slope recognition while maintaining accuracy.
[0050] In some embodiments of this application, the step 102 above includes: training the three-dimensional slope regression model to be trained to obtain the preset three-dimensional slope regression model.
[0051] Specifically, such as Figure 4 As shown, the training of the three-dimensional slope regression model to be trained can be achieved by the following steps 401 to 403.
[0052] Step 401: Obtain two-dimensional image sample data collected by the vehicle's front-facing camera, and obtain the plane fitting sample equation, confidence ground truth, and slope maximum distance ground truth corresponding to the two-dimensional image sample data.
[0053] In this embodiment of the application, the aforementioned two-dimensional image sample data may include two-dimensional image sample data corresponding to different road surface slope values. This two-dimensional image sample data may be an RGB image, and it belongs to a two-dimensional image from a forward-looking perspective, that is, a two-dimensional image in the direction of vehicle travel.
[0054] The above-mentioned acquisition of the plane fitting sample equation, confidence true value and slope maximum distance true value corresponding to the two-dimensional image sample data can be achieved by the following steps A01 to A04.
[0055] Step A01: Obtain 3D point cloud sample data collected by the LiDAR on the vehicle.
[0056] Step A02: Label the drivable road surface area in the two-dimensional image sample data to obtain the road surface segmentation label corresponding to the two-dimensional image sample data.
[0057] In this application, when annotating the drivable road surface area in the two-dimensional image sample data, the annotation operation of the user on the drivable road surface area in the two-dimensional image sample data can be received.
[0058] Step A03: Project the 3D point cloud sample data from the world coordinate system to the image coordinate system, and filter out the 3D point cloud sample data of the road surface from the 3D point cloud sample data according to the road surface segmentation label.
[0059] In this application, when projecting 3D point cloud sample data from the world coordinate system to the image coordinate system, the projection can be based on a transformation formula obtained from camera calibration. Specifically, the calibration method described in related technologies can be referenced, and will not be elaborated upon here.
[0060] In this embodiment of the application, since the road segmentation label has separated the drivable image area from the non-drivable image area in the two-dimensional image sample data, after projecting the three-dimensional point cloud sample data from the world coordinate system to the image coordinate system, the road segmentation label and the projection of the three-dimensional point cloud sample data on the image coordinate system can be used to filter out the road three-dimensional point cloud sample data from the three-dimensional point cloud sample data, that is, the three-dimensional point cloud sample data corresponding to the drivable area of the vehicle in the three-dimensional point cloud sample data.
[0061] Step A04: Perform plane fitting on the three-dimensional point cloud sample data of the road surface to obtain the plane fitting sample equation, confidence ground truth, and slope maximum distance ground truth corresponding to the two-dimensional image sample data.
[0062] In this embodiment, the selected 3D point cloud of the road surface can be fitted with a plane based on the Random Sample Consensus Algorithm (RANSAC) to obtain the plane fitting sample equation corresponding to the 2D image sample data. Furthermore, the expression of this plane fitting sample equation can be... .
[0063] After obtaining the plane fitting sample equation, the points located in the plane of the above-mentioned road surface 3D point cloud sample data can be calculated. The ratio of the number of three-dimensional point clouds on the road surface to the total number of three-dimensional point clouds on the road surface corresponding to the sample data of the three-dimensional point cloud on the road surface is used as the true value p of the confidence level mentioned above.
[0064] Furthermore, it can also calculate the points located in the plane of the aforementioned three-dimensional point cloud sample data of the road surface. The distance between each 3D point cloud on the slope and the camera is calculated, and the maximum value of the calculated distance is taken as the true value D of the farthest distance on the slope.
[0065] Step 402: Input the two-dimensional image sample data into the three-dimensional slope regression model to be trained, and output the plane fitting prediction equation, confidence prediction value and slope maximum distance prediction value corresponding to the two-dimensional image sample data from the three-dimensional slope regression model to be trained.
[0066] In the embodiments of this application, such as Figure 5 As shown, the three-dimensional slope regression model to be trained can be a deep learning neural network model including a backbone network module 51 to be trained, a feature transformation module 52, and a three-dimensional slope prediction module 53 to be trained.
[0067] The backbone network module 51 to be trained includes multiple convolutional layers, which are used to extract features from the two-dimensional image sample data to obtain the forward view sample feature map corresponding to the two-dimensional image sample data. ,in, Indicates the height of the feature map of the forward-view sample. This represents the width of the feature map of the forward-looking sample. This represents the number of channels in the feature map of the forward-view sample.
[0068] In one embodiment, the backbone network module 51 to be trained can be implemented using a VGG convolutional network to be trained or a ResNet convolutional network to be trained, and this application does not impose any restrictions on this.
[0069] The aforementioned feature transformation module 52 and the aforementioned feature transformation module 22 are the same module, used to transform the forward-view sample feature map into a bird's-eye view sample feature map. That is, the forward-looking feature map in the vehicle's direction of travel is transformed into a feature map from a bird's-eye view (BEV) perspective. .
[0070] Specifically, for any coordinate point on the forward-view sample feature map ( u , v (This can be achieved through the inverse perspective transformation formula) The characteristics of this point Projected into BEV space .
[0071] in, The scale factor, representing the forward view and the BEV view, can be obtained through camera calibration. Furthermore, during camera calibration, the homography matrix can be calculated based on the calibration image, and then the scale factor can be obtained by decomposing the homography matrix using the Singular Value Decomposition (SVD) method.
[0072] The above This represents the camera's pitch angle matrix.K Indicates camera intrinsic parameters. h The camera mounting height is indicated, and it can be obtained by calibrating the camera.
[0073] The three-dimensional slope prediction module 53 to be trained may include multiple convolutional layers and at least one fully connected layer, which are used to perform image processing on the feature map of the bird's-eye view sample to obtain the plane fitting prediction equation, confidence prediction value and slope maximum distance prediction value corresponding to the two-dimensional image sample data.
[0074] In this embodiment, the expression for the plane fitting prediction equation corresponding to the above-mentioned two-dimensional image sample data can be: The aforementioned 3D slope prediction module to be trained can output equation coefficients A4, B4, C4, D4, and... By using the feature vectors of the prediction results of L, the plane fitting sample equation and confidence prediction value corresponding to the above two-dimensional image sample data are obtained. The predicted value L is the furthest distance from the slope.
[0075] Step 403: Calculate the loss function value of the three-dimensional slope regression model to be trained based on the plane fitting sample equation, the true confidence value, the true value of the slope's farthest distance, the plane fitting prediction equation, the predicted confidence value, and the predicted value of the slope's farthest distance. Adjust the parameters of the three-dimensional slope regression model to be trained based on the loss function value until the training of the three-dimensional slope regression model to be trained is completed. Then, determine the three-dimensional slope regression model to be trained as the preset three-dimensional slope regression model.
[0076] In this embodiment of the application, in step 403 above, the loss function value of the three-dimensional slope regression model to be trained can be calculated based on the plane fitting sample equation, the confidence true value, the slope maximum distance true value, the plane fitting prediction equation, the confidence prediction value, and the slope maximum distance prediction value. This can be achieved by the following steps B01 to B04.
[0077] Step B01: Calculate the confidence loss function value of the three-dimensional slope regression model to be trained based on the true confidence value and the predicted confidence value.
[0078] For example, through formula Calculate the confidence loss function value of the 3D slope regression model to be trained. .in, This is the confidence level prediction value. p This represents the true confidence level.
[0079] Step B02: Calculate the slope maximum distance loss function value of the three-dimensional slope regression model to be trained based on the true value of the slope maximum distance and the predicted value of the slope maximum distance.
[0080] For example, through formula Calculate the slope maximum distance loss function value for the 3D slope regression model to be trained. .in, L This is the predicted value for the farthest distance across the slope. D This represents the true value of the farthest distance across the slope.
[0081] Step B03: Calculate the sampling point loss function value of the three-dimensional slope regression model to be trained based on the plane fitting sample equation and the plane fitting prediction equation.
[0082] For example, through formula Calculate the sampling point loss function value of the three-dimensional slope regression model to be trained. .in, f ( n The function value is obtained by substituting the sample points (x, y, z) into the plane fitting sample equation. To obtain the function value by substituting the sampled point (x, y, z) into the plane fitting prediction equation, where N is the total number of sampled points and n is one of the sampled points, which has coordinates (x, y, z) in the three-dimensional world coordinate system, as shown below. Figure 6 As shown, by uniformly obtaining a series of three-dimensional points from the plane corresponding to the plane fitting prediction equation, the loss function value of the above sampling points can be calculated.
[0083] Step B04: Use any one of the following loss function values as the loss function value of the confidence loss function, the slope maximum distance loss function, and the sampling point loss function, or use the sum of any combination of these loss function values as the loss function value of the three-dimensional slope regression model to be trained.
[0084] In this embodiment, when calculating the loss function value of the three-dimensional slope regression model to be trained, any one of the confidence loss function value, the slope maximum distance loss function value, and the sampling point loss function value can be used as the loss function value of the three-dimensional slope regression model to be trained; or, the sum of any combination of the confidence loss function value, the slope maximum distance loss function value, and the sampling point loss function value can be used as the loss function value of the three-dimensional slope regression model to be trained. Therefore, it should be noted that when the loss function value of the three-dimensional slope regression model to be trained is one or two of the confidence loss function value, the slope maximum distance loss function value, and the sampling point loss function value, then when training the three-dimensional slope regression model to be trained, the contents not involved in "plane fitting sample equation, confidence true value, slope maximum distance true value, plane fitting prediction equation, confidence prediction value, and slope maximum distance prediction value" do not need to be calculated.
[0085] For example, when training a 3D slope regression model, if only the "confidence loss function value" is used as the loss function value for training the 3D slope regression model, then step A04 above does not need to calculate the true value of the farthest slope distance. Correspondingly, step 402 above does not need to output the predicted value of the farthest slope distance. Step 403 above only needs to calculate the confidence loss function value based on the true confidence value and the predicted confidence value.
[0086] Only when the sum of the confidence loss function value, the slope maximum distance loss function value, and the sampling point loss function value is needed as the loss function value of the three-dimensional slope regression model to be trained, is it necessary to calculate the loss function value of the three-dimensional slope regression model to be trained based on the plane fitting sample equation, the confidence ground truth, the slope maximum distance ground truth, the plane fitting prediction equation, the confidence prediction value, and the slope maximum distance prediction value.
[0087] In other words, step 401 can be: acquiring two-dimensional image sample data collected by the vehicle's front-facing camera, and acquiring part or all of the plane fitting sample equation, confidence ground truth, and slope maximum distance ground truth corresponding to the two-dimensional image sample data. Step 402 can be: inputting the two-dimensional image sample data into the three-dimensional slope regression model to be trained, and having the three-dimensional slope regression model output part or all of the plane fitting prediction equation, confidence prediction value, and slope maximum distance prediction value corresponding to the two-dimensional image sample data. Step 403 can be: calculating the loss function value of the three-dimensional slope regression model to be trained based on part or all of the plane fitting sample equation, confidence ground truth, slope maximum distance ground truth, plane fitting prediction equation, confidence prediction value, and slope maximum distance prediction value, and adjusting the parameters of the three-dimensional slope regression model to be trained based on the loss function value until the training of the three-dimensional slope regression model to be trained is completed, and then determining the three-dimensional slope regression model to be trained as the preset three-dimensional slope regression model.
[0088] Specifically, adjusting the parameters of the three-dimensional slope regression model to be trained based on the loss function value can be achieved by adjusting the model parameters of the three-dimensional slope regression model to be trained when the loss function value is greater than a preset loss threshold, and continuing to train the three-dimensional slope regression model to be trained until the rate of change of the loss function value is less than the rate of change threshold, or the total number of training times of the three-dimensional slope regression model to be trained is greater than or equal to a preset number of training times threshold, at which point the three-dimensional slope regression model is determined to be the same as the preset three-dimensional slope regression model.
[0089] In some embodiments of this application, in order to improve the expressive power of the bird's-eye view sample features, the above-mentioned three-dimensional slope regression model to be trained may further include a self-attention module. The self-attention module is used to fuse the feature maps of the forward view sample map and the bird's-eye view sample map to obtain the fused bird's-eye view sample feature map. Correspondingly, the above-mentioned three-dimensional slope prediction module to be trained is also used to perform image processing on the fused bird's-eye view sample feature map to obtain the plane fitting prediction equation corresponding to the two-dimensional image sample data.
[0090] That is, by using a self-attention mechanism to fuse the feature maps of the forward view sample map and the bird's-eye view sample map, the bird's-eye view sample map can obtain sufficient contextual information from the forward view sample map, thereby enhancing the expressive power of the fused bird's-eye view sample map.
[0091] Specifically, such as Figure 7 As shown, by using bird's-eye view sample features Multiply by the weight matrix The query sequence Query(Q) obtained by the self-attention mechanism is then used to incorporate the features of the forward-view samples. Multiply by the weight matrix respectively and After obtaining the key-value series Key (K) and Value (V) of the self-attention mechanism, the attention scores of Query and Key are calculated, that is, the similarity between Query and Key. Then, functions such as softmax are used to normalize the attention scores to obtain the attention weight of each key. The attention weight is then weighted and summed with Value to obtain the fused bird's-eye view sample feature map.
[0092] The attention score can be calculated using a dot product. Scaling dot product This application does not restrict the use of methods such as these. .
[0093] In addition, to enable the 3D slope regression model to be trained to reference more features of the drivable area of the road surface when performing plane fitting to generate the plane fitting prediction equation, thereby improving the convergence speed of the model, increasing the training efficiency of the 3D slope regression model to be trained, and reducing the computational load of training the 3D slope regression model to be trained, the aforementioned 3D slope regression model to be trained may also include an image segmentation module. This image segmentation module is used to perform image segmentation on the aforementioned forward view sample feature map and bird's-eye view sample feature map respectively, to obtain the drivable area sample feature map corresponding to the forward view sample feature map and the drivable area sample feature map corresponding to the bird's-eye view sample feature map. Correspondingly, the aforementioned self-attention module is also used to perform feature fusion on the drivable area sample feature map corresponding to the aforementioned forward view sample feature map and the drivable area sample feature map corresponding to the aforementioned bird's-eye view sample feature map, to obtain the fused bird's-eye view sample feature map.
[0094] The image segmentation module described above can utilize the road segmentation labels corresponding to the two-dimensional image sample data obtained by annotating the drivable road surface area in the two-dimensional image sample data in step A02 as the segmentation reference value. The loss function is trained separately, where M is the total number of categories (taken as 2), N is the total number of pixels in the segmentation output image, c is the index of the category (i.e., whether the pixel is in the drivable area or not), and i is the index of the pixel. It is a pixel The truth value of is either 0 or 1. It is the predicted value of pixel i.
[0095] In other words, in a practical application, the training process of the above-mentioned 3D slope regression model to be trained can be as follows: Two-dimensional image sample data is input into the backbone network module to be trained to obtain a forward-view sample feature map. Then, the feature transformation module transforms the forward-view sample feature map into a bird's-eye view sample feature map. Next, the image segmentation module performs image segmentation on the forward-view and bird's-eye view sample feature maps to obtain drivable area sample feature maps corresponding to the forward-view and bird's-eye view sample feature maps. Then, the self-attention module performs feature fusion on the drivable area sample feature maps corresponding to the forward-view and bird's-eye view sample feature maps to obtain a fused bird's-eye view sample feature map. This fused bird's-eye view sample feature map is then input into the 3D slope prediction module to be trained. The 3D slope prediction module performs image processing on the bird's-eye view sample feature map to obtain the equation coefficients A4, B4, C4, D4, and... The feature vectors of the prediction results of L.
[0096] It should be noted that after training the 3D slope regression model to be trained and obtaining the preset 3D slope regression model, the above image segmentation module can be removed (e.g., Figure 3 As shown by the dashed line, when using the above-mentioned preset three-dimensional slope regression model for slope recognition, the image segmentation module does not need to participate in the calculation, thereby reducing the amount of calculation required for slope recognition and improving the efficiency of slope recognition.
[0097] In some embodiments of this application, step 102 above yields a three-dimensional plane fitting equation corresponding to the two-dimensional image data. Then, the coefficients of the fitting equation can be used as a basis. The vehicle was subjected to the aforementioned slope identification.
[0098] Specifically, when A value greater than 0 indicates that the vehicle is going uphill. A value less than 0 indicates that the vehicle is going downhill.
[0099] In practical applications, when road conditions are complex, the fitting effect of the three-dimensional plane fitting equation output by the preset three-dimensional slope regression model may be poor, resulting in a low accuracy of the final road surface slope value. Therefore, in some embodiments of this application, the slope recognition method further includes: using the fitting confidence of the three-dimensional plane fitting equation corresponding to the two-dimensional image data output by the preset three-dimensional slope regression model, and when the fitting confidence is greater than a preset confidence threshold, calculating the road surface slope value corresponding to the road in the current environment of the vehicle based on the three-dimensional plane fitting equation.
[0100] The aforementioned preset reliability threshold can be determined based on the user's accuracy requirements for the road slope value. When the user has high accuracy requirements for the road slope value, the preset reliability threshold can be set to a larger threshold, for example, 0.8; when the user has low accuracy requirements for the road slope value, the preset reliability threshold can be set to a smaller threshold, for example, 0.5. This application does not impose any restrictions on this.
[0101] It should be noted that, for the sake of simplicity, the aforementioned method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions. In some embodiments of this application, certain steps may be performed in other orders.
[0102] This application embodiment also provides a slope recognition device, which is configured in a terminal, such as... Figure 8 As shown, the slope recognition device may include an acquisition unit 801, a fitting unit 802, and a calculation unit 803.
[0103] The acquisition unit 801 is used to acquire two-dimensional image data obtained by the vehicle's front-facing camera capturing images of the road environment in which the vehicle is currently located.
[0104] Fitting unit 802 is used to input the two-dimensional image data into a preset three-dimensional slope regression model to obtain a three-dimensional plane fitting equation corresponding to the two-dimensional image data; wherein, the preset three-dimensional slope regression model is a deep learning neural network model including a backbone network module, a feature transformation module, and a three-dimensional slope prediction module; the backbone network module is used to extract features from the two-dimensional image data to obtain a forward view feature map corresponding to the two-dimensional image data; the feature transformation module is used to transform the forward view feature map into a bird's-eye view feature map; the three-dimensional slope prediction module is used to perform image processing on the bird's-eye view feature map to obtain a three-dimensional plane fitting equation corresponding to the two-dimensional image data;
[0105] The calculation unit 803 is used to calculate the road surface slope value corresponding to the current environment of the vehicle based on the three-dimensional plane fitting equation.
[0106] In one embodiment, the calculation unit 803 is further configured to obtain the fitting confidence of the three-dimensional plane fitting equation corresponding to the two-dimensional image data output by the preset three-dimensional slope regression model, and when the fitting confidence is greater than a preset confidence threshold, calculate the road surface slope value corresponding to the road in the current environment of the vehicle based on the three-dimensional plane fitting equation.
[0107] In one embodiment, the slope recognition device may further include a model training unit, configured to acquire two-dimensional image sample data collected by the vehicle's front-facing camera, and acquire the plane fitting sample equation, confidence ground truth, and slope maximum distance ground truth corresponding to the two-dimensional image sample data; input the two-dimensional image sample data into a three-dimensional slope regression model to be trained, and have the three-dimensional slope regression model output the plane fitting prediction equation, confidence prediction value, and slope maximum distance prediction value corresponding to the two-dimensional image sample data; calculate the loss function value of the three-dimensional slope regression model to be trained based on the plane fitting sample equation, the confidence ground truth, the slope maximum distance ground truth, the plane fitting prediction equation, the confidence prediction value, and the slope maximum distance prediction value; adjust the parameters of the three-dimensional slope regression model to be trained based on the loss function value until the training of the three-dimensional slope regression model to be trained is completed, and then determine the three-dimensional slope regression model to be trained as the preset three-dimensional slope regression model.
[0108] The three-dimensional slope regression model to be trained is a deep learning neural network model comprising a backbone network module to be trained, a feature transformation module, and a three-dimensional slope prediction module to be trained. The backbone network module to be trained is used to extract features from the two-dimensional image sample data to obtain a forward-view sample feature map corresponding to the two-dimensional image sample data. The feature transformation module is used to transform the forward-view sample feature map into a bird's-eye view sample feature map. The three-dimensional slope prediction module to be trained is used to perform image processing on the bird's-eye view sample feature map to obtain a plane fitting prediction equation, a confidence prediction value, and a slope maximum distance prediction value corresponding to the two-dimensional image sample data.
[0109] In one embodiment, the aforementioned three-dimensional slope regression model to be trained further includes a self-attention module; the self-attention module is used to perform feature fusion on the forward view sample feature map and the bird's-eye view sample feature map to obtain a fused bird's-eye view sample feature map; the three-dimensional slope prediction module to be trained is further used to perform image processing on the fused bird's-eye view sample feature map to obtain the plane fitting prediction equation corresponding to the two-dimensional image sample data.
[0110] In one embodiment, the aforementioned three-dimensional slope regression model to be trained further includes an image segmentation module; the image segmentation module is used to perform image segmentation on the forward view sample feature map and the bird's-eye view sample feature map respectively, to obtain a drivable area sample feature map corresponding to the forward view sample feature map and a drivable area sample feature map corresponding to the bird's-eye view sample feature map; the self-attention module is further used to perform feature fusion on the drivable area sample feature map corresponding to the forward view sample feature map and the drivable area sample feature map corresponding to the bird's-eye view sample feature map, to obtain a fused bird's-eye view sample feature map.
[0111] In one embodiment, the model training unit is further configured to: calculate the confidence loss function value of the three-dimensional slope regression model to be trained based on the ground truth confidence value and the predicted confidence value; calculate the slope maximum distance loss function value of the three-dimensional slope regression model to be trained based on the ground truth slope maximum distance and the predicted slope maximum distance; calculate the sampling point loss function value of the three-dimensional slope regression model to be trained based on the plane fitting sample equation and the plane fitting prediction equation; and use any one of the confidence loss function value, the slope maximum distance loss function value, and the sampling point loss function value as the loss function value of the three-dimensional slope regression model to be trained, or use the sum of any combination of the confidence loss function value, the slope maximum distance loss function value, and the sampling point loss function value as the loss function value of the three-dimensional slope regression model to be trained.
[0112] In one embodiment, the model training unit is further configured to acquire three-dimensional point cloud sample data collected by the lidar on the vehicle; label the drivable road surface area in the two-dimensional image sample data to obtain the road surface segmentation label corresponding to the two-dimensional image sample data; project the three-dimensional point cloud sample data from the world coordinate system to the image coordinate system, and filter out the road surface three-dimensional point cloud sample data from the three-dimensional point cloud sample data according to the road surface segmentation label; and perform plane fitting on the road surface three-dimensional point cloud sample data to obtain the plane fitting sample equation corresponding to the two-dimensional image sample data.
[0113] It should be noted that, for the sake of convenience and brevity, the specific working process of the slope recognition device 800 described above can be referred to the above... Figures 1 to 7 The corresponding process of the method described in the document will not be elaborated here.
[0114] like Figure 9 As shown in the illustration, this application also provides a terminal. This terminal can be a smart terminal such as a mobile phone or laptop computer. Figure 9 As shown, the terminal 9 may include: a processor 90, a memory 91, and a computer program 92 stored in the memory 91 and executable on the processor 90. When the processor 90 executes the computer program 92, it implements the steps described in the various slope recognition method embodiments above, for example, Figure 1 Steps 101 to 103 are shown.
[0115] The processor 90 referred to can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0116] The memory 91 can be an internal storage unit of the terminal 9, such as a hard disk or RAM. The memory 91 can also be an external storage device for the terminal 9, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the terminal 9. Furthermore, the memory 91 can include both internal storage units and external storage devices of the terminal 9. The memory 91 is used to store the aforementioned computer programs, as well as other programs and data required by the terminal.
[0117] The aforementioned computer program can be divided into one or more units, which are stored in the aforementioned memory 91 and executed by the aforementioned processor 90 to complete this application. The aforementioned one or more units can be a series of computer program instruction segments capable of performing a specific function, which describe the process by which the aforementioned computer program executes the aforementioned slope recognition method in a terminal.
[0118] For example, the above computer program can be divided into: acquisition unit, fitting unit, and calculation unit, with the following specific functions:
[0119] The acquisition unit is used to acquire two-dimensional image data obtained by the vehicle's front-facing camera from image acquisition of the road environment in which the vehicle is currently located.
[0120] A fitting unit is used to input the two-dimensional image data into a preset three-dimensional slope regression model to obtain a three-dimensional plane fitting equation corresponding to the two-dimensional image data; wherein, the preset three-dimensional slope regression model is a deep learning neural network model including a backbone network module, a feature transformation module, and a three-dimensional slope prediction module; the backbone network module is used to extract features from the two-dimensional image data to obtain a forward view feature map corresponding to the two-dimensional image data; the feature transformation module is used to transform the forward view feature map into a bird's-eye view feature map; the three-dimensional slope prediction module is used to perform image processing on the bird's-eye view feature map to obtain a three-dimensional plane fitting equation corresponding to the two-dimensional image data;
[0121] The calculation unit is used to calculate the road surface slope value corresponding to the current environment of the vehicle based on the three-dimensional plane fitting equation.
[0122] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0123] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0124] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0125] In the embodiments provided in this application, it should be understood that the disclosed terminals and methods can be implemented in other ways. For example, the terminal embodiments described above are merely illustrative. For example, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, systems, or units, and may be electrical, mechanical, or other forms.
[0126] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0127] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0128] If an integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in a computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in a jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0129] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A slope identification method, characterized in that, The slope identification method includes: The vehicle acquires two-dimensional image data of the road environment in which the vehicle is currently located by the vehicle's front-facing camera. The two-dimensional image data is input into a preset three-dimensional slope regression model to obtain a three-dimensional plane fitting equation corresponding to the two-dimensional image data. The preset three-dimensional slope regression model is a deep learning neural network model including a backbone network module, a feature transformation module, and a three-dimensional slope prediction module. The backbone network module is used to extract features from the two-dimensional image data to obtain a forward-looking feature map corresponding to the two-dimensional image data. The feature transformation module is used to transform the forward-looking feature map into a bird's-eye view feature map. The three-dimensional slope prediction module is used to perform image processing on the bird's-eye view feature map to obtain a three-dimensional plane fitting equation corresponding to the two-dimensional image data. The expression of the three-dimensional plane fitting equation corresponding to the two-dimensional image data is as follows: The three-dimensional slope prediction module obtains the three-dimensional plane fitting equation corresponding to the above two-dimensional image data by outputting a feature vector containing the prediction results of equation coefficients A1, B1, C1, and D1. The road surface slope value corresponding to the current environment of the vehicle is calculated based on the three-dimensional plane fitting equation. ,in, .
2. The slope identification method as described in claim 1, characterized in that, The slope identification method also includes: Obtain the fitting confidence of the three-dimensional plane fitting equation corresponding to the two-dimensional image data output by the preset three-dimensional slope regression model; The calculation of the road surface slope value corresponding to the current environment of the vehicle based on the three-dimensional plane fitting equation includes: When the fitting confidence level is greater than a preset confidence threshold, the road surface slope value corresponding to the current environment of the vehicle is calculated based on the three-dimensional plane fitting equation.
3. The slope identification method as described in claim 1 or 2, characterized in that, Before inputting the two-dimensional image data into a preset three-dimensional slope regression model to obtain the three-dimensional plane fitting equation corresponding to the two-dimensional image data, the process includes: training the three-dimensional slope regression model to be trained to obtain the preset three-dimensional slope regression model. The process of training the three-dimensional slope regression model to obtain the preset three-dimensional slope regression model includes: Acquire two-dimensional image sample data collected by the vehicle's front-facing camera, and acquire the plane fitting sample equation, confidence ground truth, and slope maximum distance ground truth corresponding to the two-dimensional image sample data; The two-dimensional image sample data is input into a three-dimensional slope regression model to be trained. The three-dimensional slope regression model to be trained outputs the plane fitting prediction equation, confidence prediction value, and slope maximum distance prediction value corresponding to the two-dimensional image sample data. The three-dimensional slope regression model to be trained is a deep learning neural network model including a backbone network module, a feature transformation module, and a three-dimensional slope prediction module to be trained. The backbone network module to be trained is used to extract features from the two-dimensional image sample data to obtain a forward view sample feature map corresponding to the two-dimensional image sample data. The feature transformation module is used to transform the forward view sample feature map into a bird's-eye view sample feature map. The three-dimensional slope prediction module to be trained is used to perform image processing on the bird's-eye view sample feature map to obtain the plane fitting prediction equation, the confidence prediction value, and the slope maximum distance prediction value corresponding to the two-dimensional image sample data. The loss function value of the three-dimensional slope regression model to be trained is calculated based on the plane fitting sample equation, the confidence ground truth, the slope maximum distance ground truth, the plane fitting prediction equation, the confidence prediction value, and the slope maximum distance prediction value. The parameters of the three-dimensional slope regression model to be trained are adjusted based on the loss function value until the training of the three-dimensional slope regression model to be trained is completed. Then, the three-dimensional slope regression model to be trained is determined as the preset three-dimensional slope regression model.
4. The slope identification method as described in claim 3, characterized in that, The three-dimensional slope regression model to be trained also includes a self-attention module; The self-attention module is used to perform feature fusion on the forward view sample feature map and the bird's-eye view sample feature map to obtain the fused bird's-eye view sample feature map. The three-dimensional slope prediction module to be trained is also used to perform image processing on the fused bird's-eye view sample feature map to obtain the plane fitting prediction equation corresponding to the two-dimensional image sample data.
5. The slope identification method as described in claim 4, characterized in that, The three-dimensional slope regression model to be trained also includes an image segmentation module; The image segmentation module is used to perform image segmentation on the forward view sample feature map and the bird's-eye view sample feature map respectively, to obtain the drivable area sample feature map corresponding to the forward view sample feature map and the drivable area sample feature map corresponding to the bird's-eye view sample feature map. The self-attention module is also used to perform feature fusion on the drivable area sample feature map corresponding to the forward view sample feature map and the drivable area sample feature map corresponding to the bird's-eye view sample feature map to obtain the fused bird's-eye view sample feature map.
6. The slope identification method as described in claim 3, characterized in that, The loss function value of the three-dimensional slope regression model to be trained, calculated based on the plane fitting sample equation, the ground truth confidence value, the ground truth slope maximum distance, the plane fitting prediction equation, the predicted confidence value, and the predicted slope maximum distance, includes: The confidence loss function value of the three-dimensional slope regression model to be trained is calculated based on the true confidence value and the predicted confidence value. The slope maximum distance loss function value of the three-dimensional slope regression model to be trained is calculated based on the true value of the slope maximum distance and the predicted value of the slope maximum distance. The sampling point loss function value of the three-dimensional slope regression model to be trained is calculated based on the plane fitting sample equation and the plane fitting prediction equation. The loss function value of the three-dimensional slope regression model to be trained can be any one of the confidence loss function value, the slope maximum distance loss function value, and the sampling point loss function value. Alternatively, the sum of any combination of the confidence loss function value, the slope maximum distance loss function value, and the sampling point loss function value can be used as the loss function value of the three-dimensional slope regression model to be trained.
7. The slope identification method as described in claim 3, characterized in that, The step of obtaining the plane fitting sample equation corresponding to the two-dimensional image sample data includes: Acquire 3D point cloud sample data collected by the lidar on the vehicle; The drivable road surface area in the two-dimensional image sample data is labeled to obtain the road surface segmentation label corresponding to the two-dimensional image sample data; The three-dimensional point cloud sample data is projected from the world coordinate system to the image coordinate system, and the road surface three-dimensional point cloud sample data is filtered out from the three-dimensional point cloud sample data according to the road surface segmentation label. Plane fitting is performed on the three-dimensional point cloud sample data of the road surface to obtain the plane fitting sample equation corresponding to the two-dimensional image sample data.
8. A slope recognition device, characterized in that, The slope recognition device includes: The acquisition unit is used to acquire two-dimensional image data obtained by the vehicle's front-facing camera from image acquisition of the road environment in which the vehicle is currently located. A fitting unit is used to input the two-dimensional image data into a preset three-dimensional slope regression model to obtain a three-dimensional plane fitting equation corresponding to the two-dimensional image data. The preset three-dimensional slope regression model is a deep learning neural network model including a backbone network module, a feature transformation module, and a three-dimensional slope prediction module. The backbone network module is used to extract features from the two-dimensional image data to obtain a forward-looking feature map corresponding to the two-dimensional image data. The feature transformation module is used to transform the forward-looking feature map into a bird's-eye view feature map. The three-dimensional slope prediction module is used to perform image processing on the bird's-eye view feature map to obtain a three-dimensional plane fitting equation corresponding to the two-dimensional image data. The expression of the three-dimensional plane fitting equation corresponding to the two-dimensional image data is as follows: The three-dimensional slope prediction module obtains the three-dimensional plane fitting equation corresponding to the above two-dimensional image data by outputting a feature vector containing the prediction results of equation coefficients A1, B1, C1, and D1. The calculation unit is used to calculate the road surface slope value corresponding to the road environment where the vehicle is currently located based on the three-dimensional plane fitting equation. ,in, .
9. A terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the computer program is executed by the processor, it implements the steps of the slope recognition method as described in any one of claims 1-7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the slope recognition method as described in any one of claims 1-7.