Loopback detection method and device, vehicle and computer readable storage medium

By using the scene recognition model of semantic label map and attention heat map in loop closure detection, the accuracy and robustness of loop closure detection in urban traffic scenes are improved, and the problem of poor robustness and accuracy in the existing technology is solved. problem, achieving reliable perception of SLAM systems and industrialization progress of autonomous driving technology.

CN118692086APending Publication Date: 2024-09-24GUANGZHOU AUTOMOBILE GROUP CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410684607.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-29
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

In the existing technology, loop detection methods based on deep learning have poor robustness and accuracy in urban traffic scenes, and cannot effectively focus on discriminative objects in the scene, resulting in a decrease in the performance of the visual SLAM system.

Method used

Using a scene recognition model based on semantic label maps and attention heat maps, multiple frames of images are input into the scene recognition model to generate vectors corresponding to the images, which are used to determine whether loops occur, improve the scene recognition model's attention to scene features, and reduce time periods. or interference from seasonal factors and dynamic traffic participants.

Benefits of technology

It improves the accuracy and robustness of scene recognition, provides reliable perception priors for SLAM systems, enhances the accuracy and robustness of loop detection, and reduces model deployment and maintenance costs, promoting the autonomous driving technology industry. development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118692086A
    Figure CN118692086A
Patent Text Reader

Abstract

The embodiment of the invention provides a loopback detection method and device, a vehicle and a computer readable storage medium, and relates to the technical field of automatic driving. The method comprises the following steps: acquiring multiple frames of images shot in a vehicle driving process; the multiple frames of images are input into a scene recognition model, vectors corresponding to the multiple frames of images are obtained, the scene recognition model is obtained through training according to a semantic tag graph corresponding to the images and an attention heat map, the semantic tag graph carries semantic tags of all pixels of the images, and the attention heat map carries attention heat maps corresponding to the images; the attention heat map carries weight information of each channel of the feature map corresponding to the image; and determining whether loopback occurs according to the vectors corresponding to the multiple frames of images. According to the invention, the robustness and accuracy of scene recognition and loopback detection can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of autonomous driving technology, and more specifically, to a loop detection method, device, vehicle, and computer-readable storage medium. Background Art

[0002] Visual Simultaneous Localization and Mapping (SLAM) provides accurate positioning for intelligent connected vehicles and is an integral part of intelligent driving systems. Loop closure detection is a key component of SLAM systems. Based on scene recognition technology, loop closure detection helps minimize uncertainty in pose and map estimation, thereby ensuring the performance of visual SLAM systems. Incorrect loop closure detection can cause the entire visual SLAM system to fail, making robustness to scene changes crucial for scene recognition models.

[0003] In urban traffic scenarios, the presence of non-traffic backgrounds such as vehicles and pedestrians can affect the environmental features extracted by scene recognition models, leading to misjudgment of the scene. Current deep learning-based methods fail to fully leverage deep learning's advantages in extracting semantic-level features and fail to focus on discriminative objects in the scene, resulting in poor scene recognition accuracy. Summary of the Invention

[0004] The embodiments of the present application provide a loop closure detection method, apparatus, vehicle, and computer-readable storage medium to address the current technical problems of poor robustness and accuracy in scene recognition and loop closure detection.

[0005] In a first aspect, an embodiment of the present application provides a loop detection method, which includes: obtaining multiple frames of images taken during vehicle driving; inputting the multiple frames of images into a scene recognition model to obtain vectors corresponding to each of the multiple frames of images, wherein the scene recognition model is trained based on a semantic label map and an attention heat map corresponding to the image, the semantic label map carries the semantic label of each pixel of the image, and the attention heat map carries the weight information of each channel of the feature map corresponding to the image; determining whether a loop occurs based on the vectors corresponding to each of the multiple frames of images.

[0006] In the second aspect, an embodiment of the present application provides a loop detection device, which includes: an image acquisition module for acquiring multiple frames of images taken during vehicle driving; an image processing module for inputting the multiple frames of images into a scene recognition model to obtain vectors corresponding to each of the multiple frames of images, wherein the scene recognition model is trained based on a semantic label map and an attention heat map corresponding to the image, the semantic label map carries the semantic label of each pixel of the image, and the attention heat map carries the weight information of each channel of the feature map corresponding to the image; a loop determination module for determining whether a loop occurs based on the vectors corresponding to each of the multiple frames of images.

[0007] In a third aspect, an embodiment of the present application provides a vehicle, comprising: a memory and a processor, wherein an application is stored in the memory, and the processor executes the method provided in the embodiment of the present application when calling the application.

[0008] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, characterized in that it includes: program code is stored on the computer-readable storage medium, and the method provided by the embodiment of the present application is executed when the processor calls the program code.

[0009] The loop detection method of this application has the following technical effects:

[0010] ① The scene recognition model is trained based on the semantic label map and attention heat map corresponding to the image, which improves the scene recognition model's attention to the relevant features of the scene (such as urban traffic scenes), reduces the interference of time or seasonal factors and dynamic traffic participants (pedestrians, vehicles), and achieves accurate perception of the scene. It provides a reliable perception prior for the SLAM system and can improve the accuracy and robustness of scene recognition.

[0011] ② The scene recognition model trained based on the semantic label map corresponding to the image and the attention heat map obtains the vectors corresponding to each frame of the image and performs loop detection based on the vectors. The scene recognition model (deep learning model) is used to learn vectors (i.e., feature representation) from multiple frames of images (i.e., raw data) without the need for manual selection or design of features. This enables the scene recognition model to better adapt to image changes in different time periods or seasons, improves the robustness and generalization ability of the global feature representation, and thus improves the accuracy and robustness of loop detection.

