Semantic discrete monocular depth estimation method based on adaptive pixel clustering

Through the combination of adaptive pixel clustering and cross-semantic alignment modules, combined with the deformable feature pyramid module of sparse attention, the problem of simultaneously considering the internal continuity and inter-object discreteness in monocular depth estimation is solved, reducing complexity. Improved estimation accuracy.

CN118570271AActive Publication Date: 2024-08-30WUHAN INST OF TECH

Patent Information

Application Number
CN202410721631.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2024-08-30
Estimated Expiration
2044-06-05

AI Technical Summary

Technical Problem

It is difficult for existing monocular depth estimation methods to simultaneously consider the continuity of depth within an object and the discreteness of depth between objects, and the standard Transformer has a quadratic complexity problem in the depth estimation decoder.

Method used

The semantic discrete monocular depth estimation method based on adaptive pixel clustering is adopted, combined with the adaptive pixel clustering module and the cross-semantic alignment module to semantically discrete the deep features of the encoder, and multi-scale through the deformable feature pyramid module of sparse attention. Feature fusion.

Benefits of technology

It achieves simultaneous attention to the continuity of depth within the object and the discreteness of the depth between objects, reduces the complexity brought by the standard Transformer, and improves the accuracy and efficiency of depth estimation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570271A
    Figure CN118570271A
Patent Text Reader

Abstract

The invention provides a semantic discrete monocular depth estimation method based on adaptive pixel clustering, and relates to the technical field of image processing. The method specifically comprises the following steps: S1, preparing a data set training model; s2, constructing a semantic discrete monocular depth estimation network based on adaptive pixel clustering; s3, constructing a depth estimation encoder; s4, designing a multi-scale deformable feature refining module, and further refining the features of the depth estimation encoder; s5, designing a semantic discrete decoder; s6, inputting RGB images in the NYU data set and the KITTI data set and the corresponding depth map into a semantic discrete monocular depth estimation network based on adaptive pixel clustering for training, optimizing the weight of a network model through a scale invariant loss function, and obtaining and storing a monocular depth estimation model; and S6, inputting an RGB image, performing reasoning through the trained monocular depth estimation model, and returning a predicted depth map. According to the method, the continuity of the internal depths of the objects can be concerned, and the discreteness of the depths between the objects can also be concerned.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a semantic discrete monocular depth estimation method based on adaptive pixel clustering. Background Art

[0002] Monocular depth estimation based on ordered regression has been shown to be a promising approach to replace geometric constraints. Fu et al. proposed to divide the depth range into increasing intervals and designed a pixel-to-pixel ordered regression loss function to simulate the ordered relationship of these depth sub-intervals. Bhat et al. proposed an adaptive bins strategy for ordered regression monocular depth estimation, and then proposed to use all layers of the decoder to predict the local neighborhood depth distribution at each pixel. Shao et al. proposed an iterative elastic box depth interval discretization strategy, which improved the previous ordered regression method and achieved state-of-the-art performance.

[0003] After a long period of development, the monocular depth estimation task has made great progress compared to traditional methods. The current mainstream method is to combine it with deep learning. The most advanced methods often use convolutional neural networks or multi-scale Transformers as their backbone networks. Most methods are either regression tasks based on geometric constraints or ordered regression tasks with explicitly discrete depth ranges. However, due to the complex geometric scenes in the real world, it is difficult to model various arbitrary depth patterns through the geometric constraints of a picture, and explicitly discrete depth values ​​of each pixel may destroy the inherent depth distribution relationship between adjacent pixels. In addition, the depth distribution in real scenes is both continuous and discrete. The depth between objects is often discrete, and only the depth value inside the object has a certain degree of continuity. The existing technology cannot simultaneously consider the continuity of the depth inside the object and the discreteness of the depth between objects.

[0004] Therefore, a semantic discrete monocular depth estimation method based on adaptive pixel clustering is provided to solve the above problems. Summary of the invention

