Street depth map generation method based on CLIP model and generative model

Through the combination of the CLIP model and the Diffusion model, the problems of discomfort and insufficient cross-modal information fusion in monocular depth estimation are solved, and high-precision street depth map generation is achieved, which is suitable for fields such as smart cars and urban planning.

CN118334100BActive Publication Date: 2024-09-13BEIJING UNIV OF CIVIL ENG & ARCHITECTURE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410409637.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-07
Publication Date
2024-09-13
Estimated Expiration
2044-04-07

AI Technical Summary

Technical Problem

Monocular depth estimation methods face the problems of ill-posedness and insufficient cross-modal information fusion, making it difficult to accurately obtain scene depth information from a single image.

Method used

The CLIP model and the generative diffusion model Diffusion are used to generate street depth maps through cross-modal representation of images and text. The text encoder and image encoder of the CLIP model are used to generate depth description templates, and the multi-layer perceptron and Diffusion model are combined. Perform distance encoding mapping to generate high-precision depth maps.

Benefits of technology

It achieves high-precision depth map generation for street scenes, improves the accuracy and robustness of depth estimation, provides stronger interpretability, and is suitable for fields such as smart cars and urban planning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118334100B
    Figure CN118334100B
Patent Text Reader

Abstract

The present invention relates to a method for generating a street space depth map based on a generative model and a CLIP model. First, a text code describing a distance is generated by a text encoder of the CLIP model, and a street image is converted into an image code by an image encoder of the CLIP model. The cosine similarity operation is performed between the code and the image code to obtain a distance similarity score. The similarity score is converted into a distance code of each block of the original street image by a multi-layer perceptron. A diffusion model Diffusion is introduced as a priori module to map the distance code to the corresponding image code to capture the semantic information contained in the distance code. Finally, a street image depth map is generated by an image decoder to achieve accurate depth modeling of the street space. The method utilizes the cross-modal representation capability of the CLIP model to effectively fuse text and image information and improve the generation accuracy of the depth map. The invention has broad application prospects in the fields of urban planning, autonomous driving, etc.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of monocular depth estimation, and specifically to a method for generating street depth maps based on a CLIP model and a generative model. The method utilizes a multimodal model CLIP and a generative diffusion model Diffusion to estimate street depth and obtain scene depth information from a single street image. The method can be used in application fields such as smart car and robot positioning. Background Art

[0002] Depth estimation is an important part of scene perception, and its results can be applied to unmanned driving, robot positioning, 3D reconstruction and other fields. The traditional depth estimation method uses laser 3D radar to obtain depth information. The laser 3D radar accurately obtains depth information by measuring the laser return time of the laser. However, the equipment cost of this method is high. At the same time, the amount of depth map data obtained is very large and there is a lot of redundancy, which makes it difficult to be widely used in a large range. In contrast, the image-based depth estimation method does not have high hardware requirements, can directly obtain depth information through images, and has a wider range of applications and users.

[0003] Image-based depth estimation methods can be divided into multi-view depth estimation and monocular depth estimation according to needs. In the multi-view depth estimation method, multiple images of the same scene are obtained by observation, the images are matched, and the scene depth information is estimated using the matching information. Among them, classic methods include structure from motion (SFM), depth estimation using image sequences captured by a monocular camera, multi-view reconstruction (MVS) and triangulation. Such methods usually require acceptance images or image sequences as input, require camera information to be known, have strong restrictions on input, and the prediction results are greatly affected by feature selection and matching. Compared with multi-view depth estimation, monocular depth estimation methods that only use a single image for depth estimation are more flexible. However, due to the lack of direct depth information, this method faces the problem of ill-posedness. To solve this problem, early methods extracted depth cues from different angles for depth estimation. Common methods include recovering depth from shadows and obtaining depth from focus or defocus. These strategies aim to exploit special cues present in images to enable monocular depth estimation to more reliably infer the deep structure of the scene in the absence of direct depth information.