[0012] ③ Taking multiple frames of images as input can directly obtain the result of whether the multiple frames of images belong to the same scene (i.e., the loop detection result). Scene recognition and loop detection are integrated together instead of being performed in stages, which ensures the continuity of scene information in the model transmission and can capture global and long-range correlation information. While maintaining model accuracy, it improves the model deployment efficiency and reduces the development and maintenance costs of model transplantation, promotes the better commercial application of autonomous driving technology, and promotes the rapid development of industrialization. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] To more clearly illustrate the technical solutions in the embodiments of this application, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of this application, not all embodiments. All other embodiments and drawings obtained by ordinary technicians in this field based on the embodiments of this application without creative work are within the scope of protection of this application.

[0014] Figure 1 A schematic diagram of the structure of the model training framework provided in an embodiment of the present application is shown;

[0015] Figure 2 A schematic diagram showing a flow chart of the calculation process of the Grad-CAM model provided in an embodiment of the present application is shown;

[0016] Figure 3 A schematic diagram of a loop detection method according to an embodiment of the present invention is shown;

[0017] Figure 4 A schematic diagram of a loop detection method according to another embodiment of the present invention is shown;

[0018] Figure 5 An embodiment of the present application provides Figure 4 Flow diagram of step S210;

[0019] Figure 6 An embodiment of the present application provides Figure 4 Flow chart of step S230;

[0020] Figure 7 The following is a schematic diagram showing the structure of a loop detection device provided in an embodiment of the present application;

[0021] Figure 8 A schematic structural diagram of a vehicle provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0022] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.

[0023] The loop closure detection method in the embodiments of this application is applied to vehicles. In particular, the scene recognition model training portion of the loop closure detection method can be executed in the vehicle or extracted and executed separately, without any specific limitation in this application. Vehicles may include, but are not limited to, electric vehicles, automobiles, and hybrid vehicles.

[0024] See also Figure 1 , Figure 1 The schematic diagram of the structure of the model training framework provided by the embodiment of the present application is shown. The model training framework of the present application includes a scene recognition model, a semantic segmentation model and a gradient-weighted class activation mapping (Grad-CAM) model.

[0025] The input of the scene recognition model is a sample image ( Figure 1 The sample image shown is a grayscale image of a real sample image), and the output is a vector corresponding to the sample image, that is, the scene recognition model is used to generate a vector corresponding to the image.

[0026] like Figure 1 As shown in the figure, the scene recognition model includes a residual neural network (ResNet), a channel attention network, and a scene recognition layer.

[0027] ResNet (convolutional neural network) is the backbone network of the scene recognition model. The input of ResNet is the pattern sample, and the output is the feature map output by the last convolution layer of ResNet. That is, ResNet is used to extract image features. Figure 1 As shown, ResNet can be ResNet34. It should be noted that the feature map corresponding to the image referred to below in this application refers to the feature map output by the last convolutional layer of ResNet after the image is input into ResNet.

[0028] The input of the channel attention network is the feature map output by the last convolutional layer of ResNet, and the output is the channel attention map, which carries the feature map output by the last convolutional layer of ResNet. In other words, the channel attention network is used to perform channel-weighted processing on the feature map output by the last convolutional layer of ResNet, thereby learning the weight relationship between the channels of the feature map output by the last convolutional layer of ResNet. The channel attention network can be a Squeeze-and-Excitation Network (SENet).

[0029] The input of the scene recognition layer is the feature map and channel attention map output by the last convolutional layer of ResNet, and the output is the vector corresponding to the sample image. Figure 1 As shown, sample images are input in the form of image pairs, each of which includes a search image, a positive image (an image similar to the search image), and a negative image (an image dissimilar to the search image). The vector output by the scene recognition layer includes a vector corresponding to each image in the image pair. That is, the vector output by the scene recognition layer includes a vector corresponding to the search image, a vector corresponding to the positive image, and a vector corresponding to the negative image. The scene recognition layer can be a NetVLAD layer, which is an improvement based on the Vector of Locally Aggregated Descriptors (VLAD).

