Self-supervised monocular depth estimation method based on self-attention guided feature fusion

By introducing an attention-oriented feature fusion mechanism into monocular depth estimation, the problem of incomplete perception of global context information and insufficient feature fusion is solved, significantly improving the accuracy of depth maps, especially in discontinuous areas and fine scales. Estimate ability.

CN115035171BActive Publication Date: 2024-09-24NORTHWESTERN POLYTECHNICAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210606117.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-31
Publication Date
2024-09-24
Estimated Expiration
2042-05-31

Smart Images

  • Figure CN115035171B
    Figure CN115035171B
Patent Text Reader

Abstract

The present invention discloses a self-supervised monocular depth estimation method based on attention-guided feature fusion. The present invention adds a channel self-attention module in the encoder to capture more global context information in the structural scene, thereby enhancing the feature representation; a feature fusion module based on the spatial cross-attention mechanism is designed in the decoder, and the enhanced features are used as high-level features to guide the low-level features to further calibrate the features in the decoder, so as to emphasize specific semantic information and enhance the feature representation capability in non-continuous areas; finally, the decoder output is connected to a multi-layer depth estimation module to supervise the results of the middle layer of the decoder, improve the accuracy of depth estimation, prevent the estimation errors on the coarse scale from accumulating and affecting the estimation on the fine scale, and obtain a more accurate depth map.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of computer vision and relates to a self-supervised monocular depth estimation method based on attention-oriented feature fusion. Background Art

[0002] Monocular image depth estimation has extensive and important applications in computer vision tasks such as autonomous driving, 3D reconstruction, and augmented reality. With the development of deep convolutional neural networks (CNN), CNN-based monocular image depth estimation methods can now directly obtain accurate target depth information from a single image, that is, the distance between the actual 3D object projected to each pixel in the 2D image and the camera. Compared with methods that actively detect depth using depth sensors such as structured light or lidar, monocular depth estimation does not require expensive equipment, so it is more convenient in practical applications.

[0003] In the monocular depth estimation task, it can be further divided into fully supervised monocular depth estimation and self / unsupervised monocular depth estimation according to whether the real depth information is needed. Although the fully supervised method has higher accuracy, it often requires a large number of diverse real depth labels, which is often costly in the preparation of training data. In recent years, self-supervised depth estimation, as an important and challenging method, has become a hot topic of research due to its advantage of directly training deep networks end-to-end using unlabeled videos or binocular data, and has achieved a lot of research results. The introduction of Monodepth2 also provides a relatively complete framework for self-supervised monocular depth estimation, which effectively solves the depth estimation problems of pixels that are occluded and violate the camera motion assumption. However, this method still has many shortcomings. On the one hand, Monodepth2 does not make full use of the semantic information in the image. It simply uses CNN to obtain the semantic features of the input image and implicitly learn the scene structure information. These less robust scene structure representations will lead to incomplete perception of global context information. On the other hand, as an important structure in the U-Net network, the skip connection aims to restore the information lost by downsampling during the decoding process. However, using splicing to fuse features between layers lacks further processing of local details and ignores the differences between semantic information and spatial information in features of different levels. Therefore, the gain brought by using skip connections to fuse low-level features and high-level features is very limited. Summary of the invention

[0004] The purpose of the present invention is to provide a self-supervised monocular depth estimation method based on attention-guided feature fusion, which solves the problems of incomplete global context information perception and insufficient fusion of features at different levels existing in the prior art.

[0005] The technical solution adopted by the present invention is:

[0006] A self-supervised monocular depth estimation method based on attention-guided feature fusion, which includes the following steps:

[0007] Step 1: Use continuous video frames or binocular images as the data set, adjust the images to the same size and use them as training sets for data augmentation;

[0008] Step 2: Build a self-supervised monocular depth estimation framework based on attention-guided feature fusion, including an improved depth estimation network and pose estimation network:

[0009] The improved depth estimation network includes an encoder and a decoder connected in sequence, wherein the encoder uses ResNet18, the output end of the encoder is connected to the decoder, the decoder has a 5-layer structure, each layer includes a convolution and upsampling module, wherein the 2nd, 3rd, 4th, and 5th layers are connected in sequence with a spatial cross attention module and a depth estimation module; the output of the encoder is also connected to a channel self-attention module, and the output of the channel self-attention module is respectively connected to the input of each spatial cross attention module;

