Cross-modal weak supervision image segmentation method
Through a cross-modal weakly supervised image segmentation method, the bilateral word prompt attention module and calibration method of image and text features are used to generate pseudo labels for training, which solves the problems of high resource consumption and noise sensitivity of traditional fully supervised methods in medical images. Efficient and accurate image segmentation is achieved.
Patent Information
- Application Number
- CN202410759699.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-10-18
AI Technical Summary
Traditional fully supervised image segmentation methods require a large amount of annotated data in medical images, have limited generalization capabilities, consume large amounts of computing resources, are sensitive to noise and artifacts, and are difficult to effectively apply in resource-limited environments.
A cross-modal weakly supervised image segmentation method is used to extract features through image encoders and text encoders. Bilateral word prompt attention modules and calibration methods are used, combined with positive response map selection strategies, to generate pseudo labels for training, reducing the need for annotated data. dependence to improve segmentation accuracy.
It achieves image segmentation that saves resources and improves accuracy, reduces the demand for computing resources and annotated data, improves application capabilities in resource-limited environments, and enhances robustness to noise and artifacts.
Smart Images

Figure CN118799333A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical fields of artificial intelligence, deep learning, computer vision and image segmentation, and in particular to a cross-modal weakly supervised image segmentation method (TRSE). Background Art
[0002] Medical image segmentation is a key step in medical image analysis, which involves extracting the areas that need to be observed from medical images, such as organs, lesions, etc. This is of great significance for the diagnosis, treatment and prognosis of diseases. However, due to the complexity and diversity of medical images, medical image segmentation remains a challenging task.
[0003] Traditional fully supervised referential image segmentation methods are methods that require a large amount of labeled data. They have been widely used in medical image segmentation. The following are some common fully supervised referential image segmentation methods:
[0004] U-Net is an image segmentation method based on convolutional neural network (CNN), which has been widely used in medical image segmentation. The main advantage of U-Net is that it can achieve high-precision segmentation with fewer training samples.
[0005] V-Net is a medical image segmentation method based on 3D convolutional neural network. Compared with U-Net, V-Net can process 3D medical images and better capture the spatial information of the image.
[0006] DeepLab is an image segmentation method based on deep convolutional neural networks, which introduces dilated convolution and fully connected conditional random fields (CRF) to improve the accuracy and consistency of segmentation.
[0007] However, the fully supervised nominal image segmentation method also has some shortcomings: First, it requires a large amount of labeled data. The fully supervised nominal image segmentation method requires a large amount of labeled data to train the model, and obtaining this data is usually very time-consuming and expensive. Second, its generalization ability is limited. Due to the diversity of medical images, the fully supervised nominal image segmentation method may perform poorly on some new and unseen images. Third, it has high requirements for computing resources. The fully supervised nominal image segmentation method usually requires a large amount of computing resources, which may limit their application in some resource-limited environments. Fourth, it is sensitive to noise and artifacts. Medical images often contain noise and artifacts, which may affect the performance of the fully supervised nominal image segmentation method.
[0008] Therefore, the present invention introduces text supervision signals, adopts bilateral prompting method and calibration method to improve the accuracy of target positioning, and trains the segmentation network through positive response map selection strategy, thereby realizing the referential image segmentation based on weak supervision signals. Summary of the invention
[0009] The purpose of the present invention is to make up for the shortcomings of the current fully supervised referential image segmentation and propose a cross-modal weakly supervised image segmentation method to achieve the purpose of high efficiency, accuracy and resource saving.
[0010] The technical solution of the present invention is as follows: A cross-modal weakly supervised image segmentation method comprises the following steps:
[0011] Step (1) extracting image features and text features;
[0012] Given an input image and text expression queries Through the image encoder Enc v and text encoder Enc t Extract initial visual features and initial text features Among them, H v =H / s and C v and C t Represents the number of channels of visual features and text features respectively, s is the multiple of downsampling, and T represents the number of words;
[0013] The text expression query Divide into correct query expressions and the incorrect query expression Q n ; Input image as anchor point, correct query expression as positive sample, N incorrect query expressions as negative samples;
[0014] The projection layer transforms V and L to a unified hidden dimension C d , get the visual features after projection And the projected text features Then through L 2 Channel normalization normalizes the output of the projection layer to obtain the visual feature V 2 and text feature L 2 ;
[0015] Step (2) feature enhancement and updating through the bilateral prompting attention module;
[0016] Given the input visual features and text features The two attention maps are calculated by the following formula:
[0017]
[0018] in, Indicates the correlation between text features and visual features, represents the correlation between visual features and text features, W * v and are learnable parameters of visual and text features, represents matrix multiplication; the bilateral prompting attention module is expressed as:
[0019]
[0020] Among them, Re(·) represents the shape transformation function, L′ is the enhanced visual feature, and its shape is V′ is the enhanced text feature, and its shape is
[0021] The bilateral prompting module is used to update the visual features and text features as follows:
[0022]
[0023] represents the updated visual features, represents the updated text features, α and β represent the corresponding coefficients;
[0024] Step (3) generating a response graph;
[0025] For the updated visual features First reorganize it to obtain the reorganized visual features
[0026]
[0027] Align the reorganized visual features and the updated text features to get the response between pixel i and text j:
[0028]
[0029] Where v represents the channel index and τ represents a learnable temperature parameter used to constrain R i,j scope;
[0030] Step (4) Supervision through classification loss function
[0031] For the positive sample Q p and negative samples Q n , respectively calculate the image I for the positive sample Q p and negative samples Q n Response mapping; R p and R n Combined to get the response of the entire sample, and query Q for each text expression i Calculate the image-level score y j, as shown below:
[0032]
[0033] in represents a regularization term used to balance positive and negative samples; y j The range is 0-1. The larger its value is, the more likely the current query text Q is. j The higher the match with the input image;
[0034] The classification loss function is used to supervise the entire classification process, specifically:
[0035]
[0036] in It is the supervisory signal generated by visual features, 1 indicates a correct query and 0 indicates an incorrect query;
[0037] Propose a calibration loss function To improve the positive response graph R p The positioning and segmentation accuracy of the input image I and R p Multiply to get the position of the target object and use it as the anchor point, and then use the correct query expression Q p As positive samples, randomly sample K negative samples from queries describing different objects in the same image. The whole process is expressed as:
[0038]
[0039] where S(·,·,·) is a similarity function used to measure the match between the target object and the query:
[0040]
[0041] up(·) is the upsampling function, is the cosine similarity calculation function;
[0042] Step (5) obtaining the highest quality response map based on the response map selection strategy of the positive sample;
[0043] First, for each of the M positive samples Compute text-to-image response map Then use the above S(·,·,·) to calculate the similarity, add the similarity scores of the current corresponding graph and all positive samples, and reflect the accuracy:
[0044]
[0045] Select the response graph with the largest cumulative score Response map as target object;
[0046] Using R
[88] To further improve the accuracy of the response map, after thresholding it, the corresponding pseudo-label is obtained for training the referential image segmentation network;
[0047] Step (6) Use pseudo labels to train the reference image segmentation network for image segmentation
[0048] The reference image segmentation network includes an image encoder, a text encoder, a multimodal feature fusion module and a decoder; the image and text are input into the encoder to obtain corresponding features;
[0049] The visual features of the last three levels generated by the image encoder and the text encoder are fused with the text features using a multimodal feature fusion module. The obtained cross-modal features are then input into the corresponding decoder to obtain the final segmentation result.
[0050] The multimodal feature fusion module is based on the attention mechanism. For the input visual features and text features, a linear layer is first used to project them into one dimension to obtain and Where T represents the number of words in the input text; then the visual features are used as Q v , the text feature is regarded as V l and K l ,
[0051] The multimodal feature A is obtained by the following calculation i ;
[0052] Q v =W q V i ,K l =W k L,V l =W v L
[0053]
[0054] Then transpose it to make it consistent with V i After having the same shape, dot multiplication:
[0055] M i =V i ⊙A i
[0056] The final multimodal feature M i After reshape reorganization, a linear layer is input to obtain the fused output, and pseudo labels are used for supervision. The loss function selects the standard binary cross entropy function as follows:
[0057]
[0058] P ij The closer to y ij , the smaller the value of the loss function.
[0059] The image encoder Enc v and text encoder Enc t Taken from the CLIP model.
[0060] Beneficial effects of the present invention: The present invention uses an encoder to match images and texts, locates the target object by finding pixels that have a high response to the correct description, and uses a bilateral prompt method to coordinate the modal differences between vision and language, and improves the accuracy by methods such as foreground enhancement and background suppression, and finally selects a positive response map selection strategy to further enhance and find high-quality pseudo labels. Compared with the traditional fully supervised method, it will save more manpower and time, and has a higher accuracy rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 It is the overall framework of the cross-modal weakly supervised image segmentation method;
[0062] Figure 2 The overall structure of the bilateral prompt attention module (BPAM);
[0063] Figure 3 shows some qualitative results of the indicator image segmentation; Figure 3(a)-Figure 3(d) Different examples respectively;
[0064] Figure 4 is a qualitative comparison of the positive response map selection strategy (PRMS) on RefCOCO+; Figure 4(a) is the original image, Figure 4(b) is the segmented image obtained without using PRMS, Figure 4(c) is the segmented image obtained with PRMS, and Figure 4(d) is the GT image;
[0065] Figure 5 shows the effect of different modules on the segmentation results of the query "a sheep is eating grass"; Figure 5(a) is the original image, and Figure 5(b) is the image using The segmentation result of , Figure 5(c) is shown using Segmentation results, Figure 5(d) shows the use of 5(e) is the segmentation result using the complete technical solution, and FIG5(f) is the GT image.
[0066] Figure 6 shows the effect of different modules on the segmentation results of the query "red truck next to the tree"; Figure 6(a) is the original image, and Figure 6(b) is the image using The segmentation result of , Figure 6(c) is the segmentation result of , The segmentation result of , Figure 6(d) is the segmentation result of 6(e) is the segmentation result using the complete technical solution, and FIG6(f) is the GT image.
[0067] Figure 7 shows the effect of different modules on the segmentation results of the query "an old man wearing glasses sitting at a table with his hands crossed"; Figure 7(a) is the original image, and Figure 7(b) is the image using The segmentation result of , Figure 7(c) is the segmentation result of , The segmentation result of , Figure 7(d) is the segmentation result of 7(e) is the segmentation result using the complete technical solution, and FIG7(f) is the GT image. DETAILED DESCRIPTION
[0068] Figure 1 The overall framework of the cross-modal weakly supervised image segmentation method proposed in this invention is demonstrated. The framework includes two main stages: first, a text encoder and an image encoder are used to extract features of the image and text respectively, and then a bilateral prompt attention module is used to reduce the difference between visual and language features. The updated visual features and text features are used to generate corresponding response maps, which include a positive response map and N negative response maps, corresponding to the generation results of positive samples and negative samples respectively. By pooling the response map along a specific dimension, the similarity between different texts and the current image can be obtained. Using the known matching relationship between text and image, this similarity can be obtained through the classification loss function To further improve the completeness and accuracy of the response graph, the present invention also proposes a calibration method Used to expand relevant foreground areas and suppress irrelevant noise information.
[0069] Figure 2 The structure of the bilateral word-prompting attention module is shown. * v and W * l is a learnable parameter, Represents matrix multiplication.
[0070] Figure 3 shows some visual examples of our proposed weakly supervised referent image segmentation method. These results show that our method can locate objects in some challenging scenes without the need for additional annotation information.
[0071] Figure 4 also shows a visual comparison of two cases. For the two response maps generated for the input text (“checkered shirt” and “redand white checkered shirt skater dude”), the resulting CLIP scores are 0.65 and 0.71 respectively. The second response map is selected as the pseudo label corresponding to the target.
[0072] Figures 5 to 7 show some visualization examples to verify the effectiveness of the different modules proposed in this invention. When the model is trained with bilateral attention, it has a higher response on the target object, but is easily disturbed by background noise. The introduction of the bilateral attention module can enhance the ability to accurately locate the target (such as the color shadow in (c)) and reduce the model's response to the wrong area (such as the waterfall in the first example). The calibration method can suppress irrelevant background noise (such as "black goat" in the first example and "woman" in the third example), thereby maintaining the integrity of the target object and improving the accuracy of the response map.
[0073] (1) Building an overall network framework
[0074] The framework is divided into two main stages: First, the features of text and image are extracted using text and image encoders respectively. Then, the difference between visual and language features is reduced through a bilateral word attention module. The updated visual and text features are used to generate a positive response map and multiple negative response maps, corresponding to positive and negative samples respectively. By pooling the response maps along a specific dimension, the similarity between different texts and the current image can be calculated. This similarity is measured through the classification loss function Supervision is performed based on the known matching relationship between text and image. In order to improve the completeness and accuracy of the response map, a calibration method is proposed It can achieve the function of expanding the relevant foreground area and suppress the noise information. In addition, a response map selection strategy based on positive samples is proposed to select the best response map to generate pseudo labels. Figure 2 The quantization can obtain pseudo labels, which are then used as training signals for the second-stage image segmentation network.
[0075] A specific implementation example is: in medical imaging, the images (pictures) taken by the medical instrument and the corresponding case information (text) are input, and the corresponding features are obtained after encoder conversion and bilateral prompting update, and applied to the response graph for pooling, and the similarity is calculated for training a more accurate network framework.
[0076] (2) Building a text prompter through a template
[0077] CLIP is an image-language pre-training framework based on contrastive thinking. The dataset used by this framework has 400 million image-text pairs. Through the idea of contrastive learning, text and visual features are aligned in the pre-training stage. CLIP uses a simple and effective method to transfer the knowledge of the pre-trained model to the downstream classification task, that is, to build a series of text prompters through templates, such as "A photo of [CLS]", where [CLS] can be replaced with the category corresponding to the dataset. Then, for a given image and a series of prompt words including category information, CLIP is used to calculate the similarity between the image and the prompt word, and the category with the highest score is the corresponding prediction result.
[0078] CLIP includes an image encoder (ResNet or ViT) and a text encoder (Transformer). ResNet is used as the image encoder, which outputs four different levels of visual features. Unlike the standard ResNet, CLIP further manipulates the network structure by embedding an additional attention pooling layer into the deepest layer of the network. Before inputting the features into the pooling layer, the deepest features need to be Global features obtained using global average pooling operation Among them, H 4 , W 4 and C represent the height, width, and number of channels of the feature map output by the network in the fourth stage. 4 and Cascade and input into the multi-head attention layer, the calculation is as follows:
[0079]
[0080] In the standard CLIP training process, the global features after interaction are regarded as the output of the image encoder without using the other output z. However, since this paper applies CLIP to the field of referential image segmentation, more detailed features are required. Therefore, this paper uses the image feature z to interact with the text feature.
[0081] (3) Constructing a bilateral prompt word module
[0082] The proposed bilateral prompting module, in particular, enhances features by combining features of one modality with features of another modality. The module can enrich text features with text-guided visual features and enrich visual features with visually perceived text features, thereby facilitating the classification process and locating the target object. The association between text features and visual features and between visual features and text features can be calculated through the attention map.
[0083] (4) Response graph calculation
[0084] Given an input image and a text expression query This paper first uses the image encoder Enc v and text encoder Enc t Extract visual features and text features
[0085] Then a projection layer is used to transform V and L to a unified hidden dimension C d , get the projected visual features and text features, and then use L 2 Channel normalization is used to normalize the output of the projection layer.
[0086] (5) Constructing classification loss function
[0087] The classification loss function allows the network to select the correct expression from a set of correct and incorrect expressions, and through this process continuously optimizes the response between text and image to locate the position of the target area.
[0088] By inputting image I and the correct query expression As anchor points and positive samples, N wrong queries are randomly selected from the entire dataset as negative samples. p and negative samples Q n , and then calculate the image I for the positive sample Q p and negative samples Q n The response mapping.
[0089] In order to further improve the segmentation accuracy, a calibration loss function is proposed First, the input image I and R p Multiply to get the position of the target object and use it as the anchor point, and then use the correct query Q p As positive samples, K negative samples are randomly sampled from queries describing different objects in the same image, that is, The whole process can be expressed as:
[0090]
[0091] where S(·,·,·) is a similarity function used to measure the match between the target object and the query:
[0092]
[0093] Among them, Enc v and Enc t represents the image and text encoder initialized by CLIP weights. up(·) is the upsampling function, It is the cosine similarity calculation function.
[0094] (6) Constructing a positive response map selection strategy
[0095] First, for each of the M positive queries Compute text-to-image response map Then use S(·,·,·) to calculate the similarity, add the similarity scores of the current corresponding graph and all the certificate queries, and reflect the accuracy:
[0096]
[0097] (7) Using pseudo labels to train the referential image segmentation network
[0098] The segmentation network inputs the image and text into the image encoder and text encoder respectively to obtain the corresponding visual and text features. The visual features and text features of the last three levels of the image encoder and text encoder are fused using the multimodal feature fusion module, and the obtained cross-modal features are then input into the corresponding decoder to obtain the final segmentation structure.
[0099] First use a linear layer to project it into one dimension, and we get and Where T represents the number of words in the input text.
[0100] A is obtained by the following calculation i
[0101] Q v =W q V i ,K l =W k L,V l =W v L
[0102]
[0103] Then transpose it to make it consistent with V i After having the same shape, dot multiplication:
[0104] M i =V i ⊙A i
[0105] The final multimodal feature M i After reshaping, a linear layer is input to obtain the fusion output of the module, and the pseudo-label generated by the output is used for supervision. The loss function selects the standard binary cross entropy function as follows:
[0106]
[0107] P ij The closer to y ij , the smaller the value of the loss function.
[0108] (8) Training methods
[0109] ResNet-50 is used as the backbone structure to extract image features as the encoder, and CLIP is used as the text and image encoder. The α and β in the bilateral prompt module are set to 0.1. The number of negative samples in the batch size and correction method are set to 48 and 6. The hidden layer dimension of the projection layer is set to 1024, and the downsampling factor is 32. The loss function of the first stage is The default value of λ is set to 5. The input image size is cropped to 320×320, and the maximum length of each referential expression is set to 20. The Adam optimizer is used with homogeneous decay learning rate adjustment, the initial learning rate is 0.00005, the weight decay is 0.01, and the training is performed for 15 cycles. The training process and settings of the two stages are the same.
Claims
1. A cross-modal weakly supervised image segmentation method, characterized in that: The steps include: Step (1) extracting image features and text features; Given an input image and text expression queries Through the image encoder Enc v and text encoder Enc t Extract initial visual features and initial text features Among them, H v =H / s and C v and C t Represents the number of channels of visual features and text features respectively, s is the multiple of downsampling, and T represents the number of words; The text expression query Divide into correct query expressions and the incorrect query expression Q n ; Input image as anchor point, correct query expression as positive sample, N incorrect query expressions as negative samples; The projection layer transforms V and L to a unified hidden dimension C d , get the visual features after projection And the projected text features Then the output of the projection layer is normalized by L2 channel normalization to obtain visual features V2 and text features L2; Step (2) feature enhancement and updating through the bilateral prompting attention module; Given the input visual features and text features The two attention maps are calculated by the following formula: in Indicates the correlation between text features and visual features, Indicates the correlation between visual features and text features, and are learnable parameters of visual and text features, represents matrix multiplication; the bilateral prompting attention module is expressed as: Where Re(·) represents the shape transformation function, L′ is the enhanced visual feature, and its shape is V′ is the enhanced text feature, and its shape is The bilateral prompting module is used to update the visual features and text features as follows: represents the updated visual features, represents the updated text features, α and β represent the corresponding coefficients; Step (3) generating a response graph; For the updated visual features First reorganize it to obtain the reorganized visual features Align the reorganized visual features and the updated text features to get the response between pixel i and text j: Where v represents the channel index and τ represents a learnable temperature parameter used to constrain R i,j range; Step (4) is supervised by the classification loss function For the positive sample Q p and negative samples Q n , respectively calculate the image I for the positive sample Q p and negative samples Q n Response mapping; R p and R n Combined to get the response of the entire sample, and query Q for each text expression i Calculate the image-level score y j , as shown below: in represents a regularization term used to balance positive and negative samples; y j The range is 0-1. The larger its value is, the more likely the current query text Q is. j The higher the match with the input image; The classification loss function is used to supervise the entire classification process, specifically: in It is the supervisory signal generated by visual features, 1 indicates a correct query and 0 indicates an incorrect query; Propose a calibration loss function To improve the positive response graph R p The positioning and segmentation accuracy of the input image I and R p Multiply to get the position of the target object and use it as the anchor point, and then use the correct query expression Q p As positive samples, randomly sample K negative samples from queries describing different objects in the same image. The whole process is expressed as: where S(·,·,·) is a similarity function used to measure the match between the target object and the query: up(·) is the upsampling function, is the cosine similarity calculation function; Step (5) obtaining the highest quality response map based on the response map selection strategy of the positive sample; First, for each of the M positive samples Compute text-to-image response map Then use the above S(·,·,·) to calculate the similarity, add the similarity scores of the current corresponding graph and all positive samples, and reflect the accuracy: Select the response graph with the largest cumulative score Response map as target object; Using R [88] To further improve the accuracy of the response map, after thresholding it, the corresponding pseudo-label is obtained for training the referential image segmentation network; Step (6) uses the pseudo labels to train the reference image segmentation network to segment the image; The reference image segmentation network includes an image encoder, a text encoder, a multimodal feature fusion module and a decoder; the image and text are input into the encoder to obtain corresponding features; The visual features of the last three levels generated by the image encoder and the text encoder are fused with the text features using a multimodal feature fusion module. The obtained cross-modal features are then input into the corresponding decoder to obtain the final segmentation result. The multimodal feature fusion module is based on the attention mechanism. For the input visual features and text features, a linear layer is first used to project them into one dimension to obtain and Where T represents the number of words in the input text; then the visual features are used as Q v , the text feature is regarded as V l and K l , the multimodal feature A is obtained by the following calculation i ; Q v =W q V i ,K l =W k L,V l =W v L Then transpose it to make it consistent with V i After having the same shape, dot multiplication: M i =V i ⊙A i The final multimodal feature M i After reshaping, a linear layer is input to obtain the fused output, and pseudo labels are used for supervision. The loss function selects the standard binary cross entropy function as follows: P ij The closer to the pseudo label y ij , the smaller the value of the loss function.
2. The cross-modal weakly supervised reference image segmentation method according to claim 1, characterized in that: The image encoder Enc v and text encoder Enc t Taken from the CLIP model.
Citation Information
Cited By
Image saliency detection method and system based on multi-source weak supervision
CN119888261A
Classification prediction method and system for myelofibrosis of full-slice image, and storage medium
CN121053118A