[0030] The input of the semantic segmentation model is the sample image, and the output is the semantic label map ( Figure 1 The semantic label map shown is a grayscale image of the true semantic label map. That is, the semantic segmentation model is used to generate a semantic label map corresponding to the sample image. Each pixel in the semantic label map has a semantic label, that is, the semantic label map corresponding to the image carries the semantic label of each pixel in the image. For example, if there is a car in the sample image, the semantic label of the pixels belonging to the car is "car". The semantic segmentation model can be a Proportional Integral Differential Network (PIDNet).

[0031] Please also refer to Figure 1 and Figure 2 , Figure 2 The figure shows a flow chart of the calculation process of the Grad-CAM model provided by the embodiment of the present application. The input of the Grad-CAM model is the feature map and vector output by the last convolution layer of ResNet, and the output is the array of arrays corresponding to the feature map on the last convolution layer of ResNet and the attention heat map ( Figure 1 and Figure 2 The attention heatmap shown is a grayscale image of the real attention heatmap. The attention heatmap carries the weight information of each channel of the feature map output by the last convolutional layer of ResNet.

[0032] The operation process of the Grad-CAM model includes the following steps: the Grad-CAM model backpropagates the vector to the last convolutional layer of ResNet, and uses the gradient backpropagated to the last convolutional layer to calculate the importance of each channel of the feature map of the last convolutional layer, that is, the weight information of each channel. Specifically, after backpropagating the vector to the last convolutional layer of ResNet, the gradient of the feature map on the last convolutional layer can be calculated to obtain the gradient corresponding to each pixel on each feature map, that is, each feature map corresponds to a gradient map; each gradient map is averaged, and this average value is the weight of the corresponding feature map. The weights of all feature maps are combined to form an array corresponding to the feature map of the last convolutional layer, which carries the weight information of each channel of the feature map; the feature maps on the last convolutional layer of ResNet are weighted and summed with their corresponding weights, and finally, the attention heat map is generated by the linear rectifier function (Rectified Linear Unit, abbreviated as ReLU).

[0033] Based on the array of feature maps, attention heatmaps, channel attention maps, semantic label maps, and vectors on the last convolutional layer of ResNet, the loss of this model training can be calculated, and end-to-end supervised training of the scene recognition model can be performed based on the loss.

[0034] See also Figure 3 , Figure 3 FIG. 1 shows a flow chart of a loop detection method provided by an embodiment of the present application. Figure 3 As shown, the loop detection method may include steps S110 to S130.

[0035] Step S110: Acquire multiple frames of images captured during the vehicle's driving process.

[0036] The vehicle continuously captures images or videos while driving, and multiple frames of images that can be used as key frames can be screened out from the captured images or videos.

[0037] In some embodiments, multiple frames of images can be filtered out from the captured images or videos according to a preset time interval. The time interval between adjacent images in the multiple frames of images is the preset time interval. The preset time interval can be set according to actual needs, and this application does not impose any specific restrictions.

[0038] In some embodiments, multiple frames containing landmark information for identifying a scene can be selected from captured images or videos. The time interval between adjacent images in the multiple frames can be determined based on the actual capture time of the images. The landmark information can be used to identify different scenes. For example, the landmark information may include, but is not limited to, landmark buildings and geographic location markers.

[0039] Step S120: Input the multiple frames of images into a scene recognition model to obtain vectors corresponding to each of the multiple frames of images, wherein the scene recognition model is trained based on a semantic label map and an attention heat map corresponding to the image, the semantic label map carries the semantic label of each pixel of the image, and the attention heat map carries the weight information of each channel of the feature map corresponding to the image.

[0040] The scene recognition model is trained with the assistance of the semantic segmentation model and is used to extract the vector of the image. Specifically, multiple frames of images are traversed. For each frame of image, the scene recognition model can sequentially perform feature extraction, channel weighting, and vector generation processing on the image through the ResNet backbone network, SENet, and NetVLAD layers, and output the vector of the image. After traversing multiple frames of images, the vectors corresponding to each of the multiple frames of images can be obtained. For a specific description of training the scene recognition model based on the semantic label map and attention heat map corresponding to the image, please refer to steps S210 to S230 below.

[0041] Step S130: determining whether a loop occurs based on the vectors corresponding to the multiple frames of images.

[0042] Loop closure detection refers to the detection of a vehicle reaching a certain scene, which closes the map loop. Loop closure can refer to the phenomenon of map closure.

[0043] In some embodiments, a target image can be obtained from multiple frames of images based on the vectors corresponding to each of the multiple frames of images, where the multiple frames of images include a current image, the current image is an image captured at the current moment, and the similarity between the target image and the current image is less than a similarity threshold and the target image is not adjacent to the current image; based on the temporal continuity and number of the target images, it is determined whether a loop occurs.

[0044] In some embodiments, similarity is obtained between a vector corresponding to each of the multiple image frames and a vector corresponding to the current image; and an image having a similarity greater than a similarity threshold and not adjacent to the current image is selected from the multiple image frames as a target image. The target image has similar scene semantics and may represent the same geographic location.

[0045] As an example, the cosine similarity between the vector corresponding to each frame image in the multi-frame image and the vector corresponding to the current image can be obtained; and an image whose cosine similarity is greater than a similarity threshold and is not adjacent to the current image is filtered out from the multi-frame image as the target image.

[0046] In some embodiments, determining whether a loop occurs based on the temporal continuity and number of target images may include: determining the number of temporally consecutive images in the target image; if the number is greater than or equal to a threshold, determining that the temporally consecutive images in the target image belong to the same scene, and determining that a loop occurs; if the number is less than the threshold, determining that the temporally consecutive images in the target image do not belong to the same scene, and determining that a loop does not occur. The threshold can be adjusted based on actual accuracy and precision of loop detection; for example, the threshold can be set to 3.

[0047] As an example, the target images may be sorted in time sequence (eg, chronological order); the number of consecutive adjacent images in the sorted target images is obtained to obtain the number of consecutive adjacent images in time sequence in the target images.

[0048] It is understood that the time interval between temporally adjacent images may refer to the time interval between adjacent images in a multi-frame image. For example, assuming that the multi-frame image may include consecutively captured images A to F (A, B, C, D, E, F), images A to F are temporally consecutive, assuming that image F is the current image, and images A to C are target images, target images A to C are temporally consecutive and not adjacent to the current image F. If the number threshold is 3, then it can be determined that images A to F belong to the same scene, and a loop is determined to have occurred.

[0049] Based on steps S110 to S130, the loop detection method of the present application has the following technical effects:

[0050] ① The scene recognition model is trained based on the semantic label map and attention heat map corresponding to the image, which improves the scene recognition model's attention to the relevant features of the scene (such as urban traffic scenes), reduces the interference of time or seasonal factors and dynamic traffic participants (pedestrians, vehicles), and achieves accurate perception of the scene. It provides a reliable perception prior for the SLAM system and can improve the accuracy and robustness of scene recognition.

[0051] ② The scene recognition model trained based on the semantic label map corresponding to the image and the attention heat map obtains the vectors corresponding to each frame of the image and performs loop detection based on the vectors. The scene recognition model (deep learning model) is used to learn vectors (i.e., feature representation) from multiple frames of images (i.e., raw data) without the need for manual selection or design of features. This enables the scene recognition model to better adapt to image changes in different time periods or seasons, improves the robustness and generalization ability of the global feature representation, and thus improves the accuracy and robustness of loop detection.

[0052] ③ Taking multiple frames of images as input can directly obtain the result of whether the multiple frames of images belong to the same scene (i.e., the loop detection result). Scene recognition and loop detection are integrated together instead of being performed in stages, which ensures the continuity of scene information in the model transmission and can capture global and long-range correlation information. While maintaining model accuracy, it improves the model deployment efficiency and reduces the development and maintenance costs of model transplantation, promotes the better commercial application of autonomous driving technology, and promotes the rapid development of industrialization.

[0053] See also Figure 4 , Figure 4 FIG. 1 shows a flow chart of a loop detection method provided by another embodiment of the present application. Figure 4 As shown, the loop detection method may include steps S210 to S260.

[0054] Step S210: Obtain the feature map, channel attention map, vector and semantic label map corresponding to the sample image, wherein the channel attention map carries the weight information of each channel of the feature map corresponding to the sample image, and the semantic label map carries the semantic label of each pixel of the sample image.

[0055] Sample images may include search images, positive images, and negative images, wherein a positive image is an image similar to the search image, and a negative image is an image dissimilar to the search image.

[0056] See also Figure 5 , Figure 5 An embodiment of the present application provides Figure 4 Schematic diagram of the process of step S210 in FIG. Step S210 may include steps S211 to S213.

[0057] Step S211: Acquire a sample image.

[0058] In some embodiments, a video captured while a vehicle is in motion can be obtained; images containing landmark information for scene identification can be extracted from the video; and the extracted images are annotated to determine their positions within the driving trajectory and to determine whether they have loop relationships with each other, thereby obtaining sample images. The video can be a video of an urban traffic scene. While the vehicle is in motion, the vehicle can use an onboard camera to record and capture urban traffic scene videos. The captured video is subjected to frame extraction to extract images containing landmark information for scene identification. The landmark information can be a prominent landmark or scene that the vehicle passes through, such as a landmark building. Annotating the images' positions within the driving trajectory and determining whether they have loop relationships with each other facilitates model training. For example, this can help filter search images, positive examples, and negative examples. After annotation, a sample image dataset is obtained, which can be divided into a training set, a validation set, and a test set in a ratio of 7:1:2.

[0059] Step S212: Obtain the feature map, channel attention map and vector corresponding to the sample image.

[0060] See also Figure 1 The scene recognition model consists of a residual neural network (ResNet), a channel-wise attention network (SENet), and a scene recognition layer (NetVLAD layer). During the training phase, sample images are fed into the scene recognition model's ResNet in the form of image pairs: search image, positive image, and negative image. ResNet extracts features from the input image, generating multiple feature maps of varying sizes. It then outputs the feature map from the final convolutional layer (i.e., the feature map corresponding to the sample image) to the SENet and NetVLAD layers.

[0061] SENet performs channel-wise weighting on the feature maps from the last convolutional layer to obtain a channel attention map, which is then fed into the NetVLAD layer. The channel attention map carries the weight information for each channel in the feature map from the last convolutional layer of ResNet. SENet enables the network to automatically learn the weight relationship between channels. SENet uses Global Average Pooling (GAP) to aggregate the feature map information for each channel and obtain a scalar that reflects the global importance of the corresponding channel. This scalar is then mapped to a new weight scalar through two fully connected (FC) layers, which is then used to weight the feature map for that channel, enhancing the expressive power between channels.

[0062] Specifically, SENet includes two operations: compression and activation.

[0063] As shown in expressions (1) and (2), the compression operation F sq (·) Global average pooling is used to encode the large and small feature maps (denoted as u). Global average pooling converts the input of dimension C×H×W into an output (global information) of dimension 1×1×C, and obtains the feature map weight tensor z of dimension 1×1×C.

[0064]

[0065] z=[z1,z2,...,z c ] (2)

[0066] Among them, u represents the tensor in deep learning or C feature maps of size H×W, which is a multidimensional array; u c represents the Cth two-dimensional moment in u; u c (i,j) represents the two-dimensional matrix u c The element in the i-th row and j-th column of the image is represented by u; C represents the number of channels, and H×W represents the size of the feature map. For example, given an input x with C1 feature channels, a series of general transformations such as convolutions yield a feature with C2 channels. Then, u is a multidimensional array with C2 channels. In other words, u is the multidimensional array obtained by convolution of the original image.

[0067] As shown in expression (3), the activation operation F ex (·) Utilize two layers of fully connected operations to learn the nonlinear relationship between feature map channels.

[0068] s=F ex (z,W)=σ(g(z,W))=σ(W2(δ(W1z))) (3)

[0069] Where W1 and W2 correspond to the weights of the two fully connected layers, respectively; δ is the Rectified Linear Unit (ReLU) activation function; and σ is the Sigmoid function, also known as the Logistic function, used for hidden layer neuron outputs. The sigmoid function has a value range of (0, 1) and can map a real number to the interval (0, 1), making it suitable for binary classification. Multiplying the original feature map by the learned weight parameters yields a visual channel attention map.

[0070] As shown in expressions (2) and (3), the compression result is z. First, multiply z by W1, which is a fully connected layer operation. The dimension of W1 is C / r×C. This r is a scaling parameter (for example, 16). The purpose of this parameter is to reduce the number of channels and thus reduce the amount of computation. Since the dimension of z is 1×1×C, the result of W1z is 1×1×C / r. After a ReLU layer, the output dimension remains unchanged. Then, multiply it by W2, which is also a fully connected layer process. The dimension of W2 is C×C / r, so the output dimension is 1×1×C. Finally, pass it through the sigmoid function to obtain s. The dimension of the final s is 1×1×C. s is used to characterize the weights of the C feature maps in u. Moreover, this weight is learned through the previous fully connected layers and nonlinear layers, so end-to-end training can be achieved. The role of the two fully connected layers is to fuse the feature map information of each channel, because the previous compression operation is performed on the feature map of a certain channel.

[0071] The NetVLAD layer combines the feature maps from the last convolutional layer of ResNet with the channel attention map to calculate the vectors corresponding to the lookup image, positive image, and negative image. These vectors are used to represent the image. The NetVLAD layer is an improvement on VLAD. NetVLAD improves on VLAD in two ways: 1) it replaces the K-means clustering algorithm (K-Means) for local feature descriptors with a 1×1 convolution; 2) it replaces hard assignment with soft assignment.