[0004] With the rapid development of deep learning, deep neural networks have shown excellent performance in image classification, natural language processing, speech recognition, medical image processing and other fields. Since deep neural networks have powerful feature extraction capabilities, scholars have introduced deep learning technology into the field of depth estimation, hoping to fully extract the depth features of the image with the help of neural networks to obtain more accurate depth estimation results. In recent years, monocular depth estimation methods based on deep learning have flourished, and can be divided into supervised methods, unsupervised methods and semi-supervised methods according to different training methods.

[0005] In order to further improve the performance of monocular depth estimation, the CLIP model and the Diffusion model were introduced. The CLIP model provides cross-modal feature representation for the depth estimation task by learning the shared semantic space between images and texts. Its powerful expression ability enables monocular depth estimation to better understand the semantic information in the image. At the same time, the Diffusion model, as a priori module, introduces richer semantic information for depth estimation by mapping distance encoding to image encoding, thereby improving the accuracy of the estimation results. The introduction of these two models enriches the feature representation and prior information of the monocular depth estimation method, bringing new possibilities for improving the robustness and accuracy of depth estimation. Summary of the invention

[0006] The method of the present invention addresses challenges in the field of depth estimation, including ill-posedness in depth estimation tasks, insufficient cross-modal information fusion, and other issues. The CLIP model is introduced to overcome the shortcomings of cross-modal learning, while flexibly modeling depth estimation with the help of a generative model. Combining the advantages of a large multimodal model, the present invention comprehensively utilizes the rich semantic information from images and texts to provide a more accurate and comprehensive method for generating street depth maps. In this context, the present invention discloses a method for generating street depth maps based on a CLIP model and a generative model.

[0007] In order to achieve the purpose of the present invention, the present invention adopts the following technical solution:

[0008] A method for generating a street depth map based on a CLIP model and a generative model comprises the following steps:

[0009] Step 1: Generate a depth description sentence according to the depth description template, and use the text encoder of the CLIP model to generate a text code describing the distance; at the same time, use the image encoder of the CLIP model to convert the street image into an image code;

[0010] Step 2: Calculate the cosine similarity between the text encoding and the image encoding to obtain the similarity score of the image depth;

[0011] Step 3: Use a multi-layer perceptron to convert the similarity score into the distance code of each block of the original street image;

[0012] Step 4: Introduce the diffusion model as a priori module, capture the semantic information contained in the distance code by using the diffusion model, and then map the distance code to the corresponding image code;

[0013] Step 5: Generate a depth map of the street image based on the obtained image encoding through the image decoder;

[0014] Step 6: Calculate the accuracy of the predicted depth map, fine-tune the model parameters, and output the depth prediction model.

[0015] The specific model training process is as follows:

[0016] The depth dataset is divided into a training set and a test set. The training set data is used to train the depth prediction model, and the test set is used to evaluate the depth prediction accuracy.

[0017] The first step, image encoding and text encoding generation steps are as follows:

[0018] Step 1-1 Image encoding generation

[0019] Input the monocular RGB image I of the test set data into the visual encoder of the CLIP model to obtain the C-dimensional image encoding result. The formula is as follows:

[0020]

[0021] Formula (1) represents the image encoding result calculated by the CLIP model visual encoder. Since the representations of images and texts are aligned in the CLIP model, similar images and texts have similar representations. After passing through a CLIP visual encoder, the image information is mapped to a shared semantic space, which not only contains general image semantics but also captures the distance relationship between different blocks.

[0022] Step 1-2 uses the template to generate a description sentence and performs text encoding through the CLIP model text encoder:

[0023] Set a set of templates M, which contain descriptions of image scenes. For example, the template can be: "This is a [Scene_Classes] photo, and the [Object_Classes] is [Depth_Classes]." Where [Scene_Classes] is the image scene description word, [Object_Classes] is the object name description word in the image, and [Depth_Classes] is the object depth description word. The text encoder of the CLIP network is used to convert the generated description sentence into a text encoding, which is mathematically expressed as:

[0024] T=Tokenizer(M) (2)

[0025]

[0026] In formula (2), T represents the result of text segmentation, and M represents the description template. In formula (3), C txt Indicates the text encoding result. In this algorithm, different semantic tags are applied to form N groups of description sentences, and C-dimensional text encoding is generated through the CLIP network text encoder.