[0005] The present invention provides a semantically discrete monocular depth estimation method based on adaptive pixel clustering, which combines an adaptive pixel clustering module for semantically discretizing the deep features of the encoder and a cross-semantic alignment module to align the discretized feature map to a larger resolution, which can pay attention to both the continuity of the depth inside the object and the discreteness of the depth between objects. At the same time, the deformable feature pyramid module with sparse attention is used for multi-scale feature fusion to solve the quadratic complexity problem brought by the standard Transformer as a depth estimation decoder.

[0006] To achieve the above object, the present invention provides a semantic discrete monocular depth estimation method based on adaptive pixel clustering, which specifically comprises the following steps:

[0007] S1. Prepare the dataset training model. The dataset includes the depth estimation indoor NYU dataset and the outdoor KITTI dataset.

[0008] S2. Construct a semantic discrete monocular depth estimation network based on adaptive pixel clustering. The network consists of three parts: depth estimation encoder, multi-scale deformable feature refinement module and semantic discrete decoder.

[0009] S3. Build a depth estimation encoder and extract multi-scale features by using a multi-scale visual Transformer pre-trained on the ImageNet dataset as a depth estimation encoder;

[0010] S4. Design a deformable feature refinement module to further refine the depth estimation encoder features through multi-scale deformable attention;

[0011] S5. Design a semantic discrete decoder, which includes an adaptive pixel clustering module, a deformable feature pyramid module, and a cross-semantic alignment module.

[0012] S6. Compare the RGB images in the NYU and KITTI datasets with the corresponding depth Figure 1 The image is input into a semantic discrete monocular depth estimation network based on adaptive pixel clustering for training, and the network model weights are optimized through a scale-invariant loss function to obtain a monocular depth estimation model and save it.

[0013] S7. Input the RGB image, perform inference through the trained monocular depth estimation model, and return the predicted depth map.

[0014] Preferably, in step S1, the NYU dataset includes a training set and a test set, the training set includes 24,231 samples, the test set includes 654 samples, the NYU dataset includes 464 indoor scenes, the indoor scenes include RGB images and quasi-density depth images with a resolution of 640×480; the KITTI dataset provides stereo images of outdoor scenes and corresponding 3D laser scanning depth maps, and the dataset includes 23,488 pairs of training images and 697 test images. The resolution of the RGB image in the KITTI dataset is about 1241×376, but the corresponding depth image has a large amount of missing data and low density.

[0015] Preferably, in step S2, the following steps are specifically included: S1: extracting multi-scale encoder features using a depth estimation encoder;

[0016] S2: Use the multi-scale deformable feature refinement module to further refine the multi-scale encoder features;

[0017] S3: Use semantic discrete decoder for multi-scale feature fusion and semantic discretization.

[0018] Preferably, in step S3, a Swin Transformer pre-trained on the ImageNet dataset is used as an encoder. The Swin Transformer includes four variants: Swin-T, Swin-S, Swin-B, and Swin-L. Swin-L is used as an encoder for monocular depth estimation to extract multi-scale features.

[0019] Preferably, in step S4, the coding features at different resolutions are refined by a multi-scale deformable feature refinement module;

[0020] set up is the multi-scale feature map of the input, let For the normalized coordinates of the reference point of each query element q, the multi-scale deformable feature refinement module is expressed as:

[0021]

[0022] Among them, z q represents content features, m represents the attention head index, l represents the input feature layer index, k represents the sampling point, Δp mlqk and A mlqk denote the sampling offset and attention weight of the kth sampling point of the lth feature layer and the mth attention head, respectively, and W m and W' m represents the learnable weight, φ l Represents normalized coordinates The processing function, x l Represents the encoder features of the lth layer.

[0023] Preferably, in step S5, the following steps are specifically included:

[0024] S51: The adaptive pixel clustering module refines the minimum resolution features extracted by the encoder and clusters them to obtain a feature map composed of semantic discrete blocks at different spatial positions with scene spatial information;

[0025] S52: The deformable feature pyramid module includes three layers of the same structure, which uses deformable cross attention to fuse encoder refinement features from different resolutions and decoder features from different levels in a feature pyramid manner;

[0026] The mathematical expression of deformable cross attention is as follows:

[0027]