[0072] The NetVLAD layer uses soft assignment, which assigns each data point to multiple clusters. Weights are used to represent the affinity between a data point and each cluster. NetVLAD uses 1×1 convolution instead of K-Means to perform clustering and soft assignment. The results are probabilistically computed using Softmax, ultimately outputting a feature map of dimension k×(H×W), where k represents the number of cluster centers. Each column of the feature map represents the soft assignment weight of a local feature to each cluster center.

[0073]

[0074] As shown in expression (4), Indicates that the local feature d i Assigned to cluster center c j The weight ranges from 0 to 1. The larger the d i with c j The closer the distance is. a is a constant. When a approaches positive infinity, The value is infinitely close to 1 or 0.

[0075] As shown in expression (5), the output of the NetVLAD layer is V(j):

[0076]

[0077] Among them, d i represents the value of the jth dimension of the i-th local feature, c j Represents the value of the j-th dimension of the k-th cluster center. Is an indicator function, indicating whether the i-th local feature belongs to the k-th category. If the local feature d i and the kth cluster center c j Recently, The value of is 1, and the value of other cluster centers ([1…k―1…k+1…k]) is 0. More specifically, the vector V(j) calculates the residual sum of all local features belonging to a certain class and the corresponding cluster center. j 、b j 、c j are all learnable parameters.

