A method for phrase-level localization using text-to-image diffusion model
Through the feature extraction and modular processing of the DiffPNG framework, combined with the empty text inversion and attention mechanism, the phrase-level positioning and segmentation capabilities of the diffusion model are improved, and the problem of insufficient phrase-level understanding and context awareness in the existing technology is solved. Achieved excellent zero-shot learning performance and image-text alignment effect.
Patent Information
- Application Number
- CN202410661746.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-27
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-05-27
AI Technical Summary
Existing diffusion models are relatively deficient in phrase-level understanding and context awareness, making it difficult to achieve excellent zero-shot learning performance.
Using the DiffPNG framework, through the feature extractor, LSP module, subject word-focused feature aggregator and SMR module, combined with empty text inversion, cross attention and self-attention, the fusion of image potential noise representation and text feature encoding is achieved for positioning. , segmentation and refinement to improve the accuracy of the model in phrase-level positioning and segmentation masks.
Significantly improves the diffusion model's capabilities in context awareness and phrase-level understanding, achieving superior zero-shot learning performance and enabling high-quality image-text alignment without training or annotation.
Smart Images

Figure CN118247799B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of diffusion models, and in particular to a method for realizing phrase-level positioning by utilizing a text-to-image diffusion model. Background Art
[0002] In recent years, the development of large-scale text-to-image diffusion models, especially stable diffusion models, has demonstrated remarkable capabilities in generating realistic and varied images. These models are trained on large text-image datasets such as LAION-5B, enabling them to understand the complex relationship between text descriptions and visual elements, thus achieving excellent visual-language alignment.
[0003] This progress has prompted researchers to explore more potential of diffusion models, not just generating images, and applying them to visual understanding tasks. An early study attempted to use the diffusion model as a zero-shot learning classifier by using specific cues, opening the door to its application in perception tasks without fine-tuning; subsequent studies extended these capabilities to detection and segmentation tasks, highlighting the strong potential of diffusion models in precise positioning. Further applications in directional detection / segmentation have verified the ability of diffusion models in language-driven visual perception. However, these tasks mainly demonstrate the model's ability to understand visual content at the sentence level, which depends on complete sentences or sentences made using prompting techniques. Current work still lacks exploration of its context-aware phrase-level understanding capabilities. Summary of the invention
[0004] The purpose of the present invention is to provide a method for phrase-level localization using a text-to-image diffusion model, solve the problems existing in the prior art, achieve excellent zero-sample learning performance, and improve the ability of the diffusion model in context perception and phrase-level understanding.
[0005] In order to achieve the above object, the solution of the present invention is:
[0006] A method for phrase-level localization using a text-to-image diffusion model is proposed. Based on the PNG task, the DiffPNG framework is introduced. The PNG task is regarded as a localization-segmentation-refinement solution paradigm. The DiffPNG framework mainly includes a feature extractor, an LSP module, a subject-focused feature aggregator, and an SMR module. The following steps are performed:
[0007] Step 1. Feature Extractor:
[0008] The feature extractor obtains the potential noise representation of the image through the "empty text inversion" technology, obtains the text feature encoding through the text segmentation strategy, and then inputs the potential noise representation of the image and the text feature encoding into the diffusion model;
[0009] Step 2, LSP module:
[0010] The LSP module decouples positioning and segmentation. In the inverse diffusion process, cross attention is used to identify the location of each instance and obtain high-confidence pixels as anchor points. Then, self-attention is used to aggregate these anchor points and generate a segmentation mask.
[0011] Step 3: Subject-focused feature aggregator:
[0012] The subject-focused feature aggregator performs adaptive feature aggregation based on similarity, using point multiplication to calculate the pairwise similarity between each word feature and the last word feature in the noun phrase of the PNG benchmark dataset;
[0013] Step 4: SMR module:
[0014] The SMR module selects the candidate masks generated by SAM and merges them with the segmentation mask to generate the final output result.
[0015] The steps performed by the feature extractor include:
[0016] Step 1.1, Visual Mode:
[0017] Given sampling steps, the DDIM inversion module outputs the noise latent variable of the empty text inversion , empty text reverses the output ,in Represents the time step; initialization hour equal , minimize the empty text reversal loss, and its calculation formula is expressed as:
[0018] ;
[0019] in Indicates that , and Map to The function of Indicates The feature encoding of the unconditional input of the time step, represents the control condition;
[0020] In the right time Unconditional feature encoding After the iterative optimization, the inverted noise latent variable is updated with the current noise latent variable, and its calculation formula is expressed as:
[0021] ;
[0022] Step 1.2, language mode:
[0023] Using the text segmentation strategy, the CLIP text encoder is used to segment the text into paragraphs. Divide into multiple sub-paragraphs ,in Indicates paragraph The number of neutron segments, Indicates the first The length of each sub-paragraph does not exceed the maximum length of the CLIP text encoder; the sub-paragraph is input into the CLIP text encoder Generate text feature encoding A long narrative text, in which Indicates Feature encoding of text in a sentence.
[0024] Preferably, the steps performed by the LSP module include:
[0025] Define the relationship between visual and textual input for the first Noun phrase Self-attention map of the layer and cross attention map , the calculation formulas of the two are expressed as:
[0026] ;
[0027] ;
[0028] in Represents hidden variables The query vector is Represents hidden variables The key vector of Indicates The feature dimension of the layer, and Represent the height and width of the feature map respectively, Represents text feature encoding The key vector of ;
[0029] Select some noun phrases with confidence above a certain threshold in the cross-attention map The pixels of the anchor points are defined as:
[0030] ;
[0031] in and They are The anchor point set of noun phrases and the average cross-attention map of each cross-attention layer, and Respectively represent the x-axis and y-axis index coordinates of the pixel point;
[0032] The self-attention masks of each anchor are aggregated and min-max normalization is applied to generate the following enhanced mask:
[0033] ;
[0034] in is the enhancement mask enhanced by self-attention, is the average self-attention of each selected self-attention layer, is the minimum-maximum normalization operation;
[0035] Enhancement Mask After binarization, the segmentation result is:
[0036] ;
[0037] in Indicates that for The binary mask result generated by noun phrases is Indicates the threshold for binarization.
[0038] Preferably, the steps performed by the subject-word focused feature aggregator include:
[0039] definition Indicates the first The total number of words in a noun phrase, Represents the first The word features of words, ;
[0040] Use dot multiplication to calculate The features of each word in the noun phrase and the features of the last word The pairwise similarity between , get the Similarity score vector of noun phrases ;
[0041] Through Softmax operation Will Compress to , and calculate the Aggregate attention mask for noun phrases , and its calculation formula is expressed as:
[0042] ;
[0043] in It is Noun phrase Input attention mask for each word.
[0044] Preferably, the steps performed by the SMR module include:
[0045] Without providing any hints, the image is input into the frozen SAM, and multiple candidate masks are obtained using the “segmenteverything” function of SAM and stored in the candidate pool; for the image , the candidate mask pool constructed by the present invention as follows:
[0046] ;
[0047] in Indicates the first Mask;
[0048] Then, the present invention proposes two methods for calculating matching scores: and They are used to solve the problems of insufficient segmentation and excessive segmentation, and their calculation formulas are expressed as follows:
[0049] ;
[0050] ;
[0051] in and They are The first self-attention enhanced graph of noun phrases pixel value and the The first of the SAM candidate masks pixel values, is the smoothing factor to prevent the denominator from being zero;
[0052] Select matches with a score higher than the match threshold The candidate masks are put into the matching mask pool , and its calculation formula is expressed as:
[0053] ;
[0054] in is the size of the matching mask pool;
[0055] After the matching is completed, if there are SAM candidate masks in the matching mask pool, the SMR module calculates the union of these SAM candidate masks to obtain the refined mask ; If none of the candidate masks generated by SAM can match the matching mask pool, then the mask enhanced by self-attention will be considered the final mask, is the final output result, and its calculation formula is expressed as:
[0056] ;
[0057] in represents the real number space, Represents an empty collection.
[0058] After adopting the above technical solution, the present invention has the following technical effects:
[0059] The present invention is applied to a large number of experiments on the PNG benchmark dataset. The experimental results show that the proposed DiffPNG framework achieves excellent zero-shot learning performance and can improve the capabilities of the diffusion model in context perception and phrase-level understanding. In order to study the phrase-level visual understanding ability of the diffusion model in context perception, the present invention redefines the panoramic narrative localization task as a zero-shot learning problem, that is, starting from initial localization, to segmentation, and finally to refinement. The LSP module of the present invention uses cross-attention to accurately locate anchor pixels, and uses self-attention to aggregate anchor pixels to obtain segmentation masks, and improves the quality of the segmentation masks through the SMR module using the function of SAM. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 Schematic diagram of the existing fully supervised PNG training paradigm;
[0061] Figure 2 A schematic diagram of the zero-sample diffusion-based paradigm proposed in the present invention;
[0062] Figure 3 This is a schematic diagram of the structure of the DiffPNG framework proposed in the present invention;
[0063] Figure 4 A qualitative analysis diagram comparing the prediction results of the DiffPNG framework proposed in the present invention with the true mask;
[0064] Figure 5 Comparison results of the proposed method with the fully supervised method and the zero-shot learning method on the PNG benchmark dataset. DETAILED DESCRIPTION
[0065] In order to further explain the technical solution of the present invention, the present invention is described in detail below through specific embodiments.
[0066] The Panoptic Narrative Grounding (PNG) task, as a pixel-level multimodal perception task, has made considerable progress and meets the requirements of the present invention for solving phrase-level localization tasks. Figure 1 As shown, the goal of the PNG task is to generate pixel-level masks for each noun phrase in a long narrative sentence; compared with other cross-modal tasks (such as visual question answering and image description), the PNG task provides more refined understanding capabilities. This task provides an ideal platform for in-depth research on the phrase-level understanding capabilities of the diffusion model, enabling the present invention to go beyond sentence-level understanding and perform more fine-grained context-aware processing.
[0067] The present invention discloses a method for phrase-level localization using a text-to-image diffusion model. Based on the PNG task, the DiffPNG framework is introduced, which is a zero-shot learning framework for panoramic narrative localization. The DiffPNG framework uses the text-to-image diffusion model and regards the PNG task as a localization-segmentation-refinement solution paradigm. Figure 2 and Figure 3 The DiffPNG framework mainly includes a feature extractor, an LSP (Locate-to-Segment Processor) module, a subject-focused feature aggregator, and an SMR (SAM-based Mask Refinement) module; the following steps are performed:
[0068] Step 1. Feature Extractor:
[0069] The feature extractor obtains the potential noise representation of the image through the "Null-text Inversion" technology to ensure that the reconstructed image is as consistent as possible with the original image; the text feature encoding is obtained through the text segmentation strategy to ensure that each word in the text can fully participate in subsequent calculations; then the image potential noise representation and text feature encoding are input into the diffusion model;
[0070] Step 2, LSP module:
[0071] The LSP module decouples positioning and segmentation. In the inverse diffusion process, cross attention is used to identify the location of each instance and obtain high-confidence pixels as anchor points. Self-attention is then used to aggregate these anchor points and generate a (rough) segmentation mask.
[0072] Step 3: Subject-focused feature aggregator:
[0073] The subject-focused feature aggregator performs adaptive feature aggregation based on similarity, using point multiplication to calculate the pairwise similarity between each word feature and the last word feature in the noun phrase of the PNG benchmark dataset (in the PNG benchmark dataset, the description text of the instance to be segmented in a sentence is usually a noun phrase composed of multiple words) to better utilize the cross-attention between different words in the noun phrase;
[0074] Step 4: SMR module:
[0075] The SMR module selects the candidate masks generated by SAM and merges them with the segmentation mask to generate the final output result.
[0076] Through the above scheme, the present invention has the following outstanding advantages:
[0077] The present invention is applied to a large number of experiments on the PNG benchmark dataset. The experimental results show that the proposed DiffPNG framework achieves excellent zero-shot learning performance and can improve the capabilities of the diffusion model in context perception and phrase-level understanding. In order to study the phrase-level visual understanding ability of the diffusion model in context perception, the present invention redefines the panoramic narrative localization task as a zero-shot learning problem, that is, starting from initial localization, to segmentation, and finally to refinement. The LSP module of the present invention uses cross-attention to accurately locate anchor pixels, and uses self-attention to aggregate anchor pixels to obtain segmentation masks, and improves the quality of the segmentation masks through the SMR module using the function of SAM.
[0078] Specific embodiments of the present invention are shown below.
[0079] About feature extractor:
[0080] Step 1.1, Visual Mode:
[0081] In the fully supervised PNG task, FPN and ResNet-101 are usually used to extract high-dimensional features of images for subsequent fusion with text features. However, for the architecture setting involving stable diffusion, that is, it is necessary to accept the input of the latent noise representation of the image, this method requires adjustments to our image feature extraction. Real images from the PNG dataset must be converted into latent noise representations of the image, which is usually processed by DDPM, which introduces noise to generate latent variables. However, in the inverse diffusion process, the randomness of these variables hinders the accurate reconstruction of the image and is therefore not suitable for feature extraction. Specifically, in order to maintain the consistency of the reconstruction, the present invention adopts the Null-text Inversion method (Null-text Inversion) with DDIM inversion as the core to obtain the latent noise representation of the image, and ensure that the reconstructed image is very consistent with the original image and remains relevant to the description of the original image, which allows the latent noise representation of the image to be effectively used in further segmentation tasks.
[0082] Given sampling steps, the DDIM inversion module outputs the noise latent variable of the empty text inversion , empty text reverses the output ,in Represents the time step; initialization hour equal , minimize the empty text reversal loss, and its calculation formula is expressed as:
[0083] ;
[0084] in Indicates that , and Map to The function of Indicates The feature encoding of the unconditional input of the time step, represents the control condition;
[0085] In the right time Unconditional feature encoding After the iteration optimization, the present invention updates the inverted noise latent variable with the current noise latent variable, and its calculation formula is expressed as: ; Then the denoising U-Net can perceive a more accurate attention map from the conditional input.
[0086] Step 1.2, language mode:
[0087] In the previous fully supervised PNG setting, BERT was used as a text encoder to extract embeddings of noun phrases. In the present invention, in order to be consistent with the text segments of the open source diffusion model, the present invention uses the CLIP text encoder to encode the text. However, due to the limitation that the maximum acceptable length of the CLIP text encoder is 77 tokens, most of the narrative texts in the PNG dataset exceed this maximum length. Therefore, the present invention adopts a text segmentation strategy to maximize the retention of the contextual semantics of the paragraph and ensure that every word in the text can fully participate in the calculation. Specifically, the present invention uses the text segmentation strategy to encode the paragraphs of the text through the CLIP text encoder. Divide into multiple sub-paragraphs ,in Indicates paragraph The number of neutron segments, Indicates the first The length of each sub-paragraph does not exceed the maximum length of the CLIP text encoder; the sub-paragraph is input into the CLIP text encoder Generate text feature encoding A long narrative text, in which Indicates Feature encoding of text in a sentence.
[0088] About LSP module:
[0089] The LSP module uses the noise latent variables obtained by the DDIM inversion module and the CLIP text encoder to obtain text feature encoding for denoising during the inverse diffusion process. The process uses the U-Net network for prediction, which consists of 16 specific modules, including two main parts: the ResNet layer and the Transformer layer. The Transformer layer uses a self-attention mechanism to capture global image features and a cross-attention mechanism to establish a connection between visual and text inputs.
[0090] We first define the relationship between visual and textual input for the first Noun phrase Self-attention map of the layer and cross attention map , the calculation formulas of the two are expressed as:
[0091] ;
[0092] ;
[0093] in Represents hidden variables The query vector is Represents hidden variables The key vector of Indicates The feature dimension of the layer, and Represent the height and width of the feature map respectively, Represents text feature encoding It should be noted that the cross-attention establishes the relationship between text features and visual pixels, enabling the present invention to extract the corresponding pixels of noun phrases. However, directly using the cross-attention as a candidate mask may be somewhat rough and may produce noisy areas. Inspired by this, the LSP module first selects some pixels with confidence above a certain threshold on the cross-attention map of each noun phrase. The pixels of the anchor points are defined as:
[0094] ;
[0095] in and They are The anchor point set of noun phrases and the average cross-attention map of each cross-attention layer, and Respectively represent the x- and y-axis index coordinates of the pixel point.
[0096] These anchor points can effectively refer to the image regions that are most relevant to the text. In order to obtain a mask with accurate semantic information, the present invention uses a pixel-level self-attention map with high spatial consistency to associate similar pixels, thereby obtaining a refined segmentation result. Specifically, the LSP module aggregates the self-attention mask of each anchor point and applies min-max normalization to generate the following enhanced mask:
[0097] ;
[0098] in is the enhancement mask enhanced by self-attention, is the average self-attention of each selected self-attention layer, is the min-max normalization operation.
[0099] Finally, the LSP module enhances the mask After binarization, the segmentation result is:
[0100] ;
[0101] in Indicates that for The binary mask result generated by noun phrases is Indicates the threshold for binarization.
[0102] Feature aggregator about subject word focus:
[0103] In order to better utilize the cross-attention between different words in a noun phrase, this paper proposes a subject-focused feature aggregator, which is an adaptive feature aggregation scheme based on similarity. Specifically, we define Indicates the first The total number of words in a noun phrase, Represents the first The word features of words, ; The subject-focused feature aggregator uses point multiplication to calculate the first The features of each word in the noun phrase and the features of the last word The pairwise similarity between , get the Similarity score vector of noun phrases ,in It can reflect the The first noun phrase The contribution of each word to the activation of the relevant area in the image. It is worth noting that the last word in an English noun phrase is always a noun, while the preceding words can be adjectives, pronouns, and numbers. Therefore, the weight of the last word feature is set to 1 in the present invention, and the weights of other words are calculated based on their similarity scores.
[0104] Then, the subject-focused feature aggregator is processed by Softmax. Will Compress to , and calculate the Aggregate attention mask for name phrases , and its calculation formula is expressed as:
[0105] ;
[0106] in It is Noun phrase Input attention mask for each word.
[0107] About SMR module:
[0108] Since the setting of zero-shot learning prohibits access to the training set, the edge information in the mask directly generated by the DiffPNG framework still needs to be refined. To this end, based on SAM's powerful edge segmentation capability, the present invention proposes a SAM-based mask refinement module to correct the output of the DiffPNG framework, referred to as DiffPNG*. Specifically, the present invention inputs the image into a frozen SAM without providing any prompts, uses SAM's "segment everything" function to obtain multiple candidate masks, and stores them in a candidate pool for matching with the output of the present invention. These candidate masks do not contain any text semantic information. For images , the candidate mask pool constructed by the present invention as follows:
[0109] ;
[0110] in Indicates the first Mask;
[0111] Then, the present invention proposes two methods for calculating matching scores: and They are used to solve the problems of insufficient segmentation and excessive segmentation, and their calculation formulas are expressed as follows:
[0112] ;
[0113] ;
[0114] in and They are The first self-attention enhanced graph of noun phrases pixel value and the The first of the SAM candidate masks pixel values, is the smoothing factor to prevent the denominator from being zero;
[0115] Then, the SMR module selects the matching scores above the matching threshold The candidate masks are put into the matching mask pool , and its calculation formula is expressed as:
[0116] ;
[0117] in is the size of the matching mask pool;
[0118] After the matching is completed, if there are SAM candidate masks in the matching mask pool, the SMR module calculates the union of these SAM candidate masks to obtain the refined mask ; If none of the candidate masks generated by SAM can match the matching mask pool, then the mask enhanced by self-attention will be considered the final mask, is the final output result, and its calculation formula is expressed as:
[0119] ;
[0120] in represents the real number space, Represents an empty collection.
[0121] The specific experimental results are as follows:
[0122] The present invention conducts experiments on the PNG dataset and compares the method of the present invention with the existing fully supervised method and the zero-shot learning method based on the diffusion model. The PNG dataset consists of image-text pairs. Unlike datasets such as RefCOCO, the PNG dataset is characterized by a lengthy description of all objects and their relationships in the complete image. In addition, the objects in the noun phrases include singular and plural forms, which makes the alignment between visual elements and text elements more complicated. The PNG dataset includes 133,103 training images and 8,380 test images.
[0123] As with previous PNG studies, we use average recall as the evaluation metric, measure performance by calculating the intersection over union (IoU) between our predictions and the facts for each noun phrase, and set an IoU threshold. Specifically, we calculate the IoU between the predicted masks and bounding boxes generated by our method and the corresponding true masks, and calculate the corresponding recall using different thresholds.
[0124] Then, the present invention calculates the recall rate under different IoU thresholds to form a curve, and the average recall rate refers to the area under this curve. In order to comprehensively evaluate the performance, the present invention calculates the average recall rate evaluation indicators of overall, things, background, singulars and plurals.
[0125] The DiffPNG framework of the present invention provides a zero-shot learning solution that only requires an inference process and does not require any training images or mask annotations. All experiments were performed on an RTX3090 GPU; the resolution of all test images was adjusted to 512×512. The present invention uses the pre-trained stable diffusion model Stable Diffusion (V1.4) as the generation model, and uses the pre-trained ViT-Huge version of SAM and its automatic mask generation pipeline to generate multi-scale masks offline. For stable diffusion, the guidance scale is set to 7.5, the total step size is 1000, the DDIM diffusion step size is 20, and the DDIM noise scheduling Generated by scaling linearly from 0.00085 to 0.012.
[0126] See also Figure 4 , shows a qualitative analysis of the prediction results of the proposed DiffPNG framework compared with the true mask. It can be seen that the solution of the present invention is based on the diffusion model and can achieve excellent zero-shot reasoning capabilities even without seeing any data from the PNG dataset. The results show that the paradigm proposed by the present invention can achieve phrase awareness.
[0127] See also Figure 5 , the performance of the proposed method, the fully supervised method and different zero-shot methods are evaluated on the PNG dataset: the fully supervised method achieves good performance at the expense of training cost; under the zero-shot setting, the proposed method achieves the best performance, greatly outperforming other zero-shot methods based on diffusion models and zero-shot learning. Compared with DatasetDiffusion and DiffSeg, the DiffPNG framework improves the average recall by 10.08% and 9.46% respectively.
[0128] In the zero-shot learning setting with randomly generated masks, the performance is only 15.53%, which highlights the effectiveness of our carefully designed diffusion-based paradigm in achieving strong image-text alignment capabilities. In addition, the DiffPNG framework further improves the performance through the SMR module, and it can be seen that the overall average recall of DiffPNG* is 38.49%.
[0129] In summary, the proposed DiffPNG framework can significantly improve the segmentation performance in the zero-shot setting, which shows that the diffusion model has great potential in discriminative tasks such as noun phrase understanding.
[0130] The above embodiments and drawings do not limit the product form and style of the present invention. Any appropriate changes or modifications made by ordinary technicians in the relevant technical field should be deemed to be within the patent scope of the present invention.
Claims
1. A method for phrase-level localization using a text-to-image diffusion model, Features: Based on the PNG task, the DiffPNG framework is introduced, and the PNG task is regarded as a positioning-segmentation-refinement solution paradigm. The DiffPNG framework mainly includes a feature extractor, an LSP module, a subject-focused feature aggregator, and an SMR module. The following steps are performed specifically: Step 1. Feature Extractor: The feature extractor obtains the potential noise representation of the image through the "empty text inversion" technology, obtains the text feature encoding through the text segmentation strategy, and then inputs the potential noise representation of the image and the text feature encoding into the diffusion model; Step 2, LSP module: The LSP module decouples positioning and segmentation. In the inverse diffusion process, cross attention is used to identify the location of each instance and obtain high-confidence pixels as anchor points. Then, self-attention is used to aggregate these anchor points and generate a segmentation mask. Step 3: Subject-focused feature aggregator: The subject-focused feature aggregator performs adaptive feature aggregation based on similarity, using point multiplication to calculate the pairwise similarity between each word feature and the last word feature in the noun phrase of the PNG benchmark dataset; Step 4: SMR module: The SMR module selects the candidate masks generated by SAM and merges them with the segmentation mask to generate the final output result; The steps performed by the feature extractor include: Step 1.1, Visual Mode: Given sampling steps, the DDIM inversion module outputs the noise latent variable of the empty text inversion , empty text reverses the output ,in Represents the time step; initialization hour equal , minimize the empty text reversal loss, and its calculation formula is expressed as: ; This formula means that by optimizing Feature encoding of unconditional inputs at time steps , so that Empty text inverted output for time steps Close to the DDIM inversion module output noise potential variable ; Among them, the superscript It is the abbreviation of inversion, which refers to the loss of this formula in calculating the inversion process; Indicates that , and Map to The function of Indicates The feature encoding of the unconditional input of the time step, represents the control condition; In the right time Unconditional feature encoding After the iterative optimization, the inverted noise latent variable is updated with the current noise latent variable, and its calculation formula is expressed as: ; Step 1.2, language mode: Using the text segmentation strategy, the CLIP text encoder is used to segment the text into paragraphs. Divide into multiple sub-paragraphs ,in Indicates paragraph The number of neutron segments, Indicates the first The length of each sub-paragraph does not exceed the maximum length of the CLIP text encoder; the sub-paragraph is input into the CLIP text encoder Generate text feature encoding A long narrative text, in which Indicates Feature encoding of text in a sentence; The steps performed by the LSP module include: Define the relationship between visual and textual input for the first Noun phrase Self-attention map of the layer and cross attention map , the calculation formulas of the two are expressed as: ; ; in Represents hidden variables The query vector is Represents hidden variables The key vector of Indicates The feature dimension of the layer, and Represent the height and width of the feature map respectively, Represents text feature encoding The key vector of ; Select some noun phrases with confidence above a certain threshold in the cross-attention map The pixels of the anchor points are defined as: ; in and They are The anchor point set of noun phrases and the average cross-attention map of each cross-attention layer, and Respectively represent the x-axis and y-axis index coordinates of the pixel point; The self-attention masks of each anchor are aggregated and min-max normalization is applied to generate the following enhanced mask: ; in is the enhancement mask enhanced by self-attention, is the average self-attention of each selected self-attention layer, is the minimum-maximum normalization operation; Enhancement Mask After binarization, the segmentation result is: ; in Indicates that for The binary mask result generated by noun phrases is Indicates the threshold value of binarization processing; The steps performed by the subject-word focused feature aggregator include: definition Indicates the first The total number of words in a noun phrase, Represents the first The word features of words, ; Use dot multiplication to calculate The features of each word in the noun phrase and the features of the last word The pairwise similarity between , get the Similarity score vector of noun phrases ; Through Softmax operation Will Compress to , and calculate the Aggregate attention mask for noun phrases , and its calculation formula is expressed as: ; in It is Noun phrase The input attention mask of words, represents the similarity score; The steps performed by the SMR module include: Without providing any hints, the image is input into the frozen SAM, and multiple candidate masks are obtained using the "segmenteverything" function of SAM and stored in the candidate pool; for the image , the candidate mask pool constructed by the present invention as follows: ; in Indicates the first Mask; Then, the present invention proposes two methods for calculating matching scores: and They are used to solve the problems of insufficient segmentation and excessive segmentation, and their calculation formulas are expressed as follows: ; ; in and They are The first self-attention enhanced graph of noun phrases pixel value and the The first of the SAM candidate masks pixel values, is the smoothing factor to prevent the denominator from being zero; Select matches with a score higher than the match threshold The candidate masks are put into the matching mask pool , and its calculation formula is expressed as: ; in is the size of the matching mask pool; After the matching is completed, if there are SAM candidate masks in the matching mask pool, the SMR module calculates the union of these SAM candidate masks to obtain the refined mask ; If none of the candidate masks generated by SAM can match the matching mask pool, then the mask enhanced by self-attention will be considered the final mask, is the final output result, and its calculation formula is expressed as: ; in represents the real number space, Represents an empty collection.
Citation Information
Patent Citations
3D pre-training method and system based on diffusion model
CN117115588A
Method for generating continuous pictures by long text based on diffusion model
CN117521672A
Deep neural network model-based address information feature extraction method
WO2021000362A1
