Absolute pose regression method based on cascade attention module
The absolute pose regression method of the cascaded attention module solves the problem of insufficient positioning accuracy caused by noise interference in complex scenes. It generates powerful feature representations through multi-scale feature extraction and attention mechanisms, which significantly improves the perceptual ability and complexity of the model. Restoration effect of the scene.
Patent Information
- Application Number
- CN202410801008.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-20
- Publication Date
- 2024-09-17
AI Technical Summary
Existing absolute pose regression methods suffer from noise interference in complex scenes, resulting in insufficient positioning accuracy and affecting robustness and generalization, especially in the ability to restore local details and maintain depth continuity when processing complex scenes, low-texture areas or occluded areas. insufficient.
The absolute pose regression method based on the cascade attention module is used to generate a powerful feature representation suitable for absolute pose regression through multi-scale feature extraction, block detail extraction, multi-level feature aggregation, channel attention and position attention mechanisms. , enhance the performance of the model in feature processing.
It significantly enhances the model's ability to perceive multi-scale objects and restore the detailed structure of complex scenes, improves positioning accuracy and robustness, and can better capture global information and retain local features at different scales.
Smart Images

Figure CN118657831A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer vision and deep learning methods, and in particular to an absolute pose regression method based on a cascaded attention module. Background Art
[0002] In recent years, computer vision applications have developed rapidly, especially in practical applications such as robotics, self-driving cars, 3D scene reconstruction, and augmented reality. One of the keys to the implementation of these technologies is to accurately extract 3D depth visual information of complex scenes to achieve accurate perception and understanding of the environment. Although existing depth estimation technologies such as absolute pose regression methods, stereo vision, and time series analysis have made significant breakthroughs in accuracy and achieved end-to-end estimation from image to camera pose, there is still the problem of insufficient positioning accuracy caused by noise interference when facing challenging scenes such as sparse or repeated textures, viewpoint changes, occlusions, and lighting changes, resulting in insufficient robustness and generalization of the network, affecting its ability to restore local details and maintain depth continuity when dealing with complex scenes, low-texture areas, or occluded areas. Summary of the invention
[0003] The purpose of the present invention is to provide an absolute pose regression method based on a cascaded attention module, which can solve the problem of noise interference positioning accuracy in pose estimation when facing a complex environment.
[0004] The technical solution adopted by the present invention is as follows:
[0005] The absolute pose regression method based on the cascaded attention module is implemented in the following steps:
[0006] Step 1, image feature extraction;
[0007] Step 2, multi-scale feature extraction;
[0008] Step 3, block detail extraction;
[0009] Step 4: multi-level feature aggregation;
[0010] Step 5: Obtain channel attention vector;
[0011] Step 6, normalization processing;
[0012] Step 7, camera pose space mapping generation;
[0013] Step 8: Model training and optimization.
[0014] The present invention is characterized in that:
[0015] Specifically:
[0016] Step 1: Use the Transformer-based hierarchical encoder-decoder structure to perform in-depth feature extraction on RGB images;
[0017] Step 2: Input the obtained features into the pyramid pooling module to extract multi-scale visual features;
[0018] Step 3: The multi-scale features are fed into the block detail extraction module, which segments the input feature map into blocks and extracts fine features of each local area.
[0019] Step 4: The multi-level feature aggregation module further integrates the multi-scale features to construct a comprehensive global context;
[0020] Step 5: The channel attention mechanism is introduced to capture the relationship between different channels in the image, express the feature information in the image through weighted processing, and provide more reliable environmental information for camera pose estimation;
[0021] Step 6: Apply the softmax(·) function to obtain the weight Att i CAM is used to replace the corresponding 3×3 convolution in the residual block, so that the model not only retains the original resistance to gradient vanishing and gradient exploding, but also introduces more fine-grained spatial information required for camera pose regression, significantly enhancing the model's performance in feature processing;
[0022] Step 7: The position attention module is used for a given feature map X∈R C×H×W , first perform a convolution operation on it to obtain three derived feature maps f1, f2 and f3, {f1, f2, f3}∈R C×H×W , and then reshape them into R C×N In matrix form, N = H × W represents the number of pixels. Subsequently, the matrix multiplication of f1 and f2 is calculated, and then the softmax layer is applied to produce the required spatial attention map M∈R N×N ;
[0023] In step 8, MLP maps the features extracted by the visual encoder and the two-stream attention module, and uses the L1 loss function to optimize the network model.
[0024] Step 1 is implemented as follows:
[0025] Step 1.1, input image segmentation, input RGB image Split into non-overlapping patches of size P×P, each patch is considered as a token;
[0026] Step 1.2, linear projection, linearly project each token and map it to a higher dimensional feature space
[0027] Step 1.3: feature merging: use the Patch Merging module to merge adjacent patch features to achieve downsampling of the feature map;
[0028] Step 1.4, multi-stage feature extraction, construct 4 hierarchical Transformer Blocks, the output of each stage is used as the input of the next stage, and 4 feature maps with different resolutions are generated
[0029] Step 1.5, feature map upsampling and concatenation, restore the low-resolution feature map to high resolution by upsampling, and concatenate it with the high-resolution features in the decoder through jump connections to aggregate high-level and low-level feature information. The resolution of the final output feature map X is
[0030] Step 2 is implemented as follows:
[0031] Step 2.1, construct three pyramid pooling layers, each layer uses convolution kernels of 1×1, 3×3, and 6×6 sizes to aggregate features at different scales;
[0032] Step 2.2, parallel pooling operation, applying average pooling operation to the feature map of each scale;
[0033] Step 2.3, feature upsampling, perform upsampling operations on the feature maps of each scale after average pooling, and use bilinear interpolation technology to restore the size of the feature map to the same size as the original input feature map. Figure 1 Consistent spatial resolution;
[0034] Step 2.4, output multi-scale feature maps, which will serve as input to subsequent network modules to support deeper feature learning and information integration.
[0035] Step 3 is implemented as follows:
[0036] Step 3.1, feature map segmentation, the input multi-scale feature map Split into N patches of equal size Each patch is a specific area in the feature map, where and
[0037] Step 3.2: Apply channel attention to each segmented patch p i The channel attention mechanism is applied independently, as shown in equation (1):
[0038]
[0039] In the formula, Represents channel attention, the intermediate weight map obtained by calculation The channel dimension is weighted to adjust the contribution of each channel; in addition, γ(·) represents an activation function for nonlinear transformation;
[0040] Step 3.3, apply spatial attention to the result p of channel attention i ′Apply spatial attention as shown in the following formula (2):
[0041]
[0042] In the formula, Represents channel attention, spatial attention function β i Acting on p i ′, generate a spatial weight map This weight map reflects the importance of different spatial positions. Subsequently, the spatial weight map is nonlinearly transformed by the activation function δ(·).
[0043] Step 3.4, feature aggregation and refinement, the result of spatial attention p i ″With the original patch p i Splicing is performed in the channel dimension, and the spliced features are refined through spatial global average pooling to obtain fine tokens The formula is as follows:
[0044] z i =ρ([p i ″,p i ]),i=1,2,…,N (3)
[0045] Where ρ(·) represents global spatial average pooling, and [·] represents feature concatenation operation;
[0046] Step 3.5: Feature reorganization: repeat the above steps for all patches and rearrange all the obtained fine tokens to form an ordered feature sequence. One-dimensional convolution is used to reduce the dimension of the channels of the token sequence Z to meet the input requirements of the subsequent network layers.
[0047] Step 4 is implemented as follows:
[0048] Step 4.1: Input the multi-scale feature sequence to obtain the multi-scale token feature sequence (E1, E2, E3, E4) output in step 3. These sequences represent the feature representations at different scales.
[0049] Step 4.2, initialize the query sequence, select the most detailed feature sequence E1 to retain as much detail information as possible, and initialize it as the starting query sequence
[0050] Step 4.3: Dimension alignment, use linear mapping to transform the query sequence Mapped to the same dimension as other token sequences;
[0051] Step 4.4, recursive multi-scale feature interaction, As a starting point, it gradually interacts recursively with its low-scale token sequence E2, E3, E4, and E1;
[0052] Step 4.5: Apply multi-head cross attention. For each pair of query sequences and token sequence E i , perform multi-head cross attention to integrate cross-scale feature information, the formula is as follows:
[0053]
[0054]
[0055]
[0056] In the formula, and W i 0 is a learnable parameter matrix used to map query sequences and token sequences to query (Q), key (K), and value (V) representations, respectively. k is the channel dimension of the key (K), h is the number of attention heads to allow the model to capture information in multiple subspaces in parallel, and the softmax(·) function converts the attention scores into probability distributions;
[0057] Step 4.6, apply multi-head self-attention, apply multi-head self-attention to the output of multi-head cross attention to capture the long-distance dependency within the sequence, the formula is as follows:
[0058]
[0059]
[0060] Step 4.7, residual connection and layer normalization, combine the output of multi-head self-attention with the original query sequence Added and normalized through the layer, the formula is as follows:
[0061]
[0062] Step 4.8, output global context features. After completing all recursive interactions, output aggregated global context features, which integrate all information from the finest to the coarsest scale.
[0063] Step 5 is implemented as follows:
[0064] Step 5.1: Channel dimension division. Given an input feature map X with a shape of (H, W, C), divide it into K parts according to the channel dimension, represented as [X0, X1, ..., X K-1 ]. For each individual part, its common channel number is:
[0065]
[0066] Step 5.2, feature maps F of different scales i ∈R C′×H×W It can be expressed as:
[0067]
[0068] Where s i ×s i represents the i-th kernel size;
[0069] Step 5.3, processing result F of multi-scale feature map out ∈R C×H×W It can be calculated by Concat(·), and the process can be expressed as:
[0070] F out =Concat([F0,F1,…,F K-1 ]) (12).
[0071] Step 6 is implemented as follows:
[0072] Step 6.1, processing of multi-scale feature maps, extracting weight information related to channel attention, and further generating attention weight vectors specific to each scale;
[0073] Step 6.2, relative pose estimation, the visual encoder part adopts a new block structure CABo. By replacing the corresponding 3×3 convolution in the residual block with CAM, the model retains the original resistance to gradient vanishing and gradient exploding while additionally introducing more fine-grained spatial information required for camera pose regression.
[0074] Step 7 is implemented as follows:
[0075] Step 7.1, spatial attention module image generation, for a given feature map, the position attention module first performs a convolution operation on it to obtain three derived feature maps, then reshapes them into a matrix form and applies a softmax layer to generate the required spatial attention map;
[0076] Step 7.2, channel attention module image generation, according to the response signal mutual influence at the semantic level, reshape the feature map X into R C×N Then, a new matrix is obtained by performing a multiplication operation between the matrix and its transpose; finally, in order to obtain the channel attention map Z, the new matrix is processed using a softmax layer.
[0077] Step 8 is implemented as follows:
[0078] In step 8.1, MLP maps the features extracted by the visual encoder and the two-stream attention module to better capture and represent the semantic information and spatial relationships in the image:
[0079]
[0080] Step 8.2, use the L1 loss function to optimize the network model to ensure that it can gradually approach the true value during the training process. The formula is as follows:
[0081]
[0082] Where α is the value of the query image I and its corresponding ground truth pose And the predicted pose [t, q], a pose regression module is used to reduce the error between them.
[0083] The beneficial effects of the present invention are:
[0084] The absolute pose regression method based on the cascaded attention module in the present invention generates a powerful feature representation suitable for absolute pose regression by performing multi-scale feature extraction and constructing the dependency between position and channel attention. The network can better retain and fuse local features of different scales while capturing global information, which significantly enhances the model's perception of multi-scale objects and the recovery of detailed structures of complex scenes. BRIEF DESCRIPTION OF THE DRAWINGS
[0085] Figure 1 It is a structural diagram of the attention module CA-Net model of the absolute pose regression method based on the cascaded attention module of the present invention;
[0086] Figure 2 It is a comparison module between the CABo designed by the absolute pose regression method based on the cascaded attention module of the present invention and the basic ResNet residual block;
[0087] Figure 3 It is a dual-stream attention module of the absolute pose regression method based on the cascaded attention module of the present invention;
[0088] Figure 4 It is a visualization of the predicted trajectory results of the camera based on the absolute pose regression method of the cascaded attention module of the present invention. DETAILED DESCRIPTION
[0089] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments;
[0090] Example 1
[0091] The absolute pose regression method of the present invention is based on the hierarchical joint attention module, and the overall framework is as follows: Figure 1 As shown, the specific implementation steps are as follows:
[0092] Step 1, image feature extraction;
[0093] Step 2, multi-scale feature extraction;
[0094] Step 3, block detail extraction;
[0095] Step 4: multi-level feature aggregation;
[0096] Step 5: Obtain channel attention vector;
[0097] Step 6, normalization processing;
[0098] Step 7, camera pose space mapping generation;
[0099] Step 8: Model training and optimization.
[0100] Example 2
[0101] The absolute pose regression method based on the cascaded attention module of the present invention is implemented in the following steps:
[0102] Step 1: Use the Transformer-based hierarchical encoder-decoder structure to perform in-depth feature extraction on RGB images;
[0103] Step 2: Input the obtained features into the pyramid pooling module to extract multi-scale visual features;
[0104] Step 3: The multi-scale features are fed into the block detail extraction module, which segments the input feature map into blocks and extracts fine features of each local area.
[0105] Step 4: The multi-level feature aggregation module further integrates the multi-scale features to construct a comprehensive global context;
[0106] Step 5: The channel attention mechanism is introduced to capture the relationship between different channels in the image, express the feature information in the image through weighted processing, and provide more reliable environmental information for camera pose estimation;
[0107] Step 6: Apply the softmax(·) function to obtain the weight Att i CAM is used to replace the corresponding 3×3 convolution in the residual block, so that the model not only retains the original resistance to gradient vanishing and gradient exploding, but also introduces more fine-grained spatial information required for camera pose regression, significantly enhancing the model's performance in feature processing;
[0108] Step 7: The position attention module is used for a given feature map X∈R C×H×W , first perform a convolution operation on it to obtain three derived feature maps f1, f2 and f3, {f1, f2, f3}∈R C×H×W . Then reshape them into R C×N In matrix form, N = H × W represents the number of pixels. Subsequently, the matrix multiplication of f1 and f2 is calculated, and the softmax layer is applied to produce the required spatial attention map M∈R N×N ;
[0109] In step 8, MLP maps the features extracted by the visual encoder and the two-stream attention module, and uses the L1 loss function to optimize the network model.
[0110] Example 3
[0111] The absolute pose regression method based on the cascaded attention module of the present invention is implemented in the following steps:
[0112] Step 1 is the feature extraction module of the input image. The hierarchical Transformer module is used to extract features from the input image. The specific steps are as follows:
[0113] Step 1.1, input image segmentation, input RGB image Split into non-overlapping patches of size P×P, each patch is considered as a token;
[0114] Step 1.2, linear projection, linearly project each token and map it to a higher dimensional feature space
[0115] Step 1.3, feature merging, use the Patch Merging module to merge adjacent patch features to achieve downsampling of the feature map. In this process, the number of tokens is reduced by 4 times, and the channel dimension is expanded by 2 times through linear transformation;
[0116] Step 1.4, multi-stage feature extraction, build 4 Transformer Blocks, the output of each stage is used as the input of the next stage, and 4 feature maps with different resolutions are generated
[0117] Step 1.5, feature map upsampling and concatenation, restore the low-resolution feature map to high resolution by upsampling, and concatenate it with the high-resolution features in the decoder through jump connections to aggregate high-level and low-level feature information. The resolution of the final output feature map X is
[0118] Step 2 is a pyramid pooling module that extracts multi-scale features from the input feature map. The specific steps are as follows:
[0119] Step 2.1, construct three pyramid pooling layers, each layer uses convolution kernels of 1×1, 3×3, and 6×6 sizes to aggregate features at different scales;
[0120] Step 2.2, parallel pooling operation, applying average pooling operation to the feature map of each scale;
[0121] Step 2.3, feature upsampling, perform upsampling operations on the feature maps of each scale after average pooling, and use bilinear interpolation technology to restore the size of the feature map to the same size as the original input feature map. Figure 1 Consistent spatial resolution;
[0122] Step 2.4, output multi-scale feature maps, which will be used as input for subsequent network modules to support deeper feature learning and information integration;
[0123] Step 3 is to segment the input feature map and extract local details of the block detail extraction module, and its network structure is as follows: Figure 2 As shown, the specific steps are as follows:
[0124] Step 3.1, feature map segmentation, the input multi-scale feature map Split into N patches of equal size Each patch is a specific area in the feature map, where and
[0125] Step 3.2: Apply channel attention to each segmented patch p i Applying the channel attention mechanism independently, the formula is as follows:
[0126]
[0127] In the formula, Represents channel attention, which is calculated by the intermediate weight map The channel dimension is weighted to adjust the contribution of each channel; in addition, γ(·) represents an activation function for nonlinear transformation;
[0128] Step 3.3, apply spatial attention to the result p of channel attention i ′Apply spatial attention, the formula is as follows:
[0129]
[0130] In the formula, Represents channel attention, spatial attention function β i Acting on p i ′, generate a spatial weight map This weight map reflects the importance of different spatial positions. Subsequently, the spatial weight map is nonlinearly transformed by the activation function δ(·).
[0131] Step 3.4, feature aggregation and refinement, the result of spatial attention p i ″With the original patch p i Splicing is performed in the channel dimension; the spliced features are refined through spatial global average pooling to obtain fine tokens The formula is as follows:
[0132] z i =ρ([p i ″,p i ]),i=1,2,…,N (3)
[0133] Where ρ(·) represents global spatial average pooling, and [·] represents feature concatenation operation;
[0134] Step 3.5: Feature reorganization: repeat the above steps for all patches and rearrange all the obtained fine tokens to form an ordered feature sequence. And use one-dimensional convolution to reduce the dimension of the channel of token sequence Z to meet the input requirements of subsequent network layers;
[0135] Step 4 is to construct a multi-level feature aggregation module for multi-scale context information. The specific steps are as follows:
[0136] Step 4.1: Input the multi-scale feature sequence to obtain the multi-scale token feature sequence (E1, E2, E3, E4) output in step 3. These sequences represent the feature representations at different scales.
[0137] Step 4.2, initialize the query sequence, select the most detailed feature sequence E1 to retain as much detail information as possible, and initialize it as the starting query sequence
[0138] Step 4.3: Dimension alignment, use linear mapping to transform the query sequence Mapped to the same dimension as other token sequences;
[0139] Step 4.4, recursive multi-scale feature interaction, As a starting point, it gradually interacts recursively with its low-scale token sequence E2, E3, E4, and E1;
[0140] Step 4.5: Apply multi-head cross attention. For each pair of query sequences and token sequence E i , perform multi-head cross attention to integrate cross-scale feature information, the formula is as follows:
[0141]
[0142]
[0143] In the formula, and is a learnable parameter matrix used to map query sequences and token sequences to query (Q), key (K), and value (V) representations, respectively. k is the channel dimension of the key (K), h is the number of attention heads to allow the model to capture information in multiple subspaces in parallel, and the softmax(·) function converts the attention scores into probability distributions;
[0144] Step 4.6, apply multi-head self-attention, apply multi-head self-attention to the output of multi-head cross attention to capture the long-distance dependency within the sequence, the formula is as follows:
[0145]
[0146] Step 4.7, residual connection and layer normalization, combine the output of multi-head self-attention with the original query sequence Added and normalized through the layer, the formula is as follows:
[0147]
[0148] Step 4.8: Output global context features. After completing all recursive interactions, output aggregated global context features that integrate all information from the finest to the coarsest scales.
[0149] Step 5 introduces the channel attention mechanism to capture the relationship between different channels in the image and express the feature information in the image through weighted processing. The specific implementation is as follows:
[0150] Step 5.1: Channel dimension division. Given an input feature map X with a shape of (H, w, C), divide it into K parts according to the channel dimension, represented as [X0, X1, ..., X K-1 ], for each individual part, its number of common channels is:
[0151]
[0152] Step 5.2, feature maps F of different scales i ∈R C′×H×W It can be expressed as:
[0153]
[0154] Where s i ×s i represents the i-th kernel size.
[0155] Step 5.3, processing result F of multi-scale feature map out ∈R C×H×W It can be calculated by Concat(·), and the process can be expressed as:
[0156] F out =Concat([F0, F1, ..., F K-1 ]) (12)
[0157] Step 6 introduces finer-grained spatial information required for camera pose regression, which is implemented as follows:
[0158] Step 6.1, using soft attention to adaptively select and focus on different spatial scales, so as to effectively combine local channel attention with global channel attention;
[0159] Step 6.2 allows the model to retain its original resistance to gradient vanishing and gradient exploding while additionally introducing finer-grained spatial information required for camera pose regression.
[0160] Step 7 is to estimate the auxiliary pose network of the relative pose, which is implemented as follows:
[0161] Step 7.1, spatial attention module image generation, for a given feature map, the position attention module first performs a convolution operation on it to obtain three derived feature maps, then reshapes them into a matrix form and applies a softmax layer to generate the required spatial attention map;
[0162] Step 7.2, channel attention module image generation, according to the response signal mutual influence at the semantic level, reshape the feature map X into R C×N Then, a new matrix is obtained by performing a multiplication operation between the matrix and its transpose. Finally, in order to obtain the channel attention map Z, the new matrix is processed using a softmax layer.
[0163] Step 8 is to optimize the network model training. The specific steps are as follows:
[0164] In step 8.1, MLP maps the features extracted by the visual encoder and the two-stream attention module to better capture and represent the semantic information and spatial relationships in the image:
[0165]
[0166] Step 8.2, use the L1 loss function to optimize the network model to ensure that it can gradually approach the true value during the training process. The formula is as follows:
[0167]
[0168] Where α is the value of the query image I and its corresponding ground truth pose and predicted pose [t, q], and the pose regression module is used to reduce the error between them
[0169] These steps use a multi-layer perceptron to learn the nonlinear mapping relationship of features, and add two fully connected layers at the end of the network as pose regression modules to achieve regression of position and direction respectively. The core of this framework is to guide model learning by minimizing the image reprojection error, so as to ensure that the synthetic image can gradually approach the true value during the training process.
[0170] Figure 4 The depth estimation results of some RGB images on the subset FULL dataset of 7Scenes and OxfordRobotCa are shown. From these visualization results, it can be seen that the use of parallel design in the present invention makes the network more efficient in processing data. In addition, the introduced dual-stream attention module makes full use of the close relationship between position and direction, thereby further improving the excellent performance of feature representation. The final network achieved the most advanced results in the median error evaluation of translation and rotation in most scenes, fully verifying the superiority of the network architecture.
[0171] The absolute pose regression method based on the cascaded attention module of the present invention does not need to obtain expensive depth truth values, significantly reduces the data acquisition cost, and solves the dependence on expensive depth truth values. Through the 1.2CA-Net absolute pose regression network strategy, the present invention can effectively optimize the model parameters from complex image sequences, making the depth estimation more accurate. This module is designed to learn attention weights with low model complexity, and effectively integrate local and global attention to establish long-range channel dependencies. The network shows stronger generalization capabilities when facing complex indoor and outdoor environments, especially when facing challenges such as dynamic changes of objects and changes in lighting, it shows more robust performance. The designed cascade attention block enables the network model to dynamically learn and adjust the importance of features by adding CAM. The unique segmentation and fusion operations can help the network obtain more fine-grained multi-scale features, solving the problem of insufficient positioning accuracy caused by noise interference in complex environments.
Claims
1. The absolute pose regression method based on the cascaded attention module is characterized by: Please follow the steps below to implement: Step 1, image feature extraction; Step 2, multi-scale feature extraction; Step 3, block detail extraction; Step 4: multi-level feature aggregation; Step 5: Obtain channel attention vector; Step 6, normalization processing; Step 7, camera pose space mapping generation; Step 8: Model training and optimization.
2. The absolute pose regression method based on the cascaded attention module according to claim 1, characterized in that: Specifically: Step 1: Use the Transformer-based hierarchical encoder-decoder structure to perform in-depth feature extraction on RGB images; Step 2: Input the obtained features into the pyramid pooling module to extract multi-scale visual features; Step 3: The multi-scale features are fed into the block detail extraction module, which segments the input feature map into blocks and extracts fine features of each local area. Step 4: The multi-level feature aggregation module further integrates the multi-scale features to construct a comprehensive global context; Step 5: The channel attention mechanism is introduced to capture the relationship between different channels in the image, express the feature information in the image through weighted processing, and provide more reliable environmental information for camera pose estimation; Step 6: Apply the softmax(·) function to obtain the weight Att i CAM is used to replace the corresponding 3×3 convolution in the residual block, so that the model not only retains its original resistance to gradient vanishing and gradient exploding, but also introduces more fine-grained spatial information required for camera pose regression, significantly enhancing the model's performance in feature processing; Step 7: The position attention module is used for a given feature map X∈R C×H×W , first perform a convolution operation on it to obtain three derived feature maps f1, f2 and f3, {f1, f2, f3}∈R C×H×W , and then reshape them into R C×N In matrix form, N = H × W represents the number of pixels. Subsequently, the matrix multiplication of f1 and f2 is calculated, and then the softmax layer is applied to produce the required spatial attention map M∈R N×N ; In step 8, MLP maps the features extracted by the visual encoder and the two-stream attention module, and uses the L1 loss function to optimize the network model.
3. The absolute pose regression method based on the cascaded attention module according to claim 2, characterized in that: The step 1 is specifically implemented according to the following steps: Step 1.1, input image segmentation, input RGB image Split into non-overlapping patches of size P×P, each patch is considered as a token; Step 1.2, linear projection, linearly project each token and map it to a higher dimensional feature space Step 1.3, feature merging, use the Patch Merging module to merge adjacent patch features to achieve downsampling of the feature map; Step 1.4, multi-stage feature extraction, construct 4 hierarchical Transformer Blocks, the output of each stage is used as the input of the next stage, and 4 feature maps with different resolutions are generated Step 1.5, feature map upsampling and concatenation, restore the low-resolution feature map to high resolution by upsampling, and concatenate it with the high-resolution features in the decoder through jump connections to aggregate high-level and low-level feature information. The resolution of the final output feature map X is 4. The absolute pose regression method based on the cascaded attention module according to claim 2, characterized in that: The step 2 is specifically implemented according to the following steps: Step 2.1, construct three pyramid pooling layers, each layer uses convolution kernels of 1×1, 3×3, and 6×6 sizes to aggregate features at different scales; Step 2.2, parallel pooling operation, applying average pooling operation to the feature map of each scale; Step 2.3, feature upsampling, performing upsampling operations on the feature maps of each scale after average pooling, and using bilinear interpolation technology to restore the size of the feature map to the same spatial resolution as the original input feature map; Step 2.4, output multi-scale feature maps, which will serve as input to subsequent network modules to support deeper feature learning and information integration.
5. The absolute pose regression method based on the cascaded attention module according to claim 2, characterized in that: The step 3 is specifically implemented according to the following steps: Step 3.1, feature map segmentation, the input multi-scale feature map Split into N patches of equal size Each patch is a specific area in the feature map, where and Step 3.2: Apply channel attention to each segmented patch p i The channel attention mechanism is applied independently, as shown in equation (1): In the formula, Represents channel attention, the intermediate weight map obtained by calculation The channel dimension is weighted to adjust the contribution of each channel; in addition, γ(·) represents an activation function for nonlinear transformation; Step 3.3, apply spatial attention to the result p of channel attention i ′ Apply spatial attention as shown in equation (2): In the formula, Represents channel attention, spatial attention function β i Acting on p i ′ , generating a spatial weight map This weight map reflects the importance of different spatial positions. Subsequently, the spatial weight map is nonlinearly transformed by the activation function δ(·). Step 3.4, feature aggregation and refinement, the result of spatial attention p i ″With the original patch p i The splicing is performed in the channel dimension, and the spliced features are refined through spatial global average pooling to obtain a fine The formula is as follows: z i =ρ([p i ″,p i ]),i=1,2,…,N (3) Where ρ(·) represents global spatial average pooling, and [·] represents feature concatenation operation; Step 3.5: Feature reorganization: repeat the above steps for all patches and rearrange all the obtained fine tokens to form an ordered feature sequence. One-dimensional convolution is used to reduce the dimension of the channels of the token sequence Z to meet the input requirements of the subsequent network layers.
6. The absolute pose regression method based on the cascaded attention module according to claim 2, characterized in that: The step 4 is specifically implemented according to the following steps: Step 4.1: Input the multi-scale feature sequence to obtain the multi-scale token feature sequence (E1, E2, E3, E4) output in step 3. These sequences represent the feature representations at different scales. Step 4.2, initialize the query sequence, select the most detailed feature sequence E1 to retain as much detail information as possible, and initialize it as the starting query sequence Step 4.3: Dimension alignment, use linear mapping to transform the query sequence Mapped to the same dimension as other token sequences; Step 4.4, recursive multi-scale feature interaction, As a starting point, it gradually interacts recursively with its low-scale token sequence E2, E3, E4, and E1; Step 4.5: Apply multi-head cross attention. For each pair of query sequences and token sequence E i , perform multi-head cross attention to integrate cross-scale feature information, the formula is as follows: In the formula, and is a learnable parameter matrix used to map query sequences and token sequences to query (Q), key (K), and value (V) representations, respectively. k is the channel dimension of the key (K), h is the number of attention heads to allow the model to capture information in multiple subspaces in parallel, and the softmax(·) function converts the attention scores into probability distributions; Step 4.6, apply multi-head self-attention, apply multi-head self-attention to the output of multi-head cross attention to capture the long-distance dependency within the sequence, the formula is as follows: Step 4.7, residual connection and layer normalization, combine the output of multi-head self-attention with the original query sequence Added and normalized through the layer, the formula is as follows: Step 4.8: Output global context features. After completing all recursive interactions, output the aggregated global context features. These features integrate all information from the finest to the coarsest scales.
7. The absolute pose regression method based on hierarchical joint attention module according to claim 2 is characterized in that: The step 5 is specifically implemented according to the following steps: Step 5.1: Channel dimension division. Given an input feature map X with a shape of (H, W, C), divide it into K parts according to the channel dimension, represented as [X0, X1, ..., X K-1 ], for each individual part, its number of common channels is: Step 5.2, feature maps F of different scales i ∈R C′×H×W It can be expressed as: Where s i ×s i represents the i-th kernel size; Step 5.3, processing result F of multi-scale feature map out ∈R C×H×W It can be calculated by Concat(·), and the process can be expressed as: F out =Concat([F0,F1,…,F K-1 ]) (12)。 8. The absolute pose regression method based on the cascaded attention module according to claim 2, characterized in that: The step 6 is specifically implemented according to the following steps: Step 6.1, using soft attention to adaptively select and focus on different spatial scales, so as to effectively combine local channel attention with global channel attention; Step 6.2 allows the model to retain its original resistance to gradient vanishing and gradient exploding while additionally introducing finer-grained spatial information required for camera pose regression.
9. The absolute pose regression method based on the cascaded attention module according to claim 2, characterized in that: The step 7 is specifically implemented according to the following steps: Step 7.1, spatial attention module image generation, for a given feature map, the position attention module first performs a convolution operation on it to obtain three derived feature maps, then reshapes them into a matrix form and applies a softmax layer to generate the required spatial attention map; Step 7.2, channel attention module image generation, according to the response signal mutual influence at the semantic level, reshape the feature map X into R C×N Then, a new matrix is obtained by performing a multiplication operation between the matrix and its transpose; finally, in order to obtain the channel attention map Z, the new matrix is processed using a softmax layer.
10. The absolute pose regression method based on cascaded attention module according to claim 2, characterized in that: The step 8 is specifically implemented according to the following steps: In step 8.1, MLP maps the features extracted by the visual encoder and the two-stream attention module to better capture and represent the semantic information and spatial relationships in the image: Step 8.2, use the L1 loss function to optimize the network model to ensure that it can gradually approach the true value during the training process. The formula is as follows: Where α is the value for the query image I and its corresponding ground truth pose And the predicted pose [t, q], a pose regression module is used to reduce the error between them.
Citation Information
Cited By
Infrared small target detection method, storage medium and computer equipment
CN120047757A
Absolute pose regression method based on laser point cloud
CN120635204A
Subway hazardous article terahertz detection method based on adaptive downsampling and multi-dimensional attention mechanism
CN120635557A
Three-dimensional hand posture estimation method fusing hand and object features
CN121259920A