[0028] Where M represents the total number of attention heads, K represents the total number of sampled keys, K<<HW,W m , and W mqk represents a learnable weight; q indexes a content feature z q The query element, Δp mqk and σ(W mqk x) represent the sampling offset and attention weight of the kth sampling point in the mth attention head, respectively, where σ represents the softmax function, and v and x represent input features from different sources.

[0029] S53: The cross-semantic alignment module aligns the feature map discretized by the adaptive pixel clustering module to the feature space with large resolution. The cross-semantic alignment module includes a channel convolution attention module to model its channel features. The channel convolution attention module consists of a deep convolution, a Gaussian error linear unit, an SE block and a normal convolution. The output features of the channel convolution attention module are fused with the features after the deformable feature pyramid module to calculate the cross-semantic cross attention. The cross-semantic alignment module is expressed as:

[0030] CCA(x)=Conv 1×1 (SE(GELU(DW 3×3 (x))))

[0031]

[0032] CSA(Q i ,K,V) i =Softmax(Q i K T / d)V

[0033] Among them DW 3×3 Represents 3×3 depth convolution, Conv 1×1 represents 1×1 ordinary convolution, represents the linear projection function, and the i+1th layer output of the cross-semantic alignment module is upsampled and used as the i-th layer input of the deformable feature pyramid module for feature fusion with the encoder refinement features of the same resolution. x represents the output feature of the adaptive pixel clustering module, represents the output feature of the i-th layer of the deformable feature pyramid module, Q i ,K,V represent the query, key and value of cross attention respectively, K T represents the transpose of the matrix K, and d represents the scale factor.

[0034] Preferably, in step S51, three processes are included: clustering, intra-cluster feature aggregation, and aggregate feature allocation;

[0035] The mathematical expressions of clustering and intra-cluster feature aggregation process are as follows:

[0036]

[0037] Where σ represents the softmax function, represents the dot product operation, α and β are learnable parameters, A represents the features after pixel aggregation in each cluster, and C v and C x Represent different sets of center points, S represents the similarity matrix, s i represents a subset of the similarity matrix S, F v and F x They represent different sets of pixels respectively, and L represents the normalization factor.

[0038] Preferably, in step S6: compare the RGB images in the NYU and KITTI datasets with the corresponding depth Figure 1 The image is input into the semantic discrete monocular depth estimation network based on adaptive pixel clustering for training, and the model weights are optimized through the scale-invariant loss function to obtain the monocular depth estimation model and save it. The scale-invariant loss function is as follows:

[0039]

[0040] Among them, d i represents the ground truth depth, g i Represents the logarithmic difference between the true depth and the predicted depth, Represents the predicted depth, T represents the number of valid pixels in the true label, and λ is a hyperparameter that controls the scale invariance of the loss; λ = 1 represents complete scale invariance, and λ = 0 represents the ordinary L2 loss function.

[0041] Preferably, in step S7, during the inference phase, an RGB image is input, inference is performed using a trained monocular depth estimation model, and a predicted depth map is returned.

[0042] Therefore, the present invention adopts the above-mentioned semantic discrete monocular depth estimation method based on adaptive pixel clustering, combined with an adaptive pixel clustering module for discretizing the deep features of the encoder and a cross-semantic alignment module to align the discretized feature map to a larger resolution, which can pay attention to both the continuity of the depth inside the object and the discreteness of the depth between objects. At the same time, the deformable feature pyramid module with sparse attention is used for multi-scale feature fusion to solve the quadratic complexity problem brought by the standard Transformer as a depth estimation decoder.

[0043] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 It is a flow chart of a semantic discrete monocular depth estimation method based on adaptive pixel clustering of the present invention;

[0045] Figure 2 It is a network structure diagram of a semantic discrete monocular depth estimation method based on adaptive pixel clustering of the present invention;

[0046] Figure 3 This is the result graph of the present invention on the NYU dataset;

[0047] Figure 4 This is the result graph of the present invention on the KITTI dataset. DETAILED DESCRIPTION

[0048] The technical solution of the present invention is further described below through the accompanying drawings and embodiments.

[0049] Unless otherwise defined, the technical terms or scientific terms used in the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The words "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0050] Example