[0010] Step 3: Design a loss function and use the data augmented training set and validation set to train the self-supervised monocular depth estimation framework based on attention-guided feature fusion;

[0011] Step 4: Input the image to be estimated, and use the trained and improved depth estimation network to perform depth estimation on the image to be estimated and output the result.

[0012] The present invention is also characterized in that:

[0013] The data augmentation method in step 1 includes random horizontal flipping, random brightness, contrast, saturation and hue jittering performed in sequence.

[0014] The specific operation in the channel self-attention module is to use matrix multiplication to calculate the feature similarity S of the input feature E, and obtain the attention map A through the Softmax layer. c Finally, the attention map is multiplied by the original feature and summed with each element in the original feature to obtain the enhanced feature

[0015] The spatial cross-attention feature fusion module enhances the input features Do the following: It is upsampled to 40×128 resolution using neighboring point interpolation and converted into query features through 1×1 convolution: Query = Q(x). For X, it is also downsampled to 40×128 resolution using average pooling and 1×1 convolution is used to obtain key and value features: Key = K(x) and Value = V(x). The spatial cross attention map is obtained by matrix multiplication. Finally, the fusion feature F is obtained.

[0016] The loss function uses image reprojection loss and smoothness loss, and the formulas are:

[0017]

[0018]

[0019] Among them, L ph represents the reprojection loss, I t and I s→t are the original image and the reconstructed image at time t, respectively. SSIM uses a 3×3 pixel window to calculate the similarity of images. α and β are hyperparameters. s represents the smoothness loss, d t * is the inverse of the average normalized depth at time t;

[0020] In order to solve the occluded area and eliminate the target that is stationary relative to the camera motion, the minimum reprojection loss and auto-mask are used in the loss function for improvement:

[0021]

[0022]

[0023] Where μ is an auto-mask, and the condition in [] is 1 if it is satisfied, and 0 if it is not satisfied;

[0024] Then the total loss function L is:

[0025]

[0026] Where S = 4 is the number of layers, L p is the minimum photometric error, μ is the auto-mask, and λ is the weight of the smoothness loss.

[0027] The beneficial effects of the present invention are:

[0028] The present invention adds a channel self-attention module in the encoder to capture more global context information in the structural scene, thereby enhancing the feature representation; designs a feature fusion module based on the spatial cross-attention mechanism in the decoder, and uses the enhanced features as high-level features to guide the low-level features to further calibrate the features in the decoder, so as to emphasize specific semantic information and enhance the feature representation capability in non-continuous areas; finally, the decoder output is connected to a multi-layer depth estimation module to supervise the results of the intermediate layers of the decoder, improve the accuracy of depth estimation, prevent the estimation errors on the coarse scale from accumulating and affecting the estimation on the fine scale, and obtain a more accurate depth map. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 is a flow chart of a self-supervised monocular depth estimation algorithm based on attention-guided feature fusion of the present invention;

[0030] Figure 2 is a flow chart of the channel self-attention module of the present invention;

[0031] Figure 3 is a flow chart of the spatial cross-attention feature fusion module of the present invention;

[0032] Figure 4 This is a comparison diagram of depth estimation of a certain picture using the present invention and the Monodepth2 method in Example 1;

[0033] Figure 5 This is a comparison diagram of depth estimation of a certain picture using the present invention and the Monodepth2 method in Example 1;

[0034] Figure 6 This is a comparison diagram of depth estimation of a certain picture using the present invention and the Monodepth2 method in Example 1;

[0035] Figure 7 This is a comparison diagram of depth estimation of a certain image using the present invention and the Monodepth2 method in Example 1. DETAILED DESCRIPTION

[0036] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.

[0037] The present invention is based on a self-supervised monocular depth estimation method based on attention-guided feature fusion, such as Figure 1 , including the following steps:

[0038] Step 1: Use KITTI as the dataset, resize the images to the same size and divide them into training set, validation set and test set; perform data augmentation on the training set and validation set respectively;

