Cross-modal site identification method based on efficient self-attention
By introducing efficient self-attention modules and color contrast features into cross-modal visual place recognition, the efficiency problem in difference processing between RGB images and infrared images is solved, faster and more accurate place recognition is achieved, and visual place recognition technology is promoted. progress.
Patent Information
- Application Number
- CN202410817613.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-09-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing cross-modal visual place recognition methods are not effective in handling the differences between RGB images and infrared images, and the feature matching speed is slow, which limits the improvement of overall performance.
A cross-modal place recognition method based on efficient self-attention is adopted, by inputting RGB images and infrared images into a dual-stream network, extracting image salient features, and performing high-dimensional feature mapping and local shared feature processing in the ResNet50 network, combined with color Contrast and efficient self-attention module EMSA realizes feature fusion and collaborative constraints.
Without losing accuracy, it significantly improves the speed of feature matching in location recognition tasks, achieves faster and more accurate location recognition in complex environments, and improves the accuracy and efficiency of the entire network.
Smart Images

Figure CN118628997A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a cross-modal place recognition method based on efficient self-attention. Background Art
[0002] Visual Place Recognition (VPR) is a highly advanced technology that is mainly used to assist robots or visual navigation systems to accurately determine whether they are in a previously visited location. VPR uses images captured by cameras for intelligent recognition to achieve accurate location positioning. In visual simultaneous localization and mapping (SLAM) systems, VPR plays a key role, not only for relocalization, but also for effective map reuse and loop correction. Numerous technological innovations and developments have made significant progress in the field of visual place recognition (VPR). However, the VPR task still faces a series of challenges, especially the significance of intra-class differences between images, which is mainly caused by changes in appearance and perspective. Although many studies have proposed solutions to these challenges, most studies have not fully considered the impact of illumination changes.
[0003] When faced with the challenge of changing lighting conditions, the robot adopts a flexible hardware solution to adapt to different environments; in high-light environments, the robot uses RGB cameras for image acquisition; in low-light conditions, it switches to infrared cameras. The main goal of cross-modal visual place recognition with visible and infrared light (VI-VPR) is to capture images of places from cameras of different modalities and determine their locations based on them. The uniqueness of this approach is that its query set and gallery set contain images from different modalities, which effectively overcomes the limitations caused by lighting conditions. However, compared with traditional single-modal place location recognition, VI-VPR faces unique challenges, especially when dealing with cross-modal differences between RGB images and infrared images. There are significant differences between infrared and visible light images, which makes existing place recognition methods less effective when dealing with multimodal recognition problems; there is also a major disadvantage of slow feature matching, which limits the overall performance improvement. Summary of the invention
[0004] Purpose of the invention: In order to overcome the shortcomings of the prior art, the present invention provides a cross-modal place recognition method based on efficient self-attention, proposes an efficient self-attention method, and integrates pixel color contrast as a key factor into the network, thereby improving the feature matching speed in the place recognition task without losing accuracy.
[0005] Technical solution: To achieve the above purpose, a cross-modal place recognition method based on efficient self-attention includes the following steps:
[0006] Step 1: Input the RGB image and infrared image into the two-stream network;
[0007] Step 2: quantize the input image, calculate the color distance between the RGB image and the infrared image, and the color distance between the image before and after quantization of each modality, and use the color contrast method to extract the image's salient features;
[0008] Step 3: Input the image into the ResNet50 network to extract unique features from the image of each modality;
[0009] Step 4: The features output by the third stage of the ResNet50 network are mapped to high-dimensional features by the high-dimensional feature mapping module, and the final overall features are output;
[0010] Step 5: Perform image block processing on the features output by the third stage of the ResNet50 network to obtain local shared features, and process the local shared features through the efficient self-attention module EMSA to output local features;
[0011] Step 6: Fusing the image salient features obtained in step 2 and the local features obtained in step 5 to obtain the final local features;
[0012] Step 7: Perform collaborative constraints on the final global features and the final local features;
[0013] Step 8: If the specified number of training rounds is reached, the training is terminated to obtain a cross-modal place recognition model based on an efficient self-attention mechanism; otherwise, return to step 1 to continue training.
[0014] Furthermore, assuming that there are n RGB location images and m infrared location images, the samples of RGB mode are represented as The infrared modal sample is represented as in, represents the i-th RGB location image, represents the jth infrared location image, and Respectively and corresponding landmarks;
[0015] In the step 2, the image is defined as:
[0016] I(x,y)={I L (x,y),I a (x,y),I b (x,y)}
[0017] After normalization, 0≤I L (x,y),Ia (x,y),I b (x,y)≤1;
[0018] Perform quantization on the input RGB image and infrared image to obtain two quantized color images f i and g i , the color distance d is used to evaluate the two quantized color images f i and g i The difference between them, the color distance d is expressed as:
[0019]
[0020] In the formula, L represents the brightness of the image, a represents the component from green to red, and b represents the component from blue to yellow. Furthermore, let the number of colors in the color palette after color quantization be K, and find K colors in the color space:
[0021] (C 1L ,C 1a ,C 1b ),(C 2L ,C 2a ,C 2b ),…,(C KL ,C Ka ,C Kb )
[0022] Where, 0≤C KL ,C Ka ,C Kb ≤1;
[0023] Calculate the RGB image before quantization and the image g after quantization i The color distance of the infrared image before and after quantization is calculated. i The color distance; Taking the color image as an example, the image before quantization And the quantized image g i The color distance d satisfies the formula:
[0024]
[0025] In the formula, 1≤x≤W, 1≤y≤H, 1≤j≤K, W, H are the width and height of the image; after quantization, The quantified result is processed using the color contrast method to obtain the significant features of each pixel color in the image.
[0026] Furthermore, we choose to use the Lab color space to calculate the color contrast. By comparing the color of a specific pixel with the colors of other pixels in the image, we can quantify the saliency of the pixel. We get the saliency value of each pixel color in the image. Let an element in the image be Then the significance value is:
[0027]
[0028] Since the image has been color quantized, the color of each pixel is determined by the color histogram features of the image, from which the corresponding quantized color value is obtained; the proposed optimization method only needs to calculate the saliency value associated with the color corresponding to each pixel to obtain the optimized saliency value:
[0029]
[0030] In the formula, c l is the quantized color value of pixel M, f j For color c l The frequency of occurrence in the image, α j For color c l The quantitative value of , K is the number of quantified colors;
[0031] The image salient features in the image are extracted based on the saliency value associated with each pixel in the image and the color corresponding to each pixel.
[0032] Furthermore, in step 5, the features output in the third stage of the ResNet50 network are and Extract local shared features in the form of feature blocks and Local shared features and The local features are obtained through the efficient attention module EMSA
[0033] Let F be one of the overall feature candidate descriptors:
[0034]
[0035] In the formula, C, H, and W represent the three dimensions of channel, height, and width respectively. A set of stride S is extracted from F. p The size is d x ×d y Patch-level features {P i , x i ,y i}, the total number of patch-level features is:
[0036]
[0037] Where P i represents the patch-level feature set, (x i ,y i ) represents the coordinates of the center of the patch-level feature on the feature map;
[0038] The efficient attention module EMSA i Perform convolution operation to get Q, and convert P i Let x be the two-dimensional input label Reshaped into a three-dimensional marker along the spatial dimension And input to the depth convolution operation to reduce the height H and width W dimensions; s is the reduction factor, s is set adaptively according to the feature map size or the number of stages, the kernel size, stride and padding are s+1, s and s / 2 respectively; the new label mapping after spatial reduction is reshaped into a two-dimensional mark, Where n' = h / s × w / s; is fed into two sets of projection operations to obtain the key K and value V.
[0039] Furthermore, the EMSA equation is used to calculate the attention function on the query Q, key K and value V; the EMSA equation is as follows:
[0040]
[0041] Where Conv(·) represents a standard 1×1 convolution operation, which is used to simulate the interaction between different attention heads;
[0042] The setting of the efficient attention module EMSA enables the function of each attention head to depend on all keys and queries at the same time; instance normalization is introduced in the dot product matrix after applying the Softmax function, marked as IN(·); the output values of each head are connected and linearly projected to form the final output.
[0043] Furthermore, the EMSA equation calculates the value of the cost S t yes:
[0044]
[0045] Furthermore, in step six, the saliency map extracted in step two is And the local features obtained in step 5 Perform feature fusion to obtain the image saliency map M of the fused color features:
[0046]
[0047] The above formula is to measure the value of a certain pixel I k The two significant values S(I k ) and m(I k ) between the two.
[0048] Beneficial effects: The present invention adopts a cross-modal place recognition method based on efficient self-attention, which integrates pixel color contrast into the network as a key factor, and successfully solves the problem of slow feature matching speed in place recognition tasks without losing accuracy; proposes a cross-modal model EMSA based on an efficient self-attention module. Through the application of this method, place recognition tasks in complex environments can be completed faster and more accurately, which significantly promotes the progress of visual place recognition technology; and selects a K-Means clustering quantization method with lower image distortion; improves the accuracy and efficiency of the entire network place recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Attached Figure 1 Flowchart for training a cross-modal place recognition model based on an efficient self-attention mechanism;
[0050] Attached Figure 2 Schematic diagram of the efficient attention EMSA model;
[0051] Attached Figure 3 Schematic diagram of the extraction process of RGB image saliency map S(I);
[0052] Attached Figure 4 Schematic diagram of the RGB image saliency map M(I) extraction process. DETAILED DESCRIPTION
[0053] The present invention will be further described below in conjunction with the accompanying drawings.
[0054] As attached Figure 1 As shown, a cross-modal place recognition method based on efficient self-attention includes the following steps:
[0055] Step 1: Input the RGB image and infrared image into the two-stream network;
[0056] Step 2: quantize the input image, calculate the color distance between the RGB image and the infrared image, and the color distance between the image before and after quantization of each modality, and use the color contrast method to extract the image's salient features;
[0057] Step 3: Input the image into the ResNet50 network to accurately extract unique features from the image of each modality;
[0058] Step 4: The features output by the third stage of the ResNet50 network are mapped to high-dimensional features by the high-dimensional feature mapping module, and the final overall features are output;
[0059] Step 5: Perform image block processing on the features output by the third stage of the ResNet50 network to obtain local shared features, and process the local shared features through the efficient self-attention module EMSA to output local features;
[0060] Step 6: Fusing the image salient features obtained in step 2 and the local features obtained in step 5 to obtain the final local features;
[0061] Step 7: Perform collaborative constraints on the final global features and the final local features;
[0062] Step 8: If the specified number of training rounds is reached, the training is terminated to obtain a cross-modal place recognition model based on an efficient self-attention mechanism, and the location is accurately recognized based on the obtained model; otherwise, return to step 1 to continue training.
[0063] There is also a step between step six and step seven, which is to fuse the features of the fourth stage of the ResNet50 network and the final overall features through a high-dimensional intra-modal feature aggregation module to constrain the overall features.
[0064] As attached Figure 3 As shown, suppose there are n RGB location images and m infrared location images, and the samples of RGB mode are represented as The infrared modal sample is represented as in, represents the i-th RGB location image, represents the jth infrared location image, and Respectively and The corresponding landmark; RGB images are composed of three primary colors: red, green, and blue, and contain three channels, while infrared images exist in the form of a single channel; Since the number of channels of infrared location images is 1, in the data preprocessing stage, the strategy of filling the same value is used to expand it into three channels, so as to keep the number of channels consistent with the RGB location image, which is convenient for subsequent model training; In step 1, input an RGB modal sample and an infrared modality sample
[0065] In the step 2, the extraction of image color features in the Lab color space is considered, and the image is defined as:
[0066] I(x,y)={I L (x,y),Ia (x,y),I b (x,y)}
[0067] After normalization, 0≤I L (x,y),I a (x,y),I b (x,y)≤1; the RGB image is defined as consisting of the image brightness L, the green to red component a, and the blue with yellow component b; similarly, the infrared image is defined as consisting of the image brightness L, the green to red component a, and the blue with yellow component b.
[0068] As attached Figure 3 As shown in the figure, the input RGB image and infrared image are quantized. The K-Means method is used to quantize the input image, and the two quantized color images f are obtained. i and g i , f i Originally, it was an infrared image, but after image preprocessing, it has been converted to a three-channel format and is therefore also considered a color image. K-Means is a popular color quantization technique that is implemented by dividing the color space into multiple clusters, each representing a specific color. The color quantization result using the K-Means method is almost visually indistinguishable from the original image, and does not produce color distortion. The color distance d is used to evaluate the two color images f after quantization. i and g i The difference between them, the color distance d is expressed as:
[0069]
[0070] Where L represents the brightness of the image, a represents the component from green to red, and b represents the component from blue to yellow.
[0071] Assume that the number of colors in the color palette after color quantization is K, find K colors in the color space, and record the brightness L of each color, the component a from green to red, and the component b from blue to yellow:
[0072] (C 1L ,C 1a ,C 1b ),(C 2L ,C 2a ,C 2b ),...,(C KL ,C Ka ,C Kb )
[0073] Where, 0≤C KL ,C Ka ,C Kb ≤1;
[0074] As attached Figure 3 As shown, the RGB image before quantization and the image after quantization g are calculated i The color distance of the infrared image before and after quantization is calculated. i The color distance; Taking the color image as an example, the image before quantization And the quantized image g i The color distance d satisfies the formula:
[0075]
[0076] In the formula, 1≤x≤W, 1≤y≤H, 1≤j≤K, W, H are the width and height of the image; after quantization, The quantified result is processed using the color contrast method to obtain the significant features of each pixel color in the image.
[0077] As attached Figure 3 As shown in Figure 1, the Lab color space is chosen to calculate color contrast. By comparing the color of a specific pixel with the colors of other pixels in the image, the prominence of the pixel is quantified. The Lab color space is particularly suitable for such calculations because it can more accurately depict color brightness and color differences. The Lab color space method not only provides quantitative analysis of color contrast, but also effectively reveals significant features in the image, providing important information for image processing and analysis. Then, the prominence value of each pixel color in the image is obtained. Suppose an element in the image is Then the significance value is:
[0078]
[0079] When processing an image, if the saliency value of each pixel is calculated separately, the execution efficiency of the algorithm will be significantly reduced. Considering that the image has been color quantized, the color of each pixel is determined by the color histogram features of the image, and the corresponding quantized color value is obtained from it; the optimization method is proposed to optimize the above processing flow, and only the saliency value related to the color corresponding to each pixel needs to be calculated, thereby greatly reducing repeated calculations and obtaining the optimized saliency value:
[0080]
[0081] In the formula, c l is the quantized color value of pixel M, f j For color c l The frequency of occurrence in the image, α j For color c l The quantitative value of , K is the number of quantified colors;
[0082] According to the saliency value of each pixel in the image and the color corresponding to each pixel, the image saliency features in the image are extracted; taking RGB image as an example, the extraction process of saliency map S(I) based on color contrast is shown in the attached figure. Figure 3 shown.
[0083] As attached Figure 2 As shown, in step 5, the features output in the third stage of the ResNet50 network are and Extract local shared features in the form of feature blocks and Local shared features and The local features are obtained through the efficient attention module EMSA
[0084] Let F be one of the overall feature candidate descriptors:
[0085]
[0086] In the formula, C, H, and W represent the three dimensions of channel, height, and width respectively. A set of stride S is extracted from F. p The size is d x ×d y Patch-level features {P i ,x i ,y i}, the total number of patch-level features is:
[0087]
[0088] Where P i represents the patch-level feature set, (x i ,y i ) represents the coordinates of the center of the patch-level feature on the feature map;
[0089] As attached Figure 2 As shown in the figure, the initial efficient attention module EMSA operation is the same as the multi-head self-attention MSA, and the convolution operation is performed to obtain Q, that is, the efficient attention module EMSA converts P i Perform convolution operation to get Q; in order to compress memory, P i Let x be the two-dimensional input label Reshaped into a three-dimensional marker along the spatial dimension And input to the depth convolution operation to reduce the height H and width W dimensions; s is the reduction factor, s is adaptively set according to the feature map size or the number of stages, the kernel size, stride and padding are s+1, s and s / 2 respectively; the new label mapping after spatial reduction is reshaped into a two-dimensional mark, where n' = h / s x w / s; then is fed into two sets of projection operations to obtain the key K and value V.
[0090] The EMSA equation is used to calculate the attention function on the query Q, key K and value V; the EMSA equation is as follows:
[0091]
[0092] Where Conv(·) represents a standard 1×1 convolution operation, which mainly simulates the interaction between different attention heads;
[0093] The setting of the above efficient attention module EMSA is designed so that the function of each attention head can depend on all keys and queries at the same time. This method may weaken the ability of the multi-head self-attention MSA mechanism to simultaneously process diverse representation subsets from different positions to some extent. In order to make up for this deficiency and restore the diversity among heads, instance normalization is introduced in the dot product matrix after applying the Softmax function, marked as IN(·), which not only improves the sensitivity of the model to different feature subsets, but also enhances the overall attention distribution, effectively balancing the concentration and dispersion of the attention mechanism. Finally, the output values of each head are connected and linearly projected to form the final output.
[0094] The EMSA equation calculates the value of cost S t yes:
[0095]
[0096] Assuming s > 1, the computational cost of EMSA is much lower than that of the original MSA, especially at lower stages where s is usually higher.
[0097] As attached Figure 4 As shown, in step six, the saliency map extracted in step two is And the local features obtained in step 5 Perform feature fusion to obtain the image saliency map M of the fused color features; calculate the image pixel saliency value S(I k ) and m(I k ), the residual value between the two saliency maps is used to evaluate the consistency between the two saliency maps; through this method, a more accurate image saliency map M that integrates color features can be obtained. k The two image saliency values S(I k ) and m(I k ) The image saliency map obtained by fusion is shown as follows:
[0098]
[0099] The above formula is to measure the value of a certain pixel I k The two significant values S(I k ) and m(I k ) between the two significant values; when the two significant values of a pixel are similar, it indicates that the pixel is significant from both the perspective of high-level features based on deep learning and the perspective of low-level features of the image based on color information; the significant value after fusion processing will be close to 1, reflecting a high degree of significance; the feature fusion diagram is shown in the attached figure Figure 4 shown.
[0100] The testing process of the cross-modal place recognition model based on the efficient self-attention mechanism:
[0101] S1, input query dataset and gallery dataset, and enter S2;
[0102] S2: Using the trained model, perform overall feature extraction and local feature extraction on all location images of the query dataset and gallery dataset input in S1, and enter S3;
[0103] S3: perform similarity matching between the overall features of the query dataset and the overall features of the gallery dataset, and proceed to S4;
[0104] S4: The candidate ranking is obtained by matching the overall features, and then re-ranked by local features, and then enters S5;
[0105] S5: According to the similarity, the matching result of each location image in the query data set and the library data set is obtained, and then S6 is entered;
[0106] S6: Calculate the model size and the inference time of feature matching, and end.
[0107] The query data set in step S1 of the test process represents the location images to be queried, and the gallery data set represents the set of location images to be matched by the query set; in step S5 of the test process, each image in the query data set will be matched with several images in the gallery set. The present invention uses the Recall@N curve to evaluate the performance index of the location recognition algorithm, and uses M and ms as units to evaluate the model size and inference time of the EMSA proposed by the present invention.
[0108] The common evaluation criteria for accuracy are Top-1, Top-5, Top-10, etc.; the present invention trains and evaluates the model on the public dataset KAIST, which is widely used in cross-modal place recognition tasks; compared with the existing SCHAL-Net technology, in the mode where the infrared image queries the RGB image with a threshold of 10 meters, the accuracy of the present invention is improved by 1.8% in Top-10; and in the mode where the RGB image queries the infrared image with a threshold of 10 meters, the accuracy of the present invention is improved by 1.5% and 1.7% in Top-1 and Top-10 respectively. In terms of model size, the model proposed by the present invention is 1M smaller than the SCHAL-Net technology, and the inference time is improved by 7ms; overall, the accuracy is higher than the existing SCHAL-Net technology, and the recognition efficiency of place recognition is improved while ensuring the accuracy.
[0109] Example
[0110] To evaluate the performance of the proposed network model, the present invention trained and evaluated the model on the well-known public dataset KAIST, which is widely used in cross-modal place recognition tasks; the present invention's experiments evaluated the two retrieval modes of RGB image retrieval of infrared images and infrared image retrieval of RGB images; for the sake of fairness, various baseline methods were selected for comparison to verify the effectiveness of the EMSA model of the present invention. The cross-modal place recognition algorithm proposed in the present invention is compared with several other algorithms, including the performance results of SCHAL-Net algorithm, DOLG, Patch-NetVLAD, MixVPR, etc. on the KAIST public dataset; in order to comprehensively evaluate these algorithms, the present invention uses Recall@N as the evaluation index, where the values of N are 1, 5 and 10 respectively; as shown in Table 1 below:
[0111] Table 1 Experimental results of the present invention compared with the existing algorithms in the KAIST dataset when the threshold is 10 meters
[0112]
[0113] Through comparative experiments, the place recognition algorithm proposed in the present invention performs particularly well on the KAIST dataset, and is significantly better than the original algorithm model in the scenarios of RGB images querying infrared images or infrared images querying RGB images. Specifically, in the case of RGB images querying infrared images, the maximum improvement in Top-5 recall rate can be observed, reaching 1.9%; and in the scenario of infrared images querying RGB images, the improvement in Top-1 recall rate is the most significant, reaching 1.5%. This fully proves the effectiveness and superiority of the improved algorithm model of the present invention.
[0114] The algorithm proposed in this paper is subjected to a detailed comparative analysis, with particular attention paid to the running efficiency and model size, and compared with other existing methods; in order to ensure the fairness of the comparison, all experiments are carried out under the same hardware configuration; as shown in Table 2 below
[0115] Table 2 Comparison of operating efficiency and model size between the present invention and different algorithms
[0116]
[0117]
[0118] According to the data shown in Table 3, it can be clearly seen that the algorithm proposed in the present invention has significant improvements in model size and reasoning time compared with the original model; this progress is mainly due to the optimization effect brought by the proposed attention algorithm. Compared with other currently popular place recognition algorithms, the improved algorithm model of the present invention also shows obvious superiority in model volume and reasoning speed. Specifically, compared with DOLG, the EMSA model reduces about 2M in memory and saves about 5ms in reasoning time. When the EMSA algorithm is compared with the MixVPR algorithm, which performs best in recognition effect, the EMSA model size is about half of that, while the reasoning time is 16 milliseconds faster; the results not only highlight the efficiency of the algorithm proposed in the present invention, but also highlight its significant advantages in saving resources and improving running speed, which is of great significance for the deployment of algorithms in practical application scenarios. In general, the algorithm proposed in the present invention not only performs well in performance, but also shows an excellent balance in terms of operating efficiency and resource consumption.
[0119] Based on the present invention, an implementation scenario is proposed, in which a city security monitoring system automatically analyzes activities on the street through location recognition technology so as to respond to potential security threats in a timely manner; including:
[0120] Install high-resolution surveillance color and infrared cameras in key areas to ensure that activities in the area can be clearly captured; configure the connection between the cameras and the central monitoring system so that video data can be transmitted and analyzed in real time. Integrate location recognition technology into the monitoring system; may include configuring image recognition software to analyze images captured by the camera; the system needs to be "learned" or "trained" first to recognize routine activities and potential abnormal behaviors in specific scenes. The system analyzes real-time video to identify and track individuals moving in the monitoring area; uses location recognition technology to analyze individual behavior patterns, such as walking routes, dwell time, and interactions with other individuals. The system then identifies any abnormal or suspicious behavior, such as unauthorized intrusions, abnormal gatherings, or potential criminal activities, based on preset security parameters; the system can improve the accuracy of identifying abnormal behavior by learning from historical data. Finally, once abnormal behavior is identified, the system will automatically send an alert to security personnel, with relevant video clips and specific location information.
[0121] The above is only a description of the preferred embodiments of the present invention. Ordinary technicians in this technical field can make several modifications and optimizations based on the above disclosure without departing from the above basic principles. These improvements and optimizations should be regarded as the understood protection scope of the present invention.
Claims
1. A cross-modal place recognition method based on efficient self-attention, characterized by: The following steps are involved: Step 1: Input the RGB image and infrared image into the two-stream network; Step 2: quantize the input image, calculate the color distance between the RGB image and the infrared image, and the color distance between the image before and after quantization of each modality, and use the color contrast method to extract the image's salient features; Step 3: Input the image into the ResNet50 network to extract unique features from the image of each modality; Step 4: The features output by the third stage of the ResNet50 network are mapped to high-dimensional features by the high-dimensional feature mapping module, and the final overall features are output; Step 5: Perform image block processing on the features output by the third stage of the ResNet50 network to obtain local shared features, and process the local shared features through the efficient self-attention module EMSA to output local features; Step 6: Fusing the image salient features obtained in step 2 and the local features obtained in step 5 to obtain the final local features; Step 7: Perform collaborative constraints on the final global features and the final local features; Step 8: If the specified number of training rounds is reached, the training is terminated to obtain a cross-modal place recognition model based on an efficient self-attention mechanism; otherwise, return to step 1 to continue training.
2. The cross-modal place recognition method based on efficient self-attention according to claim 1, characterized in that: Assume that there are n RGB location images and m infrared location images, and the samples of RGB mode are represented as The infrared modal sample is represented as in, represents the i-th RGB location image, represents the jth infrared location image, and Respectively and corresponding landmarks; In the step 2, the image is defined as: I(x,y)={I L (x,y),I a (x,y),I b (x,y)} After normalization, 0≤I L (x,y),I a (x,y),I b (x,y)≤1; Perform quantization on the input RGB image and infrared image to obtain two quantized color images f i and g i , the color distance d is used to evaluate the two quantized color images f i and g i The difference between them, the color distance d is expressed as: Where L represents the brightness of the image, a represents the component from green to red, and b represents the component from blue to yellow.
3. The cross-modal place recognition method based on efficient self-attention according to claim 2, characterized in that: Assume that the number of colors in the palette after color quantization is K, and find K colors in the color space: (C 1L ,C 1a ,C 1b ),(C 2L ,C 2a ,C 2b ),...,(C KL ,C Ka ,C Kb ) Where, 0≤C KL ,C Ka ,C Kb ≤1; Calculate the RGB image before quantization and the image g after quantization i The color distance of the infrared image before and after quantization is calculated. i The color distance; Taking the color image as an example, the image before quantization And the quantized image g i The color distance d satisfies the formula: In the formula, 1≤x≤W, 1≤y≤H, 1≤j≤K, W, H are the width and height of the image; after quantization, The quantified result is processed using the color contrast method to obtain the significant features of each pixel color in the image.
4. The cross-modal place recognition method based on efficient self-attention according to claim 3, characterized in that: We choose to use the Lab color space to calculate color contrast. We quantify the saliency of a specific pixel by comparing its color with the colors of other pixels in the image. We obtain the saliency value of each pixel color in the image. Suppose an element in the image is Then the significance value is: Since the image has been color quantized, the color of each pixel is determined by the color histogram features of the image, from which the corresponding quantized color value is obtained; the proposed optimization method only needs to calculate the saliency value associated with the color corresponding to each pixel to obtain the optimized saliency value: In the formula, c l is the quantized color value of pixel M, f j For color c l The frequency of occurrence in the image, α j For color c l The quantitative value of , K is the number of quantified colors; The image salient features in the image are extracted based on the saliency value associated with each pixel in the image and the color corresponding to each pixel.
5. The cross-modal place recognition method based on efficient self-attention according to claim 1, characterized in that: In step 5, the features output in the third stage of the ResNet50 network are and Extract local shared features in the form of feature blocks and Local shared features and The local features are obtained through the efficient attention module EMSA Let F be one of the overall feature candidate descriptors: In the formula, C, H, and W represent the three dimensions of channel, height, and width respectively. A set of stride S is extracted from F. p The size is d x ×d y Patch-level features {P i ,x i ,y i }, the total number of patch-level features is: Where P i represents the patch-level feature set, (x i ,y i ) represents the coordinates of the center of the patch-level feature on the feature map; The efficient attention module EMSA i Perform convolution operation to get Q, and convert P i Let x be the two-dimensional input label Reshaped into a three-dimensional marker along the spatial dimension And input to the depth convolution operation to reduce the height H and width W dimensions; s is the reduction factor, s is set adaptively according to the feature map size or the number of stages, the kernel size, stride and padding are s+1, s and s / 2 respectively; the new label mapping after spatial reduction is reshaped into a two-dimensional mark, Where n' = h / s × w / s; is fed into two sets of projection operations to obtain the key K and value V.
6. The cross-modal place recognition method based on efficient self-attention according to claim 5, characterized in that: The EMSA equation is used to calculate the attention function on the query Q, key K and value V; the EMSA equation is as follows: Where Conv(·) represents a standard 1×1 convolution operation, which is used to simulate the interaction between different attention heads; The setting of the efficient attention module EMSA enables the function of each attention head to depend on all keys and queries at the same time; instance normalization is introduced in the dot product matrix after applying the Softmax function, marked as IN(·); the output values of each head are connected and linearly projected to form the final output.
7. The cross-modal place recognition method based on efficient self-attention according to claim 6, characterized in that: The EMSA equation calculates the value of cost S t yes:
8. The cross-modal place recognition method based on efficient self-attention according to claim 1, characterized in that: In step 6, the saliency map extracted in step 2 is And the local features obtained in step 5 Perform feature fusion to obtain the image saliency map M of the fused color features: The above formula is to measure the value of a certain pixel I k The two significant values S(I k ) and m(I k ) between the two.
Citation Information
Patent Citations
Target part identification method based on visual attention mechanism
CN106127749A
Image saliency target detection method based on k-means and level set superpixel segmentation
CN110866896A
Color image main color rapid extraction method and system based on clustering space mapping
CN111798526A
Hyperspectral target detection method based on unsupervised momentum contrast learning
CN116958807A
Target tracking method and system based on multi-head attention optimization feature fusion network
CN117274883A
Cited By
Grounding grid corrosion analysis and prediction system
CN120255011A
