Self-supervised depth estimation method based on block detail extraction and multistage feature aggregation
The self-supervised depth estimation method through block detail extraction and multi-level feature aggregation solves the problem of difficulty in recovering details of monocular depth estimation in complex scenes and low-texture areas, achieving more efficient depth perception and recovery effects, and is suitable for resources Application scenarios with limited and high real-time requirements.
Patent Information
- Application Number
- CN202410752186.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-06-12
AI Technical Summary
Existing monocular depth estimation methods have difficulty in restoring local details and maintaining depth continuity when dealing with complex scenes, low-texture areas, or occluded areas, and their dependence on external resources and real-time requirements limit their application scenarios.
A self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation is adopted. Through image feature extraction, multi-scale feature extraction, block detail extraction, long-distance dependency capture, multi-level feature aggregation, depth value prediction, and relative pose Through steps such as estimation and self-supervised signal generation, we gradually dig into the fine features of local areas and combine cross-layer interactions with multi-level feature sequences to enhance the model's perception of multi-scale objects and complex scenes.
It significantly enhances the model's ability to perceive multi-scale objects and restore the detailed structure of complex scenes, reduces the dependence on external annotation data, and improves the accuracy and efficiency of depth estimation, especially in environments with limited resources or high real-time requirements. in the scene.
Smart Images