[0039] Step 2: Build a self-supervised monocular depth estimation framework based on attention-guided feature fusion, including an improved depth estimation network and pose estimation network:

[0040] The improved depth estimation network includes an encoder and a decoder connected in sequence. The encoder uses ResNet18. The output of the encoder is connected to the decoder. The decoder has a 5-layer structure. Each layer contains a convolution and upsampling module. The 2nd, 3rd, 4th, and 5th layers are connected to the spatial cross attention module and the depth estimation module in sequence. The output of the encoder is also connected to the channel self-attention module. The output of the channel self-attention module is connected to the input of each spatial cross attention module respectively.

[0041] Step 3: Design a loss function and use the data augmented training set and validation set to train the self-supervised monocular depth estimation framework based on attention-guided feature fusion;

[0042] Step 4: Input the image to be estimated, and use the trained and improved depth estimation network to perform depth estimation on the image to be estimated and output the result.

[0043] The data augmentation method in step 1 is as follows:

[0044] Step 1.1: The image is flipped horizontally; the probability is 0.5;

[0045] Step 1.2: Image contrast shift, the shift coefficient range is 0.8 to 1.2; the probability is 0.5;

[0046] Step 1.3: Image brightness shift, the shift coefficient range is 0.8 to 1.2; the probability is 0.5;

[0047] Step 1.4: Image saturation is shifted, with a shift coefficient of 0.8 to 1.2 and a probability of 0.5.

[0048] Step 1.5: Image hue is jittered, with a jitter coefficient of -0.1 to 0.1 and a probability of 0.5.

[0049] The channel self-attention module in step 2 is as follows Figure 2 , perform the following operations on the original input features:

[0050] The original input features are Where C is the number of channels, H and W represent the height and width of the feature map. In order to calculate the correlation between any two channels, we first adjust them to Where N = H × W represents the number of pixels. Then use matrix multiplication to calculate E and E T Similarity:

[0051]

[0052] Further obtain the attention map through the Softmax layer And multiply it by E and adjust it back Finally, the enhanced features are calculated according to the following formula

[0053]

[0054]

[0055] In depth estimation, each value in the high-level feature map output by the encoder can be regarded as the response of a specific area. The role of the channel self-attention module is to enable each channel map to capture more responses from different areas from all other channel maps, obtain more relative depth information from distant areas, and significantly enhance the perception of scene structure context information.

[0056] like Figure 3 , the spatial cross-attention feature fusion module decodes and enhances the input features Do the following:

[0057] against It is upsampled to 40×128 resolution using neighboring point interpolation and converted into query features through 1×1 convolution: Query = Q(x). For X, it is also downsampled to 40×128 resolution using average pooling and 1×1 convolution is used to obtain key and value features: Key = K(x) and Value = V(x). The spatial cross attention map is obtained by matrix multiplication. Finally, the fusion feature F is obtained, and the formula is as follows:

[0058]

[0059]

[0060] The key to predicting sharper edges is to better handle local details. The advantage of the above-mentioned fusion module is that it guides the network to clearly understand the category and location information of the boundary features of the described object. This operation of fusing high-level and low-level features to recalibrate the deep features can adaptively emphasize the key detail information of the target edge at multiple scales.

[0061] The depth estimation module in step 2 is a 3×3 convolutional layer and a Sigmoid function connected in sequence.

[0062] The structure of the pose estimation network in step 2 is: ResNet18 as the encoder and connected to the pose decoder.

[0063] The self-supervised monocular depth estimation framework based on attention-guided feature fusion in step 3 adopts image reprojection loss: Assume that an RGB image at time t is I t , the corresponding depth map is D t , using the known camera intrinsic parameter K to I t Back-projected into 3D space, and then based on the estimated camera pose T t→s The image I at time s s By reprojecting the points in 3D space, we can obtain the reconstructed image I at time t s→t , and compare I s→t and I t The loss function is calculated based on the similarity of the image. The image reprojection loss includes the structural similarity error (Structural Similarity Index Measure, SSIM) and the L1 error:

[0064] I s→t =I s <KT t→s D t K -1 p t >

[0065]