[0027] The second step is to calculate the similarity between image and text:

[0028] Encode the image C img and text encoding C txt Perform L2 normalization. Divide each dimension of the image encoding by its L2 norm. Mathematically expressed as:

[0029]

[0030] Then calculate the cosine similarity of the normalized results to obtain the similarity score between the two. The mathematical expression is as follows:

[0031]

[0032] The third step, distance coding conversion steps are as follows:

[0033] The similarity score is normalized by the softmax function to obtain the depth weight, and then the depth weight is mapped to the distance code through the multi-layer perceptron. This method makes the model pay more attention to the high-weight depth value when estimating the depth, thereby enhancing the model's understanding of the depth relationship and improving the accuracy of depth estimation. This step is mathematically expressed as:

[0034]

[0035] D=MLP(W) (7)

[0036] Where Wi is the weight corresponding to the depth description statement, N is the total number of depth description statements, and D represents the final distance encoding.

[0037] Step 4: Distance coding conversion The specific visual coding steps are as follows:

[0038] Load the Diffusion model, input the distance code D into the Diffusion model, and output the image code after calculation through the Transformer module of the Diffusion model. The image code here is different from the image code generated in step 1. This image code captures the distance semantics and hint semantic information contained in the distance code, providing valuable information for subsequent image decoding.

[0039] Step 5: Visual encoding and decoding to generate depth map steps are as follows:

[0040] Load the pre-trained Diffusion model and input the visual code into the visual decoder of the Diffusion model to generate the corresponding depth image.

[0041] Step 6: Calculate the accuracy of the predicted depth map, fine-tune the model parameters, and output the depth prediction model. The specific steps are:

[0042] In the depth estimation method of the present invention, RMSE (Root Mean Squared Error) is used as the loss function between the depth value prediction and the actual depth value. Specifically, the operation of this step is as follows:

[0043] The Diffusion model is used to predict the depth value of each block in the street scene, and the known depth information is used to obtain the actual depth value of the corresponding block in the street scene. The RMSE loss between the predicted depth value and the actual depth value is calculated. This loss is used to measure the depth estimation performance of the model. The calculation formula of RMSE is as follows:

[0044]

[0045] Using the gradient information of the RMSE loss function, the model parameters are fine-tuned through the back propagation algorithm to improve the accuracy of the model depth estimation. When the loss is less than the set threshold, the prediction model is output. When performing the prediction task, the prediction model weight is loaded, and the operations other than the sixth step are performed to obtain the depth prediction value.

[0046] Beneficial effects of the present invention:

[0047] By combining the CLIP model and the generative model, the present invention can realize the generation of high-precision depth maps for street scenes, and effectively fuse text and image information through cross-modal representation capabilities to improve the accuracy of depth map generation. The present invention introduces a template and a generative model for text description distances, so that the generated distance encoding not only contains numerical information, but also has a semantically rich description, which helps to better understand the relative distance relationship between objects in street scenes. Due to the use of text descriptions, the generated depth map has stronger interpretability. Users can understand the reasons for the depth of each block, not just the numerical value. This is of great significance for applications in fields such as urban planning and autonomous driving. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 A flowchart of a method for generating a street depth map based on a CLIP model and a generative model provided by the present invention. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0050] A street depth map generation method based on CLIP model and generative model, such as Figure 1 As shown, the steps are divided into:

[0051] The first step, image encoding and text encoding generation steps are as follows:

[0052] Step 1-1 Image encoding generation

[0053] Input the monocular RGB image I in the test set data into the visual encoder of the CLIP model to obtain the C-dimensional image encoding result. The formula is as follows:

[0054]

[0055] In formula (1), C img Represents the image encoding result calculated by the CLIP model visual encoder. Since in the CLIP model, the representations of images and texts are aligned, similar images and texts have similar representations. After passing through a CLIP visual encoder, the image information is mapped to a shared semantic space, which not only contains general image semantics but also captures the distance relationship between different blocks.