[0078] That is to say, by inputting the sample image into the scene recognition model, the feature map, channel attention map and vector corresponding to the sample image can be obtained from the scene recognition model.

[0079] Step S213: Obtain the semantic label map corresponding to the sample image.

[0080] See also Figure 1 During the training phase, sample images are input into PIDNet in the form of image pairs: search images, positive images, and negative images. PIDNet is used to generate semantic label maps corresponding to the search images, positive images, and negative images. Each pixel in each semantic label map has a semantic label (urban traffic environment semantic label), which is used to determine whether the pixel belongs to a certain semantic category, for example, this point belongs to a vehicle. The semantic labels in the semantic label map serve as supervisory signals during the training process, guiding the feature space attention distribution of the feature map.

[0081] As shown in expression (6), PIDNet is a pre-trained semantic segmentation model. Its output matrix S is of size W × H. Each element S(x, y) represents the semantic label of the corresponding pixel (x, y) in the image, and C is a set of semantic categories. The semantic label of each pixel in the image belongs to a certain semantic category.

[0082] S(x,y)

[0083] ∈C(6)

[0084] It can be understood that step S212 and step S213 can be performed in parallel, that is, the same sample image can be input into the scene recognition model and the semantic segmentation model respectively at the same time, so as to obtain the feature map, channel attention map, vector and semantic label map corresponding to the sample image.

[0085] Step S220: Generate an attention heat map corresponding to the sample image based on the feature map and vector corresponding to the sample image, where the attention heat map carries weight information of each channel of the feature map corresponding to the sample image.

[0086] Based on the Grad-CAM model, an attention heat map can be generated according to the feature map and vector output by the last convolutional layer of ResNet. The attention heat map carries the weight information of each channel of the feature map output by the last convolutional layer of ResNet.

[0087] like Figure 2 As shown in the figure, the Grad-CAM model is used to obtain the array of feature maps and attention heat maps output by the last convolutional layer of ResNet, and define the average value of the gradient of the vector to the feature map as the weight of the feature map.

[0088]

[0089] As shown in expression (7), It represents the gradient of the vector O with respect to the value at (x, y) in the k-th channel feature map output by the last convolutional layer of ResNet. According to expression (7), It is to perform back propagation by predicting the scene representation vector O, and then use the gradient of back propagation to the last convolutional layer of ResNet to calculate the importance of each channel k of the feature map on the last convolutional layer of ResNet, and then perform weighted summation of the data of each channel on the last convolutional layer of ResNet by α to obtain the array of feature maps output by the last convolutional layer of ResNet.

[0090] As shown in expression (8), the attention heat map Grad-CAM can be obtained by ReLU activation function c , Grad-CAM can output attention heat map Grad―CAM c .

[0091]

[0092] Step S230: training a scene recognition model based on the channel attention map, vector, semantic label map, and attention heat map corresponding to the sample image.

[0093] See also Figure 6 , Figure 6 An embodiment of the present application provides Figure 4 Schematic diagram of the process of step S230 in FIG. Step S230 may include steps S231 to S235.

[0094] Step S231: Determine a first loss based on the attention heat map and semantic label map corresponding to the sample image.

[0095] In some embodiments, the semantic label map corresponding to the sample image can be segmented into foreground and background to obtain a target semantic label map, which includes two types of labels: foreground labels and background labels; a two-dimensional cross entropy function is used to determine the first loss based on the target semantic label map and the attention heat map corresponding to the sample image.

[0096] As shown in expression (9), the semantic labels of pixels in the semantic label map can be segmented into foreground and background (post-processing) based on prior knowledge, and the urban scene semantic labels can be mapped to two types of labels: foreground and background, to obtain the target semantic label map. The target semantic label map includes two types of labels: foreground labels and background labels.

[0097]

[0098] As shown in expression (10), the binary cross entropy (BCE) function can be used to calculate the first loss (also called semantic feature guided loss) based on the target semantic label map and the attention heat map.

[0099] L guide (x,y)=―(ylog(x)+(1―y)log(1―x)) (10)

[0100] Among them, L guide (x,y) represents the first loss (semantic feature guided loss); x represents the target semantic label map after the semantic label output by PIDNet is processed by foreground and background segmentation; y represents the attention heat map calculated and output by the Grad-CAM model.

[0101] Step S232: Determine a second loss based on the channel attention map and vector corresponding to the sample image.

[0102] In some embodiments, based on the vector corresponding to the sample image, an array corresponding to the sample image is determined, and the array carries the weight information of each channel of the feature map corresponding to the sample image; and a relative entropy function is used to determine the second loss based on the array corresponding to the sample image and the channel attention map.