[0051] like Figure 1 As shown, the present invention provides a semantic discrete monocular depth estimation method based on adaptive pixel clustering, which specifically includes the following steps:

[0052] S1. Prepare the dataset training model. The dataset includes the indoor NYU dataset for depth estimation and the outdoor KITTI dataset. In step S1, the NYU dataset includes a training set and a test set. The training set contains 24,231 samples and the test set contains 654 samples. The NYU dataset includes 464 indoor scenes. The indoor scenes include RGB images and quasi-density depth images with a resolution of 640×480. The KITTI dataset provides stereo images of outdoor scenes and corresponding 3D laser scanning depth maps. The dataset includes 23,488 pairs of training images and 697 test images. The resolution of the RGB images in the KITTI dataset is about 1241×376, but the corresponding depth images have a large amount of missing data and low density.

[0053] S2. Construct a semantic discrete monocular depth estimation network based on adaptive pixel clustering. The network consists of three parts: depth estimation encoder, multi-scale deformable feature refinement module and semantic discrete decoder. In step S2, the multi-scale encoder features are first extracted using the depth estimation encoder, and then the multi-scale deformable feature refinement module is used to further refine the multi-scale encoder features, and then the semantic discrete decoder is used to perform multi-scale feature fusion and semantic discretization.

[0054] S3. Build a depth estimation encoder and extract multi-scale features by using the multi-scale visual Transformer pre-trained on the ImageNet dataset as the depth estimation encoder. In step S3, the Swin Transformer pre-trained on the ImageNet dataset is used as the encoder. Swin Transformer includes four variants: Swin-T, Swin-S, Swin-B, and Swin-L. Swin-L is used as the encoder for monocular depth estimation to extract multi-scale features.

[0055] S4, designing a deformable feature refinement module to further refine the depth estimation encoder features through multi-scale deformable attention; In step S4, the encoding features at different resolutions are refined through the multi-scale deformable feature refinement module;

[0056] set up is the multi-scale feature map of the input, let For the normalized coordinates of the reference point of each query element q, the multi-scale deformable feature refinement module is expressed as:

[0057]

[0058] Among them, z q represents content features, m represents the attention head index, l represents the input feature layer index, k represents the sampling point, Δp mlqk and Amlqk denote the sampling offset and attention weight of the kth sampling point of the lth feature layer and the mth attention head, respectively, and W m and W' m represents the learnable weight, φ l Represents normalized coordinates The processing function, x l Represents the encoder features of the lth layer.

[0059] S5, designing a semantic discrete decoder, the semantic discrete decoder includes an adaptive pixel clustering module, a deformable feature pyramid module and a cross-semantic alignment module; in step S5, specifically including the following steps:

[0060] S51: The adaptive pixel clustering module refines the minimum resolution features extracted by the encoder and clusters them to obtain a feature map composed of semantic discrete blocks of different spatial positions with scene spatial information; in step S51, three processes are included: clustering, intra-cluster feature aggregation, and aggregate feature allocation;

[0061] For each input feature X∈R C×H×W , where H and W represent the height and width of the input feature respectively, and C represents the number of channels of the input feature.

[0062] First, X∈R C×H×W Linear projection to P x ∈R C×H×W and P v ∈R C×H×W To perform similarity calculation, and reshape it to obtain the pixel point set F x ∈R N×D and F v ∈R N×D , where N = H × W represents all pixels and D represents the sequence length;

[0063] Through two different depth convolutions, the kernel size is set to 7×7, the step size is set to 3, and the padding size is set to half of the kernel size. x and P v The resolution is reduced to 1 / 3 of the original. In this process, a 7×7 sliding window is used to adapt the pixels in the window to a center point, and then a reshaping operation is performed to obtain the center point set Cx∈R MxD and C v ∈R M×D , where M = H / 3 × W / 3 represents the number of clusters and the number of centers within the cluster. Calculate the set of all pixels F x ∈R N×D With the center point set C x ∈R M×D The pairwise cosine similarity S∈R between M×N, we can get the similarity between all center points and each pixel, and the similarity matrix S∈R M×N A Mask operation is performed to retain only the maximum value in the M dimension of the similarity matrix and set the rest to zero. Based on this result, each pixel is assigned to the center that is most similar to it, thus obtaining M different clusters.