[0066] Where L ph represents the reprojection loss, p t I t The pixel coordinates in the reconstruction process are expressed as <>, which is mainly bilinear interpolation. SSIM calculates the similarity of images with a 3×3 pixel window, and α and β are hyperparameters.

[0067] Smoothness loss: In order to obtain dense depth results, the depth needs to be kept smooth locally. The following formula is used to penalize areas with excessive edge gradients:

[0068]

[0069] in Represents the inverse of the average normalized depth, in order to prevent the estimated depth from shrinking;

[0070] In addition, in order to deal with occluded pixels and pixels that violate the camera motion assumption, the minimum reprojection loss and auto-mask are used in the loss function for improvement:

[0071]

[0072]

[0073] Where L pis the minimum photometric error, μ is the auto-mask, and the conditions in [] are recorded as 1 if they are satisfied, and 0 if they are not satisfied.

[0074] The total loss function is calculated as:

[0075]

[0076] Where S=4 is the number of layers and λ is the weight of the smoothness loss.

[0077] Both the depth estimation network and the pose estimation network are trained using the Adam optimizer. During the training process, the depth estimation network inputs a single RGB image and outputs the corresponding depth map. ResNet18 is used as the network skeleton and convolutional pooling layers are used for step-by-step downsampling. The decoder part uses convolution and step-by-step upsampling. The spatial information in the original input image and the edge information in the image will gradually recover, and a jump connection structure is used, that is, the features of each layer of the decoder are fused on the channel with the features in the corresponding encoder using a splicing method, providing multi-scale hierarchical information to achieve a more refined effect. The pose estimation network is designed based on ResNet18, and can input two RGB images to estimate the 6-DOF relative pose rotation and translation parameters.

[0078] Example 1

[0079] This embodiment uses KITTI as the main data, which is a basic data set in the field of computer vision and is widely used in depth estimation tasks. It contains 200 street view videos captured by RGB cameras with corresponding real depth labels. The present invention removes static frames as a preprocessing step and divides the data into 3 parts: 39,810 images as a training set, 4,424 images as a validation set, and 697 images as a test set.

[0080] The present invention uses video sequences (M) and binocular image pairs (S) as training data, performs normalization and data augmentation according to the method in Monodepth2, and the input images are adjusted to 320×1024 resolution. The present invention uses a Tesla V100 graphics card to train the entire network, and during the training process, uses the Adam optimizer to train 20 iterations, with 10 images in each batch, and the initial learning rate is set to 10 -4 Used for the first 15 training iterations, then reduced to 10 -5 For subsequent training. The training sequence consists of 3 consecutive frame images. In the image reprojection loss, the weight of SSIM is α=0.85, the weight of L1 is β=0.15, and the weight of smoothness loss is λ=10 -3 .

[0081] Based on the above description, Tables 1 and 2 show the test results of the proposed method and the original Monodepth2 on the KITTI dataset, and use absolute relative error (AbsRel), square relative error (SqRel), root mean square error (RMSE), logarithmic root mean square error (RMSElog) and different threshold accuracy (δ<1.25, δ<1.25 2 and δ<1.25 3 ) describes the accuracy of the test results. It can be found that no matter whether video sequences or binocular image pairs are used, the present invention has obvious improvements in all indicators compared to Monodepth2. In M training, the most prominent ones are that Abs Rel is reduced by 9%, Sq Rel is reduced by 11%, and δ<1.25 is improved by 1.6%. This shows that the method of the present invention can achieve better accuracy based on Monodepth2.

[0082] The absolute relative error (AbsRel), square relative error (SqRel), root mean square error (RMSE), logarithmic root mean square error (RMSElog) and different threshold accuracy (δ<1.25, δ<1.25 2 and δ<1.25 3 ) is calculated as:

[0083]

[0084]

[0085]

[0086]

[0087]

[0088] where d and d * are the predicted depth value and the true depth value respectively, and D is the set of all predicted values ​​in the image.

[0089] Table 1 Comparison results between the method of the present invention and Monodepth2 (1)

[0090]

[0091] Table 2 Comparison results between the method of the present invention and Monodepth2 (2)

[0092]