[0103] Based on the Grad-CAM model, according to the vector corresponding to the sample image, the array of feature maps on the last convolutional layer of ResNet (the array corresponding to the sample image) can be calculated.

[0104] As shown in expression (11), the second loss (also called channel attention loss) is calculated based on the array and channel attention maps using the relative entropy function. Relative entropy, also known as Kullback-Leibler divergence (KL divergence), is used to measure the similarity between the two weight distributions of the array and the channel attention map.

[0105]

[0106] Among them, L attn (y o ,y t ) represents the second loss (channel attention loss); y o Represents the channel attention map calculated and output by SENet; y t Represents the array output by the Grad-CAM model (i.e., the array corresponding to the sample image).

[0107] Step S233: Determine a third loss according to the vector corresponding to the sample image.

[0108] In some embodiments, a distance metric function is used to determine the third loss based on the vector corresponding to the sample image.

[0109] As shown in Expression (12), a distance metric function (e.g., Euclidean distance) can be used to calculate the third loss (also known as the scene recognition triplet loss) based on the vector corresponding to the sample image. By learning a low-dimensional embedding space, the high-dimensional input data is mapped to the low-dimensional embedding space, and by defining a suitable distance metric function, the distinction between different categories and the similarity calculation between similar samples can be achieved.

[0110] L trip (q,p,n)=max(D(q,p)-D(q,n)+α,0) (12)

[0111] Among them, q represents the vector corresponding to the search image; p represents the vector corresponding to the positive image; n represents the vector corresponding to the negative image; α represents the boundary constant, which can be 1; D(x,y) represents the distance between the feature vectors x and y.

[0112] Step S234: Determine the total loss based on the first loss, the second loss, and the third loss.

[0113] In order to better correlate the first to third losses, this application adopts an indefinite loss weight strategy, actively optimizing different loss weights during network training to achieve adaptive adjustment of the optimization step size. For example, the total loss can be calculated according to the following expression:

[0114]

[0115] Among them, L total represents the total loss; w1, w2, w3 represent trainable parameters; L guide Indicates the first loss; L attn Indicates the second loss; indicates the third loss.

[0116] Step S235: training the scene recognition model according to the total loss.

[0117] After each training, the total loss can be differentiated (back propagation), that is, the derivative of expression (13) can be derived to obtain the derivative; the difference between the derivatives obtained in this training and the previous N (N is a positive integer) training times can be compared to see whether it is small; if the difference is small, for example, the derivatives fluctuate around 0.9, it means that there is little point in continuing the training, and the training can be ended at this time; if the difference is large, for example, the derivative of the previous training is 1, and the derivative of this training is 0.9, it means that the model is not stable enough and needs to be continued. At this time, the value of one or more of w1, w2, and w3 can be adjusted to continue the model training.

[0118] For example, the difference between the derivatives obtained in the previous N trainings and the derivatives of this training can be calculated; if all the differences are less than the difference threshold, the model training is terminated; if there is a difference greater than the difference threshold, the value of one or more of w1, w2, and w3 is adjusted, and the model training is continued. Among them, the difference threshold can be set according to demand. w1, w2, and w3 can be manually adjusted by relevant personnel based on experience, or preset rules can be set and w1, w2, and w3 can be adjusted according to the preset rules, or they can be adjusted according to the actual difference comparison results. The step size of each adjustment (i.e., the adjustment amount) can be set in advance according to actual needs. This application does not limit the adjustment method and adjustment step size of w1, w2, and w3.

[0119] Based on steps S210 to S230, the semantic label map output by the semantic segmentation model is used for feature guidance, and combined with the attention heat map, the scene recognition model is end-to-end supervised training is performed. By implicitly guiding the model features, the scene recognition model's attention to the relevant features of the scene (such as urban traffic scenes) is improved, and the interference of time period or seasonal factors and dynamic traffic participants (pedestrians, vehicles) is reduced, so as to achieve accurate perception of the scene, provide a reliable perception prior for the SLAM system, and improve the accuracy and robustness of scene recognition. In addition, model training based on vectors, channel attention maps and attention heat maps can optimize the spatial feature distribution of the model, improve the spatial feature expression ability of the model, enhance the robustness of the model, achieve robust retrieval of similar scenes, and improve the accuracy and robustness of scene recognition. Using a scene recognition model (deep learning model) to learn vectors (global feature representations) from images (i.e., raw data) and converting these images into vector representations with unique semantic information can avoid other redundant calculations, thereby more effectively capturing the semantic features of the image. In addition, there is no need to manually select or design features, so that the scene recognition model can better adapt to image changes in different time periods or seasons, improving the robustness and generalization ability of the global feature representation, thereby improving the accuracy and robustness of loop detection.

[0120] It is understandable that the present application combines the semantic segmentation model and the Grad-CAM model to train the scene recognition model, but in actual application, only the scene recognition model is used to generate the image vector.

[0121] Step S240: Acquire multiple frames of images captured during the vehicle's driving process.

[0122] Step S250: Input the multiple frames of images into a scene recognition model to obtain vectors corresponding to each of the multiple frames of images, wherein the scene recognition model is trained based on a semantic label map and an attention heat map corresponding to the image, the semantic label map carries the semantic label of each pixel of the image, and the attention heat map carries the weight information of each channel of the feature map corresponding to the image.

[0123] Step S260: Determine whether a loop occurs based on the vectors corresponding to the multiple frames of images.

[0124] Based on steps S210 to S260 , the robustness and accuracy of scene recognition and loop detection can be improved.

[0125] See also Figure 7 , Figure 7 FIG2 is a schematic diagram showing the structure of a loop detection device provided by an embodiment of the present application. The loop detection device 100 may include: an image acquisition module 110 , an image processing module 120 , and a loop determination module 130 .

[0126] The image acquisition module 110 is used to acquire multiple frames of images captured during the vehicle's driving process.