[0064] In extreme cases, some clusters may not contain a single pixel. It is necessary to dynamically aggregate the features within the cluster to one pixel based on the similarity between all points in the cluster and the center, and then perform a softmax operation on the inter-cluster dimension to maintain a discrete relationship between the aggregated feature points.

[0065] Specifically, the result of the mask operation on the similarity matrix S is compared with F v By performing a dot product operation, we can obtain the feature A∈R after the pixels in each cluster are aggregated. M×D The dot product operation includes two processes: assigning pixels to separate clusters and aggregating features within clusters. Because matrix multiplication includes multiplication and addition between vectors, multiplication is to assign pixels to corresponding clusters, and addition is to aggregate all pixels in the cluster into one pixel.

[0066] The mathematical expressions of clustering and intra-cluster feature aggregation process are as follows:

[0067]

[0068] Where σ represents the softmax function, represents the dot product operation, α and β are learnable parameters, A represents the features after pixel aggregation in each cluster, and C v and C x Represent different sets of center points, S represents the similarity matrix, s i represents a subset of the similarity matrix S, F v and F x They represent different sets of pixels respectively, and L represents the normalization factor.

[0069] In the extreme case, there is no pixel, and the aggregate feature A∈R M×D With the center point set C v ∈R M×D Add to ensure the validity of the aggregated features;

[0070] The aggregated features are dynamically assigned to each point in the cluster according to similarity, so that each point can share the features of all points in the cluster while maintaining discrete relationships between different clusters.

[0071] Specifically, the similarity matrix S∈R M×N The result after Masking and the aggregated feature A∈R M×DPerform dot product operation. After reshaping, the feature map resolution is restored to the original input size, so that the output feature map has scene spatial information and is composed of semantic discrete blocks at different spatial positions, rather than a feature embedding. Then feed the result of the aggregate feature allocation to an MLP to obtain the final output feature of the adaptive pixel clustering module.

[0072] S52: The deformable feature pyramid module includes three layers of the same structure, which uses deformable cross attention to fuse encoder refinement features from different resolutions and decoder features from different levels in a feature pyramid manner;

[0073] The mathematical expression of deformable cross attention is as follows:

[0074]

[0075] Where M represents the total number of attention heads, K represents the total number of sampled keys, K<<HW,W m , and W mqk represents a learnable weight; q indexes a content feature z q The query element, Δp mqk and σ(W mqk x) represent the sampling offset and attention weight of the kth sampling point in the mth attention head, respectively, where σ represents the softmax function, and v and x represent input features from different sources.

[0076] S53: The cross-semantic alignment module aligns the feature map discretized by the adaptive pixel clustering module to a feature space with a larger resolution. The cross-semantic alignment module includes a channel convolutional attention module to model its channel features. The channel convolutional attention module consists of a deep convolution, a Gaussian error linear unit, an SE block, and a normal convolution. The output features of the channel convolutional attention module are fused with the features after the deformable feature pyramid module to calculate the cross-semantic cross attention. The cross-semantic alignment module is expressed as:

[0077] CCA(x)=Conv 1×1 (SE(GELU(DW 3×3 (x))))

[0078]

[0079] CSA(Q i ,K,V) i =Softmax(Q i K T / d)V

[0080] Among them DW 3×3 Represents 3×3 depth convolution, Conv1×1 represents 1×1 ordinary convolution, represents the linear projection function, and the i+1th layer output of the cross-semantic alignment module is upsampled and used as the i-th layer input of the deformable feature pyramid module for feature fusion with the encoder refinement features of the same resolution. x represents the output feature of the adaptive pixel clustering module, represents the output feature of the i-th layer of the deformable feature pyramid module, Q i ,K,V represent the query, key and value of cross attention respectively, K T / d means the transpose of matrix K divided by a scaling factor d.

[0081] S6. Compare the RGB images in the NYU and KITTI datasets with the corresponding depth Figure 1 The image is input into a semantic discrete monocular depth estimation network based on adaptive pixel clustering for training, and the network model weights are optimized through a scale-invariant loss function to obtain a monocular depth estimation model and save it.