[0056] Step 1-2 uses the template to generate a description sentence and performs text encoding through the CLIP model text encoder:

[0057] Set a set of templates M, which contain descriptions of image scenes. For example, the template can be: "This is a [Scene_Classes] photo, and the [Object_Classes] is [Depth_Classes]." Where [Scene_Classes] is the image scene description word, [Object_Classes] is the object name description word in the image, and [Depth_Classes] is the object depth description word. The text encoder of the CLIP network is used to convert the generated description sentence into a text encoding, which is mathematically expressed as:

[0058] T=Tokenizer(M) (2)

[0059]

[0060] In formula (2), T represents the result of text segmentation, and M represents the description template. In formula (3), C txt Indicates the text encoding result. In this algorithm, different semantic tags are applied to form N groups of description sentences, and C-dimensional text encoding is generated through the CLIP network text encoder.

[0061] The second step is to calculate the similarity between image and text:

[0062] Encode the image C img and text encoding C txt Perform L2 normalization. Divide each dimension of the image encoding by its L2 norm. Mathematically expressed as:

[0063]

[0064] Then calculate the cosine similarity of the normalized results to obtain the similarity score between the two. The mathematical expression is as follows:

[0065]

[0066] The third step, distance coding conversion steps are as follows:

[0067] The similarity score is normalized by the softmax function to obtain the depth weight, and then the depth weight is mapped to the distance code through the multi-layer perceptron. This method makes the model pay more attention to the high-weight depth value when estimating the depth, thereby enhancing the model's understanding of the depth relationship and improving the accuracy of depth estimation. This step is mathematically expressed as:

[0068]

[0069] D=MLP(W) (7)

[0070] Where Wi is the weight corresponding to the depth description statement, N is the total number of depth description statements, and D represents the final distance encoding.

[0071] Step 4: Distance coding conversion The specific visual coding steps are as follows:

[0072] Load the Diffusion model, input the distance code D into the Diffusion model, and output the image code after calculation through the Transformer module of the Diffusion model. The image code here is different from the image code generated in step 1. This image code captures the distance semantics and hint semantic information contained in the distance code, providing valuable information for subsequent image decoding.

[0073] Step 5: Visual encoding and decoding to generate depth map steps are as follows:

[0074] Load the pre-trained Diffusion model and input the visual code into the visual decoder of the Diffusion model to generate the corresponding depth image.

[0075] Step 6: Calculate the accuracy of the predicted depth map, fine-tune the model parameters, and output the depth prediction model. The specific steps are:

[0076] In the depth estimation method of the present invention, RMSE (Root Mean Squared Error) is used as the loss function between the depth value prediction and the actual depth value. Specifically, the operation of this step is as follows:

[0077] The Diffusion model is used to predict the depth value of each block in the street scene, the depth acquisition data in the training data set is loaded, the known depth information is used to obtain the actual depth value of the corresponding block in the street scene, and the RMSE loss between the predicted depth value and the actual depth value is calculated. This loss is used to measure the depth estimation performance of the model. The calculation formula of RMSE is as follows:

[0078]

[0079] Using the gradient information of the RMSE loss function, the model parameters are fine-tuned through the back propagation algorithm to improve the accuracy of the model depth estimation. Perform the above steps 1 to 5 in the test set, and output the prediction model when the loss and the corresponding depth prediction accuracy are less than the set threshold. The depth prediction accuracy has the following indicators:

[0080] Mean absolute relative error (rel)

[0081]

[0082] When actually performing a prediction task, first load the prediction model weights, input the RGB image to be predicted into the depth prediction model, and perform operations other than step 6 to obtain the depth prediction value.

[0083] It should be understood that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents, and any modifications or equivalent replacements that do not depart from the spirit and scope of the present invention should be included in the scope of the claims of the present invention.

Claims