[0127] The image processing module 120 is used to input the multiple frames of images into a scene recognition model to obtain vectors corresponding to each of the multiple frames of images, wherein the scene recognition model is trained based on a semantic label map and an attention heat map corresponding to the image, wherein the semantic label map carries the semantic label of each pixel of the image, and the attention heat map carries the weight information of each channel of the feature map corresponding to the image.

[0128] The loop determination module 130 is configured to determine whether a loop occurs based on the vectors corresponding to the multiple frames of images.

[0129] In some embodiments, the loop determination module 130 is further used to obtain a target image from the multiple frames of images based on the vectors corresponding to each of the multiple frames of images, wherein the multiple frames of images include a current image, the current image is an image captured at the current moment, and the similarity between the target image and the current image is less than a similarity threshold and the target image is not adjacent to the current image; and determine whether a loop occurs based on the temporal continuity and number of the target images.

[0130] In some embodiments, the loop determination module 130 is further used to obtain the similarity between the vector corresponding to each frame image in the multiple frames of images and the vector corresponding to the current image; and to filter out images from the multiple frames of images whose similarity is greater than a similarity threshold and which are not adjacent to the current image as target images.

[0131] In some embodiments, the loop determination module 130 is further used to determine the number of images that are consecutively adjacent in time sequence in the target image; if the number is greater than or equal to a number threshold, it is determined that a loop occurs; if the number is less than the number threshold, it is determined that no loop occurs.

[0132] In some embodiments, the loop detection module 130 is further used to obtain the similarity between the vectors of the current image and other images in the multiple frames of images; screen out images whose similarity is greater than a similarity threshold and are not adjacent to the current image as target images; sort the target images in chronological order; if the number of consecutive adjacent images in the sorted target images is greater than or equal to the number threshold, it is determined that a loop occurs; if the number of consecutive adjacent images in the sorted target images is less than the number threshold, it is determined that no loop occurs.

[0133] In some embodiments, the loop detection device 100 may further include a model training module, which is used to obtain the feature map, channel attention map, vector and semantic label map corresponding to the sample image, where the channel attention map carries the weight information of each channel of the feature map corresponding to the sample image, and the semantic label map carries the semantic label of each pixel of the sample image; based on the feature map and vector corresponding to the sample image, an attention heat map corresponding to the sample image is generated, where the attention heat map carries the weight information of each channel of the feature map corresponding to the sample image; and based on the channel attention map, vector, semantic label map and attention heat map corresponding to the sample image, a scene recognition model is trained.

[0134] In some embodiments, the model training module is further used to determine a first loss based on the attention heat map and semantic label map corresponding to the sample image; determine a second loss based on the channel attention map and vector corresponding to the sample image; determine a third loss based on the vector corresponding to the sample image; determine a total loss based on the first loss, the second loss, and the third loss; and train the scene recognition model based on the total loss.

[0135] In some embodiments, the model training module is also used to perform foreground and background segmentation on the semantic label map corresponding to the sample image to obtain a target semantic label map, which includes two types of labels: foreground labels and background labels; and a two-dimensional cross entropy function is used to determine the first loss based on the target semantic label map and the attention heat map corresponding to the sample image.

[0136] In some embodiments, the model training module is also used to determine the array corresponding to the sample image based on the vector corresponding to the sample image, where the array carries the weight information of each channel of the feature map corresponding to the sample image; and use the relative entropy function to determine the second loss based on the array corresponding to the sample image and the channel attention map.

[0137] In some embodiments, the model training module is further used to determine the third loss based on the vector corresponding to the sample image using a distance metric function.

[0138] In some embodiments, the model training module is further configured to calculate the total loss according to the following expression:

[0139]

[0140] Among them, L total represents the total loss; w1, w2, w3 represent trainable parameters; L guide Indicates the first loss; L attn Indicates the second loss; indicates the third loss.

[0141] In some embodiments, the model training module is also used to obtain videos taken while the vehicle is driving; extract images with landmark information for identifying the scene from the video; and annotate the extracted images with the positions of the images in the driving trajectory and whether the images have a loop relationship with each other to obtain sample images.

[0142] Those skilled in the art can clearly understand that the above devices provided in the embodiments of the present application can implement the methods provided in the embodiments of the present application. The specific working processes of the above-described devices and modules can refer to the corresponding processes of the methods in the embodiments of the present application, which will not be repeated here.

[0143] In the embodiments provided in the present application, the coupling, direct coupling or communication connection between the modules shown or discussed may be an indirect coupling or communication coupling through some interfaces, devices or modules, and may be electrical, mechanical or other forms, and the embodiments of the present application do not impose specific limitations on this.

[0144] In addition, the functional modules in the embodiments of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into a single module. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional modules.

[0145] See also Figure 8 , Figure 8 A schematic diagram of the structure of a vehicle provided by an embodiment of the present application is shown. The vehicle 200 may include a memory 210 and a processor 220. The memory 210 stores an application program, which is configured to execute a loop detection method when called by the processor 220.

[0146] Processor 220 may include one or more processing cores. Processor 220 utilizes various interfaces and lines to connect to various components within vehicle 200 and is used to run or execute instructions, programs, code sets, or instruction sets stored in memory 210, as well as to call and execute data stored in memory 210, perform various functions of vehicle 200, and process data.

[0147] The processor 220 can be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA). The processor 220 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to handle wireless communications. It is understandable that the above-mentioned modem may not be integrated into the processor 220, but may be implemented separately through a communication chip.

[0148] The memory 210 may include random access memory (RAM) or read-only memory (ROM). The memory 210 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 210 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the various method embodiments described above, and the like. The data storage area may store data generated by the vehicle 200 during use.

[0149] An embodiment of the present application also provides a computer-readable storage medium, which stores program code. When the program code is called by a processor, a model training method or a loop detection method is executed.

[0150] The computer-readable storage medium may be an electronic memory such as a flash memory, an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a hard disk, or a ROM.