[0082] In step S6: the RGB images in the NYU and KITTI datasets are compared with the corresponding depth Figure 1 The image is input into the semantic discrete monocular depth estimation network based on adaptive pixel clustering for training, and the model weights are optimized by the scale-invariant loss function to obtain the monocular depth estimation model and save it. The scale-invariant loss function is as follows:

[0083]

[0084] Among them, d i represents the ground truth depth, g i Represents the logarithmic difference between the true depth and the predicted depth, Represents the predicted depth, T represents the number of valid pixels in the true label, and λ is a hyperparameter that controls the scale invariance of the loss; λ = 1 represents complete scale invariance, and λ = 0 represents the ordinary L2 loss function.

[0085] S7, input RGB image, perform reasoning through the trained monocular depth estimation model, and return the predicted depth map. In step S6, the reasoning stage, input RGB image, perform reasoning using the trained monocular depth estimation model, and return the predicted depth map.

[0086] Comparative Example

[0087] This scheme uses commonly used metrics in the field of monocular depth estimation to perform quantitative evaluation on the NYU dataset and the KITTI dataset, including absolute relative error (Abs Rel), square relative error (Squ Rel), linear root mean square error (RMSE), exponential root mean square error (RMSE log), average log10 error and accuracy.

[0088] This scheme qualitatively and quantitatively compares the proposed method with nine previous state-of-the-art methods on the indoor dataset NYU. The results are as follows: Figure 3 As shown in Table 1. From Table 1, it can be seen that the method of this scheme exceeds the previous state-of-the-art method. At the same time, the indoor dataset has larger objects, which is conducive to the semantic discretization of the adaptive pixel clustering module. Figure 3 The proposed method is qualitatively compared with the previous methods AdaBins and NeWCRFs in Figure 1. The visualization shows that the proposed method estimates the depth more accurately, such as the depth values ​​of the book (row 1) and carpet (rows 2 and 4) in the RGB image should be consistent with the floor of the room. At the same time, the proposed method estimates the objects more clearly, such as the bench (row 2), laptop (row 3) and electric fan (row 5) in the RGB image.

[0089] Table 1

[0090] method Backbone AbsRel↓ RMSE↓ log10↓ δ1↑ δ2↑ δ3↑ TransDepth ResNet-50+ViT 0.106 0.365 0.045 0.900 0.983 0.996 DPT VIT-Hybrid 0.110 0.357 0.045 0.904 0.988 0.998 LapDepth ResNext-101 0.110 0.393 0.047 0.885 0.979 0.995 AdaBins EfficientNet-B5 0.103 0.364 0.044 0.903 0.984 0.997 NewCRFs Swin-L 0.095 0.334 0.041 0.922 0.992 0.998 NDDepth Swin-L 0.087 0.311 0.038 0.936 0.991 0.998 IEBins Swin-L 0.087 0.314 0.038 0.936 0.992 0.998 MG Swin-L 0.087 0.311 - 0.933 - - VA-DepthNet Swin-L 0.086 0.304 - 0.937 0.992 - The present invention Swin-L 0.086 0.313 0.037 0.939 0.993 0.998

[0091] This scheme qualitatively and quantitatively compares the proposed method with nine previous state-of-the-art methods on the outdoor dataset KITTI. The results are as follows: Figure 4 As shown in Table 2. The experimental results of the method proposed in this scheme on KITTI did not exceed the previous most advanced method, but only achieved comparable performance. There may be two reasons for this result: First, since KITTI is an outdoor dataset, there are a large number of objects with many small branches, such as trees and shrubs, in the image. However, after multiple downsampling, the branches of these objects may have lost their information on the encoder feature map with the smallest resolution. Second, the batch size of the experiment in this scheme may be too small for the KITTI dataset. Figure 4 The proposed method is qualitatively compared with the previous methods AdaBins and NeWCRFs. The visualization shows that the proposed method can more accurately estimate the depth information of farther objects.

[0092] Table 2

[0093]