1. Street depth map generation method based on CLIP model and generative model, It is characterized in that The steps include: Step 1: Generate a depth description sentence according to the depth description template, and use the text encoder of the CLIP model to generate a text code describing the distance; at the same time, use the image encoder of the CLIP model to convert the street image into an image code; The first step of image encoding and text encoding generation includes the following sub-steps: Step 1-1 Image encoding generation Input a monocular RGB image I and obtain the C-dimensional image encoding result through the visual encoder of the CLIP model. The formula is as follows: In formula (1), C img It represents the image encoding result calculated by the CLIP model visual encoder. Since the representations of images and texts are aligned in the CLIP model, similar images and texts have similar representations. After passing through a CLIP visual encoder, the image information is mapped to a shared semantic space, which not only contains general image semantics but also captures the distance relationship between different blocks. Step 1-2 uses the template to generate a description sentence and performs text encoding through the CLIP model text encoder: Set a set of templates M, which contain descriptions of image scenes; the template is: "This is a [Scene_Classes] photo, and the [Object_Classes] is [Depth_Classes]." Where [Scene_Classes] is the image scene description word, [Object_Classes] is the object name description word in the image, and [Depth_Classes] is the object depth description word; use the text encoder of the CLIP network to convert the generated description sentence into a text encoding, which is mathematically expressed as: T=Tokenizer(M) (2) In formula (2), T represents the result of text segmentation, and M represents the description template; in formula (3), C txt Indicates the text encoding result; in this algorithm, different semantic tags are used to form N groups of description sentences, and C-dimensional text encoding is generated through the CLIP network text encoder; Step 2: Calculate the cosine similarity between the text encoding and the image encoding to obtain the similarity score of the image depth; Step 3: Use a multi-layer perceptron to convert the similarity score into the distance code of each block of the original street image; Step 4: Introduce the diffusion model as a priori module, capture the semantic information contained in the distance code by using the diffusion model, and then map the distance code to the corresponding image code; Step 5: Generate a depth map of the street image based on the obtained image encoding through the image decoder; Step 6: Calculate the accuracy of the predicted depth map, fine-tune the model parameters, and output the depth prediction model; The sixth step is to calculate the accuracy of the predicted depth map and fine-tune the model parameters. The specific steps to output the depth prediction model are as follows: In the depth estimation method, RMSE is used as the loss function between the predicted depth value and the actual depth value; The Diffusion model is used to predict the depth value of each block in the street scene, and the known depth information is used to obtain the actual depth value of the corresponding block in the street scene. The RMSE loss between the predicted depth value and the actual depth value is calculated. This loss is used to measure the depth estimation performance of the model; the calculation formula of RMSE is as follows: Using the gradient information of the RMSE loss function, the model parameters are fine-tuned through the back-propagation algorithm to improve the accuracy of the model's depth estimation. When the loss is less than the set threshold, the prediction model is output. When performing a prediction task, the prediction model weight is loaded, and operations other than the sixth step are performed to obtain the depth prediction value.

2. The method for generating street depth map based on CLIP model and generative model according to claim 1, It is characterized in that The second step of image and text similarity calculation includes the following sub-steps: Encode the image C img and text encoding C txt Perform L2 normalization; divide each dimension of the image encoding by its L2 norm; mathematically expressed as: Then calculate the cosine similarity of the normalized results to obtain the similarity score between the two. The mathematical expression is as follows:

3. The method for generating street depth map based on CLIP model and generative model according to claim 2, It is characterized in that The third step is distance coding conversion The following steps are involved: The similarity score is normalized by the softmax function to obtain the depth weight, and then the depth weight is mapped to the distance code through the multi-layer perceptron, which is expressed as: D=MLP(W) (7) Where W i is the weight corresponding to the depth description statement, N is the total number of depth description statements, and D represents the final distance encoding.

4. The method for generating street depth map based on CLIP model and generative model according to claim 1, It is characterized in that The fourth step of distance encoding conversion visual encoding includes the following steps: Load the Diffusion model, input the distance code D into the Diffusion model, and output the image code after calculation through the Transformer module of the Diffusion model.

5. The method for generating street depth map based on CLIP model and generative model according to claim 1, It is characterized in that The fifth step of visual encoding and decoding to generate a depth map is as follows: The visual code is input into the visual decoder of the Diffusion model to generate the corresponding depth image.