[0151] In some embodiments, the computer-readable storage medium includes a non-volatile computer-readable medium (Non-Transitory Computer-Readable Storage Medium, referred to as Non-TCRSM). The computer-readable storage medium has storage space for program codes that execute any method step in the above method. These program codes can be read from or written into one or more computer program products. The program code can be compressed in an appropriate form.

[0152] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements 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 the present application.

Claims

1. A loop detection method, characterized in that: include: Acquire multiple frames of images captured during the vehicle's driving process; Input the multiple frames of images into a scene recognition model to obtain vectors corresponding to the multiple frames of images, wherein the scene recognition model is trained according to a semantic label map and an attention heat map corresponding to the image, the semantic label map carries the semantic label of each pixel of the image, and the attention heat map carries the weight information of each channel of the feature map corresponding to the image; Whether a loop occurs is determined according to the vectors corresponding to the multiple frames of images.

2. The method according to claim 1, characterized in that The determining whether a loop occurs according to the vectors corresponding to the multiple frames of images respectively includes: Acquire a target image from the multiple frames of images according to the vectors corresponding to each of the multiple frames of images, wherein the multiple frames of images include a current image, the current image is an image captured at a current moment, and the similarity between the target image and the current image is less than a similarity threshold and the target image is not adjacent to the current image; Whether a loop occurs is determined according to the temporal continuity and quantity of the target images.

3. The method according to claim 2, characterized in that The step of acquiring a target image from the multiple frames of images according to the vectors corresponding to the multiple frames of images respectively includes: Obtaining the similarity between the vector corresponding to each frame of the multiple frames of images and the vector corresponding to the current image; An image whose similarity is greater than a similarity threshold and is not adjacent to the current image is selected from the multiple frames of images as a target image.

4. The method according to claim 2, characterized in that: The determining whether a loop occurs according to the temporal continuity and quantity of the target image includes: Determining the number of images that are consecutively adjacent in time sequence in the target image; If the number is greater than or equal to the number threshold, it is determined that a loop occurs; If the number is less than the number threshold, it is determined that no loop occurs.

5. The method according to any one of claims 1 to 4, characterized in that: Before acquiring the multiple frames of images captured during the vehicle driving process, the method further includes: Obtain a feature map, a channel attention map, a vector, and a semantic label map corresponding to the sample image, wherein the channel attention map carries weight information of each channel of the feature map corresponding to the sample image, and the semantic label map carries a semantic label of each pixel of the sample image; Generate an attention heat map corresponding to the sample image according to the feature map and the vector corresponding to the sample image, where the attention heat map carries weight information of each channel of the feature map corresponding to the sample image; The scene recognition model is trained according to the channel attention map, vector, semantic label map and attention heat map corresponding to the sample image.

6. The method according to claim 5, characterized in that The training of the scene recognition model according to the channel attention map, vector, semantic label map and attention heat map corresponding to the sample image includes: Determining a first loss according to an attention heat map and a semantic label map corresponding to the sample image; Determine a second loss according to the channel attention map and the vector corresponding to the sample image; Determining a third loss according to the vector corresponding to the sample image; determining a total loss according to the first loss, the second loss, and the third loss; The scene recognition model is trained according to the total loss.

7. The method according to claim 6, characterized in that The determining of the first loss according to the attention heat map and the semantic label map corresponding to the sample image includes: Performing foreground and background segmentation on the semantic label map corresponding to the sample image to obtain a target semantic label map, wherein the target semantic label map includes two types of labels: a foreground label and a background label; A second dimension cross entropy function is used to determine a first loss according to the target semantic label map and the attention heat map corresponding to the sample image.

8. The method according to claim 6, characterized in that The determining the second loss according to the channel attention map and the vector corresponding to the sample image includes: According to the vector corresponding to the sample image, determine the array corresponding to the sample image, where the array carries the weight information of each channel of the feature map corresponding to the sample image; A relative entropy function is used to determine the second loss according to the array corresponding to the sample image and the channel attention map.

9. The method according to claim 6, characterized in that The determining the third loss according to the vector corresponding to the sample image includes: A distance metric function is used to determine a third loss according to a vector corresponding to the sample image.

10. The method according to claim 6, characterized in that The determining of the total loss according to the first loss, the second loss, and the third loss comprises: The total loss is calculated as follows: Among them, L total represents the total loss; w1, w2, w3 represent trainable parameters; L guide Indicates the first loss; L attn Indicates the second loss; L trip Indicates the third loss.

11. The method according to claim 3, characterized in that Before obtaining the feature map, channel attention map, vector and semantic label map corresponding to the sample image, the method further includes: Obtain the video taken by the vehicle while driving; extracting an image having landmark information for identifying a scene from the video; For the extracted images, the positions of the images in the driving trajectory and whether there are loop relationships between the images are marked to obtain sample images.

12. A loop detection device, characterized in that: include: An image acquisition module is used to acquire multiple frames of images captured during the driving process of the vehicle; An image processing module, used for inputting the multiple frames of images into a scene recognition model to obtain vectors corresponding to the multiple frames of images, wherein the scene recognition model is trained according to a semantic label map and an attention heat map corresponding to the image, the semantic label map carries the semantic label of each pixel of the image, and the attention heat map carries the weight information of each channel of the feature map corresponding to the image; The loop determination module is used to determine whether a loop occurs according to the vectors corresponding to each of the multiple frames of images.

13. A vehicle, characterized in that: include: A memory and a processor, wherein an application is stored in the memory, and when the processor calls the application, the method according to any one of claims 1 to 11 is executed.

14. A computer-readable storage medium, characterized in that: include: The computer-readable storage medium stores program codes, and when the processor calls the program codes, the method according to any one of claims 1 to 11 is executed.

Citation Information

Patent Citations

  • Mobile robot loopback detection method based on deep learning

    CN113781563A

  • Loopback detection and optimization method based on second-order attention mechanism

    CN114926742A

  • Vehicle detection method for guiding spatial attention based on road semantic information

    CN117830965A