[0094] Therefore, the present invention adopts the above-mentioned semantic discrete monocular depth estimation method based on adaptive pixel clustering, combined with an adaptive pixel clustering module for discretizing the deep features of the encoder and a cross-semantic alignment module to align the discretized feature map to a larger resolution, which can pay attention to both the continuity of the depth inside the object and the discreteness of the depth between objects. At the same time, the deformable feature pyramid module with sparse attention is used for multi-scale feature fusion to solve the quadratic complexity problem brought by the standard Transformer as a depth estimation decoder.

[0095] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.

Claims

1. A semantic discrete monocular depth estimation method based on adaptive pixel clustering, characterized in that: The specific steps include: S1. Prepare the dataset training model. The dataset includes the depth estimation indoor NYU dataset and the outdoor KITTI dataset. S2. Construct a semantic discrete monocular depth estimation network based on adaptive pixel clustering, including three parts: depth estimation encoder, multi-scale deformable feature refinement module and semantic discrete decoder; S3. Build a depth estimation encoder and extract multi-scale features by using a multi-scale visual Transformer pre-trained on the ImageNet dataset as a depth estimation encoder; S4, design a multi-scale deformable feature refinement module to further refine the depth estimation encoder features; S5. Design a semantic discrete decoder, which includes an adaptive pixel clustering module, a deformable feature pyramid module, and a cross-semantic alignment module. S6. Input the RGB images and corresponding depth maps in the NYU and KITTI datasets into a semantic discrete monocular depth estimation network based on adaptive pixel clustering for training, and optimize the network model weights through a scale-invariant loss function to obtain a monocular depth estimation model and save it; S7. Input the RGB image, perform inference through the trained monocular depth estimation model, and return the predicted depth map.

2. The method for semantic discrete monocular depth estimation based on adaptive pixel clustering according to claim 1, characterized in that: In step S1, the NYU dataset contains a training set and a test set. The training set contains 24,231 samples and the test set contains 654 samples. The NYU dataset includes 464 indoor scenes. The indoor scenes include RGB images and quasi-density depth images with a resolution of 640×480. The KITTI dataset provides stereo images of outdoor scenes and corresponding 3D laser scanning depth maps. The KITTI dataset includes 23,488 pairs of training images and 697 test images. The resolution of the RGB images in the KITTI dataset is approximately 1241×376.

3. The method for semantic discrete monocular depth estimation based on adaptive pixel clustering according to claim 1, characterized in that: In step S2, specifically The following steps are involved: S1: Extract multi-scale encoder features using the depth estimation encoder; S2: Use the multi-scale deformable feature refinement module to further refine the multi-scale encoder features; S3: Use semantic discrete decoder for multi-scale feature fusion and semantic discretization.

4. The method for semantic discrete monocular depth estimation based on adaptive pixel clustering according to claim 1, characterized in that: In step S3, the Swin Transformer pre-trained on the ImageNet dataset is used as the encoder. Swin Transformer includes four variants: Swin-T, Swin-S, Swin-B, and Swin-L. Swin-L is used as the encoder for monocular depth estimation to extract multi-scale features.

5. The method for semantic discrete monocular depth estimation based on adaptive pixel clustering according to claim 1, characterized in that: In step S4, the coding features at different resolutions are refined by a multi-scale deformable feature refinement module; set up is the multi-scale feature map of the input, let The normalized coordinates of the reference point of each query element q, q indexes a content feature z q The query element of the multi-scale deformable feature refinement module is expressed as: Among them, z q represents content features, m represents the attention head index, l represents the input feature layer index, k represents the sampling point, Δp mlqk and A mlqk denote the sampling offset and attention weight of the kth sampling point of the lth feature layer and the mth attention head, respectively, and W m and W′ m represents the learnable weight, φ l Represents normalized coordinates The processing function, x l Represents the encoder features of the lth layer.