[0093] besides, Figure 4 to Figure 7A comparison diagram of the depth result visualization is also shown, where (a) is the image to be estimated, (b) is the result diagram of estimation using the Monodepth2 method with M as training data, and (c) is the depth result diagram predicted using the method of the present invention. It can be seen that the depth prediction of the model of the present invention is more accurate, especially in the prediction of details such as target edges and relatively fine objects, and the advantages of the present invention can be more clearly seen.

Claims

1. A self-supervised monocular depth estimation method based on attention-guided feature fusion, characterized in that: The following steps are involved: Step 1: Use continuous video frames or binocular images as the data set, adjust the images to the same size and use them as training sets for data augmentation; Step 2: Build a self-supervised monocular depth estimation framework based on attention-guided feature fusion, including an improved depth estimation network and pose estimation network: The improved depth estimation network includes an encoder and a decoder connected in sequence, wherein the encoder uses ResNet18, the output of the encoder is connected to the decoder, the decoder has a 5-layer structure, each layer includes a convolution and upsampling module, wherein the 2nd, 3rd, 4th, and 5th layers are connected in sequence with a spatial cross attention module and a depth estimation module; the output of the encoder is also connected to a channel self-attention module, and the output of the channel self-attention module is respectively connected to the input of each spatial cross attention module; Step 3: Design a loss function and use the data augmented training set and validation set to train the self-supervised monocular depth estimation framework based on attention-guided feature fusion; Step 4: Input the image to be estimated, use the trained and improved depth estimation network to perform depth estimation on the image to be estimated and output the result; In the specific operation of the channel self-attention module, the feature similarity S of the input feature E is calculated by matrix multiplication, and the attention map A is obtained through the Softmax layer. c Finally, the attention map is multiplied by the original feature and summed with each element in the original feature to obtain the enhanced feature The spatial cross-attention feature fusion module enhances the input features Do the following: It is upsampled to 40×128 resolution using neighboring point interpolation and converted into query features through 1×1 convolution: Query = Q(x); for X, it is also downsampled to 40×128 resolution using average pooling, and 1×1 convolution is used to obtain key and value features: Key = K(x) and Value = V(x), and the spatial cross attention map is obtained by matrix multiplication. Finally, the fusion feature F is obtained.

2. The method for self-supervised monocular depth estimation based on attention-guided feature fusion as claimed in claim 1, characterized in that: The data augmentation method in step 1 includes random horizontal flipping, random brightness, contrast, saturation and hue jittering performed in sequence.

3. The self-supervised monocular depth estimation method based on attention-guided feature fusion as claimed in claim 1, characterized in that The loss function uses image reprojection loss and smoothness loss, and the formulas are: Among them, L ph represents the reprojection loss, I t and I s→t are the original image and the reconstructed image at time t, respectively. SSIM uses a 3×3 pixel window to calculate the similarity of images. α and β are hyperparameters. s represents the smoothness loss, d t * is the inverse of the average normalized depth at time t; In order to solve the occluded area and eliminate the target that is stationary relative to the camera motion, the minimum reprojection loss and auto-mask are used in the loss function for improvement: Where μ is an auto-mask, and the condition in [] is 1 if it is satisfied, and 0 if it is not satisfied; Then the total loss function L is: Among them, L p is the minimum photometric error, μ is the auto-mask, S=4 is the number of layers, and λ is the weight of the smoothness loss.

4. The method for self-supervised monocular depth estimation based on attention-guided feature fusion as claimed in claim 1, characterized in that: Both the depth estimation network and the pose estimation network are trained using the Adam optimizer. During the training process, the depth estimation network inputs a single RGB image and outputs the corresponding depth map. ResNet18 is used as the network skeleton and convolutional pooling layers are used for step-by-step downsampling. The decoder part uses convolution and step-by-step upsampling. The spatial information in the original input image and the edge information in the image will be gradually restored, and a jump connection structure is used, that is, the features of each layer of the decoder are fused with the features in the corresponding encoder in the channel by splicing, providing multi-scale hierarchical information to achieve a more refined effect; the pose estimation network is designed based on ResNet18, and can input two RGB images to estimate the 6-degree-of-freedom relative pose rotation and translation parameters.