Figure CN118799371A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer vision and deep learning methods, and in particular to a self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation. Background Art
[0002] In recent years, computer vision applications have developed rapidly, especially in high-end 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 the 3D depth information of the scene to achieve accurate perception and understanding of the environment. Although existing depth estimation techniques such as stereo vision and time series analysis have made significant breakthroughs in accuracy, they often rely on images from multiple perspectives or continuous frame sequences. This dependence limits the widespread deployment of these techniques in application scenarios with limited resources or strict requirements for real-time processing. In contrast, monocular depth estimation techniques predict the depth information of the scene by analyzing visual cues in a single image, making them more attractive in practical applications, especially in scenarios with limited resources or high real-time requirements. However, existing monocular depth estimation methods may ignore fine features and in the process of model learning, which affects their 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 a self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation, which can enhance the model's perception ability of multi-scale objects and the restoration effect of complex scene detail structures.
[0004] The technical solution adopted by the present invention is as follows:
[0005] The self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation 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: long-distance dependency capture;
[0010] Step 5, multi-level feature aggregation;
[0011] Step 6, depth value prediction;
[0012] Step 7, relative pose estimation;
[0013] Step 8, self-supervisory signal generation;
[0014] Step 9: Model training and optimization.
[0015] The present invention is characterized in that:
[0016] Step 1 is implemented as follows:
[0017] 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;
[0018] Step 1.2, linear projection, linearly project each token and map it to a higher dimensional feature space
[0019] Step 1.3, feature merging, use the Patch Merging module to merge adjacent patch features to achieve downsampling of the feature map;
[0020] 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
[0021] 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
[0022] Step 2 is implemented as follows:
[0023] 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;
[0024] Step 2.2, perform pooling operation at the same time, and apply average pooling operation to the feature map of each scale;
[0025] 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;
[0026] Step 2.4, output multi-scale feature map.
[0027] Step 3 is implemented as follows:
[0028] Step 3.1, feature map segmentation, the input multi-scale feature map Split into N equal-sized Each patch is a specific area in the feature map, where and
[0029] Step 3.2: Apply channel attention to each segmented patchsp i The channel attention mechanism is applied independently, as shown in equation (1):
[0030]
[0031] Where p′ i represents the channel data after adjustment by the channel attention mechanism, Represents channel attention, the intermediate weight map obtained by calculation Weight the channel dimension to adjust p i The contribution of each channel; in addition, γ(·) represents an activation function for nonlinear transformation, α i (·) represents a channel weight mapping function;
[0032] Step 3.3, apply spatial attention to the result p′ of channel attention i Apply spatial attention as shown in equation (2):
[0033]
[0034] Where p″ i represents the channel data after spatial attention processing, Represents channel attention, spatial attention function β i The result p′ acting on the channel attention i , generating a spatial weight map This weight map is used to adjust the contribution of different spatial positions. δ(·) represents an activation function that performs a nonlinear transformation on the spatial weight map;
[0035] Step 3.4: Feature aggregation and refinement. The result of spatial attention p″ i With the original data 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:
[0036] z i =ρ([p″ i ,p i ]),i=1,2,…,N (3)
[0037] Where ρ(·) represents global spatial average pooling, and [·] represents feature concatenation operation;
[0038] 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;
[0039] Step 4 is implemented as follows:
[0040] Step 4.1: Apply multi-head attention to each feature sequence to capture the long-distance dependencies within the sequence. The formula is as follows:
[0041]
[0042] Where Q, K, and V are query, key, and value matrices, respectively. and represents the learnable parameter matrix, n represents the number of attention heads, the softmax(·) function converts the attention score into a probability distribution, and d k is the number of channel dimensions of the key;
[0043] Step 4.2: Apply a feedforward network to the output of the multi-head attention to further extract features. The formula is as follows:
[0044] FFN(E i ′) = ReLU(E i ′·W1+b1)·W2+b2 (7)
[0045] In the formula, E i ′ represents the result of applying multi-head attention in step 4.1, W1 and W2 are learnable weight matrices, b1 and n2 are corresponding bias terms, and ReLU(·) is the activation function used to introduce nonlinearity;
[0046] Step 4.3, layer normalization and residual connection, the output of the feedforward network is normalized, and residual connections are added to enhance the learning ability and stability of the model. The formula is as follows:
[0047] E″ i =LN(E′ i +FFN(E′ i )) (8)
[0048] Where LN(·) is the layer normalization operation, which normalizes each feature channel.
[0049] Step 5 is implemented as follows:
[0050] Step 5.1, multi-scale feature sequence input, obtain the multi-scale token feature sequence (E1, E2, E3, E4) output in step 4;
[0051] Step 5.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
[0052] Step 5.3: Dimension alignment, use linear mapping to transform the query sequence Mapped to the same dimension as other token sequences;
[0053] Step 5.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;
[0054] Step 5.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:
[0055]
[0056]
[0057] In the formula, and is a learnable parameter matrix used to transform the query sequence and token sequence E i are mapped to query, key, and value representations, respectively. n represents the number of attention heads to allow the model to capture information in multiple subspaces in parallel. k is the channel dimension of the key, and the softmax(·) function converts the attention score into a probability distribution;
[0058] Step 5.6, 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:
[0059]
[0060] In the formula, and is a learnable parameter matrix, n represents the number of attention heads consistent with the parameters set in step 5.5, and A(·) represents the attention function consistent with step 5.5;
[0061] Step 5.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:
[0062]
[0063] Where LN(·) is the layer normalization operation, which is used to normalize the channel features to ensure the stability of data distribution and reduce internal covariate shift;
[0064] Step 5.8, update the query sequence, output the updated query sequence And with the token sequence E of the next scale i+1 Interact until sequences at all scales are interacted and aggregated;
[0065] Step 5.9, output the global context features. After completing all recursive interactions, output the aggregated global context features.
[0066] Step 6 is implemented as follows:
[0067] Step 6.1, pixel-level probability distribution calculation, first apply convolution operation to the depth clue map to map the channel to N dimensions; then, apply softmax activation function to the mapped depth clue map to obtain the probability distribution p of each pixel in the depth bin (bins) i,j,k ,1≤i≤N,1≤j≤h,1≤k≤w, N, h and w represent the depth bins dimension, the height and width of the image respectively;
[0068] Step 6.2, calculate the center of the bins. Calculate the center value of the bins based on the width of the bins. The formula is as follows:
[0069]
[0070] Where, d min and d max respectively refer to the lower and upper limits of the depth range, b i Indicates the width of each depth bin;
[0071] Step 6.3, calculate the final depth value. For each pixel in the image, the final depth value d is calculated based on the probabilistic linear combination of the softmax score and the bin center value. The formula is as follows:
[0072]
[0073] Step 6.4, depth value normalization, normalize the calculated depth value to ensure that it is within the predetermined depth range [-dmin ,d max ]Inside.
[0074] Step 7 is implemented as follows:
[0075] Step 7.1, image feature extraction, using the backbone network shared with the deep network from the target image I t and adjacent frame images I t′ Extract features from
[0076] Step 7.2, relative pose estimation, jointly train an auxiliary pose network that extracts the pose from the target image I t and reference image I t′ Estimate the relative pose T between them t→t′ , which contains the rotation and translation information from the target image to the reference image.
[0077] Step 8 is implemented as follows:
[0078] Step 8.1, image projection, using the depth map D obtained in step 6 t and the relative pose T output in step 7 t→t′ , I is calculated by the projection function proj(·) t Each pixel in the adjacent frame image I t′ The corresponding 2D coordinates in
[0079] Step 8.2, image synthesis, based on the projected 2D coordinates, synthesize the deformed image I through the sampling operator <·> t→t′ , the formula is as follows:
[0080] I t→t′ =I t′ <proj(D t ,T t→t′ ,K)> (17)
[0081] In the formula, proj(D t ,T t→t′ ,K) Return the depth map D t in I t′ , and is used to project the 2D coordinates from the adjacent frame image I t′ The pixel value at the corresponding position of the sample, K represents the intrinsic parameter matrix of the camera.
[0082] Step 9 is implemented as follows:
[0083] Step 9.1, calculate the photometric error, the formula is as follows:
[0084]
[0085] Where α is the weight used to balance SSIM and L1 norm, usually set to 0.85. SSIM is the structural similarity index, which is used to measure the visual similarity of two images.
[0086] Step 9.2, calculate the minimum photometric error, the formula is as follows:
[0087] L p (I t ,I t′ )=min t′ pe(I t ,I t→t′ ) (19)
[0088] Where t′∈{t-1,t+1} represents the target image I t The previous or next frame;
[0089] Step 9.3, generate an automatic mask to filter static pixels and low-texture areas to reduce the interference of moving objects in dynamic scenes on training. The formula is as follows:
[0090] μ=[min t′ pe(I t ,I t′→t ) <min t′ pe(I t ,I t′ )] (20)
[0091] Where [.] indicates that Iverson brackets are used to convert the expression into binary values, so μ∈{0,1};
[0092] Step 9.4, calculate the image reprojection error, the formula is as follows:
[0093] L r (I t ,I t→t′ )=μ·L p (I t ,I t′ ) (twenty one).
[0094] The beneficial effects of the present invention are:
[0095] The present invention is a self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation. It uses a self-supervised monocular depth estimation model and does not rely on external labeled data. Instead, it performs self-learning and optimization through the characteristics of the internal data structure. By gradually and deeply mining the fine features of local areas and combining cross-layer interaction of multi-level feature sequences to continuously refine and aggregate multi-scale contextual information, the model's perception ability of multi-scale objects and the recovery effect of detailed structures of complex scenes are significantly enhanced. BRIEF DESCRIPTION OF THE DRAWINGS
[0096] Figure 1 It is a network architecture diagram of the self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation of the present invention;
[0097] Figure 2 It is a block detail extraction module of the self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation of the present invention;
[0098] Figure 3 It is a multi-level feature interaction module of the self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation of the present invention;
[0099] Figure 4 It is a visualization display of the results of the self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation of the present invention. DETAILED DESCRIPTION
[0100] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments;
[0101] Example 1
[0102] The present invention is based on a self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation. The overall framework is as follows: Figure 1 As shown, the specific implementation steps are as follows:
[0103] Step 1, image feature extraction;
[0104] Step 2, multi-scale feature extraction;
[0105] Step 3, block detail extraction;
[0106] Step 4: long-distance dependency capture;
[0107] Step 5, multi-level feature aggregation;
[0108] Step 6, depth value prediction;
[0109] Step 7, relative pose estimation;
[0110] Step 8, self-supervisory signal generation;
[0111] Step 9: Model training and optimization.
[0112] Example 2
[0113] The present invention is based on a self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation, which is specifically implemented according to the following steps:
[0114] Step 1: Use the Transformer-based hierarchical encoder-decoder structure to perform in-depth feature extraction on RGB images;
[0115] Step 2: Input the obtained features into the pyramid pooling module to extract multi-scale visual features;
[0116] 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.
[0117] In step 4, all fine feature sequences are fed into the visual Transformer to capture the complex long-distance dependencies between features through the self-attention mechanism;
[0118] Step 5: Further integrate the multi-scale features through a multi-level feature aggregation module to build a comprehensive global context;
[0119] Step 6, using the generated depth clue map to map each pixel to an actual depth value;
[0120] Step 7, accurately estimate the relative pose between the target image and adjacent frames through the auxiliary pose network;
[0121] Step 8: synthesize new views as self-supervisory signals;
[0122] In step 9, the loss of the synthesized view and the generated depth map is calculated to optimize the network model.
[0123] Example 3
[0124] The present invention is based on a self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation, which is specifically implemented according to the following steps:
[0125] 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:
[0126] 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;
[0127] Step 1.2, linear projection, linearly project each token and map it to a higher dimensional feature space
[0128] 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;
[0129] 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
[0130] 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
[0131] Step 2 is a pyramid pooling module that extracts multi-scale features from the input feature map. The specific steps are as follows:
[0132] 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;
[0133] Step 2.2, parallel pooling operation, applying average pooling operation to the feature map of each scale;
[0134] 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;
[0135] 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;
[0136] Step 3 is a block detail extraction module that segments the input feature map and extracts local details. Its network structure is as follows: Figure 2 As shown, the specific steps are as follows:
[0137] Step 3.1, feature map segmentation, the input multi-scale feature map Split into N equal-sized Each patch is a specific area in the feature map, where and
[0138] Step 3.2: Apply channel attention to each segmented patch p i Applying the channel attention mechanism independently, the formula is as follows:
[0139]
[0140] Where p′ irepresents the channel data after adjustment by the channel attention mechanism, Represents channel attention, the intermediate weight map obtained by calculation Weight the channel dimension to adjust p i The contribution of each channel; in addition, γ(·) represents an activation function for nonlinear transformation, α i (·) represents a channel weight mapping function;
[0141] Step 3.3, apply spatial attention to the result p′ of channel attention i Applying spatial attention, the formula is as follows:
[0142]
[0143] Where p″ i represents the channel data after spatial attention processing, Represents channel attention, spatial attention function β i The result p′ acting on the channel attention i , generating a spatial weight map This weight map is used to adjust the contribution of different spatial positions. δ(·) represents an activation function that performs a nonlinear transformation on the spatial weight map;
[0144] Step 3.4: Feature aggregation and refinement. The result of spatial attention p″ i With the original patchp i Splicing is performed in the channel dimension; the spliced features are refined through spatial global average pooling to obtain a fine The formula is as follows:
[0145] z i =ρ([p″ i ,p i ]),i=1,2,…,N (3)
[0146] Where ρ(·) represents global spatial average pooling, and [·] represents feature concatenation operation;
[0147] 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;
[0148] Step 4 is to construct a visual Transformer module for long-distance dependencies within the feature sequence. The specific steps are as follows:
[0149] Step 4.1: Apply multi-head attention to each feature sequence to capture the long-distance dependencies within the sequence. The formula is as follows:
[0150]
[0151] Where Q, K, and V are query, key, and value matrices, respectively. and represents the learnable parameter matrix, n represents the number of attention heads, the softmax(·) function converts the attention score into a probability distribution, and d k is the number of channel dimensions of the key;
[0152] Step 4.2: Apply a feedforward network to the output of the multi-head attention to further extract features. The formula is as follows:
[0153] FFN(E i ′) = ReLU(E i ′·W1+b1)·W2+b2 (7)
[0154] In the formula, E i ′ represents the result of applying multi-head attention in step 4.1, W1 and W2 are learnable weight matrices, b1 and b2 are corresponding bias terms, and ReLU(·) is the activation function used to introduce nonlinearity;
[0155] Step 4.3, layer normalization and residual connection, the output of the feedforward network is normalized, and residual connections are added to enhance the learning ability and stability of the model. The formula is as follows:
[0156] E″ i =LN(E′ i +FFN(E′ i )) (8)
[0157] Where LN(·) is the layer normalization operation, which normalizes each feature channel;
[0158] Step 5 is to construct a multi-level feature aggregation module for multi-scale context information, and its network structure is as follows: Figure 3 As shown, the specific steps are as follows:
[0159] Step 5.1, multi-scale feature sequence input, obtain the multi-scale token feature sequence (E1, E2, E3, E4) output in step 4, these sequences represent the feature representation at different scales;
[0160] Step 5.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
[0161] Step 5.3: Dimension alignment, use linear mapping to transform the query sequence Mapped to the same dimension as other token sequences;
[0162] Step 5.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;
[0163] Step 5.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:
[0164]
[0165] In the formula, and is a learnable parameter matrix used to transform the query sequence and token sequence E i are mapped to query (Q), key (K) and value (V) representations, respectively. k is the channel dimension of the key (K), n 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;
[0166] Step 5.6, 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:
[0167]
[0168] In the formula, and is a learnable parameter matrix, n represents the number of attention heads consistent with the parameters set in step 5.5, and A(·) represents the attention function consistent with step 5.5;
[0169] Step 5.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:
[0170]
[0171] Where LN(·) is the layer normalization operation, which is used to normalize the channel features to ensure the stability of data distribution and reduce internal covariate shift;
[0172] Step 5.8, update the query sequence, output the updated query sequence And with the token sequence E of the next scale i+1 Interact until sequences at all scales are interacted and aggregated;
[0173] Step 5.9: 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.
[0174] Step 6 is to generate a depth value prediction head module for each pixel of the target image, which is implemented in the following steps:
[0175] Step 6.1, pixel-level probability distribution calculation, first apply convolution operation to the depth clue map to map the channel to N dimensions; then, apply softmax activation function to the mapped depth clue map to obtain the probability distribution p of each pixel in the depth bin (bins) i,j,k ,1≤i≤N,1≤j≤h,1≤k≤w, N, h and w represent the depth bins dimension, the height and width of the image respectively;
[0176] Step 6.2, calculate the center of the bins. Calculate the center value of the bins based on the width of the bins. The formula is as follows:
[0177]
[0178] Where, d min and d max respectively refer to the lower and upper limits of the depth range, b i Indicates the width of each depth bin;
[0179] Step 6.3, calculate the final depth value. For each pixel in the image, the final depth value d is calculated based on the probabilistic linear combination of the softmax score and the bin center value. The formula is as follows:
[0180]
[0181] Step 6.4, depth value normalization, normalizes the calculated depth values to ensure that they are within the predetermined depth range [-d min ,d max ]Inside;
[0182] Step 7 is to estimate the auxiliary pose network of the relative pose, which is implemented as follows:
[0183] Step 7.1, image feature extraction, using the backbone network shared with the deep network from the target image I t and adjacent frame images I t′Extract features from
[0184] Step 7.2, relative pose estimation, jointly train an auxiliary pose network that extracts the pose from the target image I t and reference image I t′ Estimate the relative pose T between them t→t′ , which contains the rotation and translation information from the target image to the reference image;
[0185] Step 8 is a view synthesis module that synthesizes new views as self-supervised training signals. The specific steps are as follows:
[0186] Step 8.1, image projection, using the depth map D obtained in step 6 t and the relative pose T output in step 7 t→t′ , I is calculated by the projection function proj(·) t Each pixel in the adjacent frame image I t′ The corresponding 2D coordinates in
[0187] Step 8.2, image synthesis, based on the projected 2D coordinates, synthesize the deformed image I through the sampling operator <·> t→t′ , the formula is as follows:
[0188] I t→t′ =I t′ <proj(D t ,T t→t′ ,K)> (17)
[0189] In the formula, proj(D t ,T t→t′ ,K) Return the depth map D t in I t′ , and is used to project the 2D coordinates from the adjacent frame image I t′ The pixel value at the corresponding position of the sample in , K represents the intrinsic parameter matrix of the camera, which we assume is the same for all views;
[0190] Step 9 is to optimize the network model training. The specific steps are as follows:
[0191] Step 9.1, calculate the photometric error, the formula is as follows:
[0192]
[0193] Where α is the weight used to balance SSIM and L1 norm, SSIM is the structural similarity index, which is used to measure the visual similarity of two images;
[0194] Step 9.2, calculate the minimum photometric error, the formula is as follows:
[0195] L p (I t ,I t′ )=min t′ pe(I t ,I t→t′ ) (19)
[0196] Where t′∈{t-1,t+1} represents the target image I t The previous or next frame;
[0197] Step 9.3, generate an automatic mask to filter static pixels and low-texture areas to reduce the interference of moving objects in dynamic scenes on training. The formula is as follows:
[0198] μ=[min t′ pe(I t ,I t′→t ) <min t′ pe(I t ,I t′ )] (20)
[0199] Where [·] indicates that Iverson brackets are used to convert the expression into binary values, so μ∈{0,1};
[0200] Step 9.4, calculate the image reprojection error, the formula is as follows:
[0201] L r (I t ,I t→t′ )=μ·L p (I t ,I t′ ) (twenty one).
[0202] These steps together construct a self-supervised learning framework for training depth estimation models. The core of this framework is to guide model learning by minimizing the image reprojection error, thereby ensuring that the synthesized image is t→t′ With the target image I t Be as visually consistent as possible.
[0203] Figure 4 The depth estimation results of some RGB images on the KITTI and Make3D datasets are shown. From these visualization results, it can be seen that the depth map generated by the present invention is of high quality and performs well in detail presentation and depth structure integrity. Upon closer inspection, whether it is the tiny pedestrian outline, eye-catching traffic signs, clear roadblock locations, or greenery details on both sides of the road, they can all be clearly presented.
[0204] The present invention is based on a self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation. It does not need to obtain expensive depth truth values, significantly reduces data acquisition costs, and solves the dependence on expensive depth truth values. Through the self-supervised learning strategy, the present invention can effectively optimize model parameters from a monocular image sequence. At the same time, in practical applications, only a single image is needed to complete depth estimation, making depth estimation more economical and efficient. The block detail extraction module of the present invention can divide the abstract feature map into multiple sub-regions, and deeply mine and aggregate the fine features of each sub-region, significantly enhancing the model's perception of local depth clues, and improving the ability of target detail recovery in processing complex scenes, especially in areas where texture is lacking or occluded. Another multi-level feature aggregation module, by gradually extracting and aggregating multi-scale high-level semantic information from a coarse to fine sequence to establish a global context capability, optimizes the model's depth recovery capability for complex scene structures and multi-scale objects, and achieves more accurate depth estimation. Through these methods, the depth estimation technology can not only effectively capture key local details, but also better understand the semantic structure of the scene, thereby improving the quality of the depth map. Especially when capturing scene elements such as pedestrians and traffic signs, it is able to generate depth maps with clear boundaries and precise structures.
Claims
1. A self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation, characterized in that: 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: long-distance dependency capture; Step 5, multi-level feature aggregation; Step 6, depth value prediction; Step 7, relative pose estimation; Step 8, self-supervisory signal generation; Step 9: Model training and optimization.
2. The self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation according to claim 1, 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 3. The self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation according to claim 1, 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, perform pooling operation at the same time, and apply 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 map.
4. The self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation according to claim 1, 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 equal-sized Each patch is a specific area in the feature map, where and Step 3.2: Apply channel attention to each segmented patchsp i The channel attention mechanism is applied independently, as shown in equation (1): Where p′ i represents the channel data after adjustment by the channel attention mechanism, Represents channel attention, the intermediate weight map obtained by calculation Weight the channel dimension to adjust p i The contribution of each channel; in addition, γ(·) represents an activation function for nonlinear transformation, α i (·) represents a channel weight mapping function; 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, p″ i represents the channel data after spatial attention processing, Represents channel attention, spatial attention function β i The result p′ acting on the channel attention i , generating a spatial weight map This weight map is used to adjust the contribution of different spatial positions. δ(·) represents an activation function that performs a nonlinear transformation on the spatial weight map; 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.
5. The self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation according to claim 1, characterized in that: The step 4 is specifically implemented according to the following steps: Step 4.1: Apply multi-head attention to each feature sequence to capture the long-distance dependencies within the sequence. The formula is as follows: Where Q, K, and V are query, key, and value matrices, respectively. and represents the learnable parameter matrix, n represents the number of attention heads, the softmax(·) function converts the attention score into a probability distribution, and d k is the number of channel dimensions of the key; Step 4.2: Apply a feedforward network to the output of the multi-head attention to further extract features. The formula is as follows: FFN(E i ′)=ReLU(e i ′·W1+b1)·W2+b2 (7) In the formula, E i ′ represents the result of applying multi-head attention in step 4.1, W1 and W2 are learnable weight matrices, b1 and b2 are corresponding bias terms, and ReLU(·) is the activation function used to introduce nonlinearity; Step 4.3, layer normalization and residual connection, the output of the feedforward network is normalized, and residual connections are added to enhance the learning ability and stability of the model. The formula is as follows: HAVE BEEN" i =LN(E′ i +FFN(E′ i )) (8) Where LN(·) is the layer normalization operation, which normalizes each feature channel.
6. The self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation according to claim 1, characterized in that: The step 5 is specifically implemented according to the following steps: Step 5.1, multi-scale feature sequence input, obtain the multi-scale token feature sequence (E1, E2, E3, E4) output in step 4; Step 5.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 5.3: Dimension alignment, use linear mapping to transform the query sequence Mapped to the same dimension as other token sequences; Step 5.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 5.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 W i 0 is a learnable parameter matrix used to transform the query sequence and token sequence E i are mapped to query (Q), key (K) and value (V) representations, respectively. k is the channel dimension of the key (K), n 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 5.6, 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: In the formula, and W i O′ is a learnable parameter matrix, n represents the number of attention heads consistent with the parameters set in step 5.5, and A(·) represents the attention function consistent with step 5.5; Step 5.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 5.8, update the query sequence, output the updated query sequence And with the token sequence E of the next scale i+1 Interact until sequences at all scales are interacted and aggregated; Step 5.9, output the global context features. After completing all recursive interactions, output the aggregated global context features.
7. The self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation according to claim 1, characterized in that: The step 6 is specifically implemented according to the following steps: Step 6.1, pixel-level probability distribution calculation, first apply convolution operation to the depth clue map to map the channel to N dimensions; then, apply softmax activation function to the mapped depth clue map to obtain the probability distribution p of each pixel in the depth bin (bins) i,j,k ,1≤i≤N,1≤j≤h,1≤k≤w, where N, h and w represent the depth bins dimension, the height and width of the image respectively Step 6.2, calculate the center of the bins. Calculate the center value of the bins based on the width of the bins. The formula is as follows: Where, d min and d max respectively refer to the lower and upper limits of the depth range, b i Indicates the width of each depth bin; Step 6.3, calculate the final depth value. For each pixel in the image, the final depth value d is calculated based on the probabilistic linear combination of the softmax score and the bin center value. The formula is as follows: Step 6.4, depth value normalization, normalize the calculated depth value to ensure that it is within the predetermined depth range [-d min ,d max ]Inside.
8. The self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation according to claim 1, characterized in that: The step 7 is specifically implemented according to the following steps: Step 7.1, image feature extraction, using the backbone network shared with the deep network from the target image I t and adjacent frame images I t′ Extract features from Step 7.2, relative pose estimation, jointly train an auxiliary pose network that extracts the pose from the target image I t and reference image I t′ Estimate the relative pose T between them t→t′ , which contains the rotation and translation information from the target image to the reference image.
9. The self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation according to claim 1, characterized in that: The step 8 is specifically implemented according to the following steps: Step 8.1, image projection, using the depth map D obtained in step 6 t and the relative pose T output in step 7 t→t′ , I is calculated by the projection function proj(·) t Each pixel in the adjacent frame image I t′ The corresponding 2D coordinates in Step 8.2, image synthesis, based on the projected 2D coordinates, synthesize the deformed image I through the sampling operator <·> t→t′ , the formula is as follows: I t→t′ =I t′ <proj(D t ,T t→t′ ,K)> (17) In the formula, proj(D t ,T t→t′ ,K) Return the depth map D t in I t′ , and is used to project the 2D coordinates from the adjacent frame image I t′ The pixel value at the corresponding position of the sample, K represents the intrinsic parameter matrix of the camera.
10. The self-supervised depth estimation method based on block detail extraction and multi-level feature aggregation according to claim 1, characterized in that: The step 9 is specifically implemented according to the following steps: Step 9.1, calculate the photometric error, the formula is as follows: Where α is the weight used to balance SSIM and L1 norm, SSIM is the structural similarity index, which is used to measure the visual similarity of two images; Step 9.2, calculate the minimum photometric error, the formula is as follows: L p (IN t ,IN t′ )=my t′ pe(I t ,IN t→t′ ) (19) Where t′∈{t-1,t+1} represents the target image I t The previous or next frame; Step 9.3, generate an automatic mask to filter static pixels and low-texture areas to reduce the interference of moving objects in dynamic scenes on training. The formula is as follows: μ=[min t′ or(I t ,TO t′→t ) <min t′ or(I t ,TO t′ )] (20) Where [.] indicates that Iverson brackets are used to convert the expression into binary values, so μ∈{0,1}; Step 9.4, calculate the image reprojection error, the formula is as follows: L r (AND t ,AND t→t′ )=μ·L p (AND t ,AND t′ ) (21)。
Citation Information
Patent Citations
Self-supervised depth estimation method based on RAFT
CN114972517A
Self-supervised monocular depth estimation method based on Swinin-Transformer and CNN (Convolutional Neural Network) parallel network
CN115731280A
Monocular endoscope video depth and pose estimation method
CN116740170A
Night scene monocular image depth estimation method and device
CN117058438A
Method of Estimating Depths from a Single Image Displayed on Display
US20120002871A1
Cited By
Colonoscope polyp image segmentation method based on hybrid model
CN119048763A
Water area surface flow velocity area monitoring method based on intelligent visual analysis
CN119470967A
Light-weight self-supervision monocular depth estimation method and device based on cross-sequence interaction
CN121810756A