6. The method of semantic discrete monocular depth estimation based on adaptive pixel clustering according to claim 1, characterized in that: In step S5, the following steps are specifically included: S51: The adaptive pixel clustering module refines the minimum resolution features extracted by the encoder and clusters them to obtain a feature map composed of semantic discrete blocks at different spatial positions with scene spatial information; S52: The deformable feature pyramid module includes three layers of the same structure, which uses deformable cross attention to fuse encoder refinement features from different resolutions and decoder features from different levels in a feature pyramid manner; The mathematical expression of deformable cross attention is as follows: Where M represents the total number of attention heads, K represents the total number of sampled keys, K<<HW,W m , and W mqk represents a learnable weight; q indexes a content feature z q The query element, Δp mqk and σ(W mqk x) represent the sampling offset and attention weight of the kth sampling point in the mth attention head, where σ represents the softmax function, and u and x represent input features from different sources; S53: The cross-semantic alignment module aligns the feature map discretized by the adaptive pixel clustering module to the feature space with large resolution. The cross-semantic alignment module includes a channel convolution attention module to model its channel features. The channel convolution attention module consists of a deep convolution, a Gaussian error linear unit, an SE block and a normal convolution. The output features of the channel convolution attention module are fused with the features after the deformable feature pyramid module to calculate the cross-semantic cross attention. The cross-semantic alignment module is expressed as: CCA(x)=Conv 1×1 (SE(GELU(DW 3×3 (x)))) CSA(Q i ,K,V) i =Softmax(Q i K T / d)V Among them DW 3×3 Represents 3×3 depth convolution, Conv 1×1 represents 1×1 ordinary convolution, represents the linear projection function, and the i+1th layer output of the cross-semantic alignment module is upsampled and used as the i-th layer input of the deformable feature pyramid module for feature fusion with the encoder refinement features of the same resolution. x represents the output feature of the adaptive pixel clustering module, represents the output feature of the i-th layer of the deformable feature pyramid module, Q i , K, V represent the query, key and value of cross attention respectively, K T represents the transpose of the matrix K, and d represents the scale factor.

7. The method for semantic discrete monocular depth estimation based on adaptive pixel clustering according to claim 1, characterized in that: In step S51, three processes are included: clustering, intra-cluster feature aggregation, and aggregate feature allocation; The mathematical expressions of clustering and intra-cluster feature aggregation process are as follows: Where σ represents the softmax function, represents the dot product operation, α and β are learnable parameters, A represents the features after pixel aggregation in each cluster, and C v and C x Represent different sets of center points, S represents the similarity matrix, s i represents a subset of the similarity matrix S, F v and F x They represent different sets of pixels respectively, and L represents the normalization factor.

8. The method of semantic discrete monocular depth estimation based on adaptive pixel clustering according to claim 1, characterized in that: In step S6: the RGB images in the NYU and KITTI datasets and the corresponding depth maps are input into the semantic discrete monocular depth estimation network based on adaptive pixel clustering for training, and the model weights are optimized by the scale-invariant loss function to obtain the monocular depth estimation model and save it. The scale-invariant loss function is as follows: Among them, d i represents the ground truth depth, g i Represents the logarithmic difference between the true depth and the predicted depth, Represents the predicted depth, T represents the number of valid pixels in the true label, and λ is a hyperparameter that controls the scale invariance of the loss; λ = 1 represents complete scale invariance, and λ = 0 represents the ordinary L2 loss function.

9. The method of semantic discrete monocular depth estimation based on adaptive pixel clustering according to claim 1, characterized in that: In step S7, the inference stage, the RGB image is input, and the trained monocular depth estimation model is used for inference, and the predicted depth map is returned.

Citation Information

Patent Citations

  • A monocular depth estimation method of an augmented ordinal depth relation

    CN109035310A

  • Monocular depth estimation method fusing multi-modal information

    CN114596474A

  • Transform-based monocular depth estimation algorithm

    CN115131418A

  • Monocular depth prediction algorithm based on multi-scale progressive interaction and aggregation cross attention features

    CN116485860A

Cited By

  • Monocular depth estimation method and device based on bidirectional state space model, and medium

    CN119295523A

  • Multi-modal monocular depth estimation method based on high-order features and attention mechanism

    CN119515944A

  • Monocular image depth estimation method, device and equipment based on diffusion model and target prompt

    CN120147390A

  • Self-supervised monocular depth estimation method based on spatial-semantic prior feature enhancement

    CN120580273A

  • Navigation semantic segmentation method based on hierarchical multi-scale Transform

    CN120655928A