Medical image prediction method based on multi-modal comparative learning
Through the multi-modal contrast learning method, combined with the pulmonary nodule pre-segmentation module and text knowledge-guided contrast learning, the image feature extraction network is optimized, solving the problem of difficulty in distinguishing similar pulmonary nodules in the existing technology, and improving pulmonary nodule detection. discriminative ability and predictive accuracy.
Patent Information
- Application Number
- CN202410847584.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-10-29
AI Technical Summary
It is difficult to distinguish pulmonary nodules with similar appearances with existing technology, and it is especially difficult to efficiently utilize text annotations by radiologists, making it difficult to distinguish between benign and malignant pulmonary nodules that are similar.
A medical image prediction method based on multi-modal contrast learning is adopted. By acquiring the pulmonary nodule image data set and text embedding data, a multi-modal contrast learning model is constructed, using the pulmonary nodule pre-segmentation module, attribute extraction module and text knowledge-guided Contrastive learning optimizes the image feature extraction network and improves the ability to distinguish similar pulmonary nodules.
It achieves precise alignment of images and text in latent semantic space, improves the classification model's ability to identify true-positive nodules, enhances the ability to distinguish similar lung nodules, reduces background interference, improves prediction accuracy, and captures lung Nodule boundary information and details.
Smart Images

Figure CN118864362A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a medical image prediction method based on multimodal contrast learning. Background Art
[0002] Lung cancer is a malignant tumor that originates from lung tissue. The early lesions of lung cancer are called pulmonary nodules, which are very likely to deteriorate into malignant tumors. Early diagnosis of pulmonary nodules is crucial to the treatment of lung cancer. Low-dose computed tomography (LDCT) is the key to detecting pulmonary nodules in clinical practice. It provides a large amount of medical image data for accurate segmentation of pulmonary nodules and in-depth evaluation of their morphology, size, pathology and other characteristics. However, the diversity and complexity of pulmonary nodules will put a huge test on the energy and experience of radiologists.
[0003] Pulmonary nodules are local high-density, round-shaped, solid or subsolid lung shadows with a diameter of ≤3 cm in medical imaging. Pulmonary nodules are classified into different types: solitary pulmonary nodules and multiple pulmonary nodules by number; tiny nodules and small nodules by size; solid nodules and subsolid nodules by density (among which, subsolid nodules include pure ground glass nodules and mixed nodules with both ground glass density and solid density). Solitary pulmonary nodules are soft tissue shadows with clear boundaries, increased density, a diameter of ≤3 cm, and surrounded by air-containing lung tissue; while multiple pulmonary nodules often appear as a single pulmonary nodule accompanied by one or more small nodules.
[0004] In current clinical practice, most radiologists diagnose the benign or malignant nature of lung nodules by observing the various morphological features of lung nodules. The above methods still face challenges in distinguishing lung nodules with similar appearances. It is not only difficult to distinguish similar lung nodules with adjacent grade labels, but also difficult to efficiently utilize the radiologists' text annotations.
[0005] Currently, no effective solution has been proposed for the problems in the related technologies. Summary of the invention
[0006] 1. Technical issues to be resolved
[0007] In view of the shortcomings of the prior art, the present invention provides a medical image prediction method based on multimodal contrastive learning, which has the advantages of optimizing the image feature extraction network and improving the ability to distinguish similar lung nodules, thereby solving the problem of difficulty in distinguishing similar lung nodules with adjacent level labels.
[0008] (II) Technical solution
[0009] In order to achieve the above advantages of optimizing the image feature extraction network and improving the ability to distinguish similar lung nodules, the specific technical solutions adopted by the present invention are as follows:
[0010] A medical image prediction method based on multimodal contrastive learning, the medical image prediction method based on multimodal contrastive learning comprises the following steps:
[0011] S1. Obtain a lung nodule image dataset and pair text embedding data for the image dataset; preprocess the lung nodule image dataset and text embedding data respectively;
[0012] S2. Building a multimodal contrastive learning model based on the preprocessed lung nodule image dataset and text embedding data, and performing initial training on the multimodal contrastive learning model;
[0013] S3, adjusting the parameters of the multimodal contrastive learning model after the initial training and performing secondary training, and performing performance testing and performance evaluation on the multimodal contrastive learning model after the training;
[0014] S4. Use the multimodal contrastive learning model that meets the performance evaluation standards to predict the lung nodule image dataset and obtain the prediction results of benign and malignant lung nodules.
[0015] Preferably, obtaining a pulmonary nodule image dataset and pairing text embedding data for the image dataset; preprocessing the pulmonary nodule image dataset and the text embedding data respectively comprises the following steps:
[0016] S11, obtaining a lung nodule image data set including lung nodule images, marking the center of the lung nodule position in each lung nodule image, and performing region extraction on the lung nodule image using the marked center as a cropping center;
[0017] S12, annotating attributes of each lung nodule image in the lung nodule image dataset, and defining a corresponding relationship between the attribute annotation content and the lung nodule position;
[0018] S13, creating a sub-dataset based on the correspondence between the attribute annotation content and the location of the lung nodules, and embedding the category label text in the sub-dataset;
[0019] S14. Input the attribute annotation content and category label text into the pre-trained text encoder to obtain the lung nodule classification feature attributes.
[0020] Preferably, the sub-datasets include data set PARTS-A, data set PARTS-B and data set PARTS-C;
[0021] The training set and test set of the sub-dataset PARTS-A contain benign nodules, malignant nodules, and uncertain nodules;
[0022] The training set of the sub-dataset PARTS-B contains benign nodules, malignant nodules, and uncertain nodules, and the test set of the sub-dataset PARTS-B contains benign nodules and malignant nodules;
[0023] The training set and test set of the sub-dataset PARTS-C contain both benign nodules and malignant nodules.
[0024] Preferably, constructing a multimodal contrastive learning model based on the preprocessed lung nodule image dataset and text embedding data, and initially training the multimodal contrastive learning model comprises the following steps:
[0025] S21. constructing a lung nodule image segmentation module using image segmentation processing technology, and segmenting the lung nodule image based on probability prediction results of the image foreground and image background;
[0026] S22, extracting lung nodule features from the segmented lung nodule image, optimizing and classifying the lung nodule features in turn, and extracting a text embedding set and an attribute embedding set of the lung nodule classification features;
[0027] S23, using a lung nodule attribute weighting module to calculate weights for word embedding elements in a text embedding set and an attribute embedding set to obtain feature recognition information;
[0028] S24, using the attention pooling feature mapping module to map the feature recognition information to obtain comparative learning features;
[0029] S25. Arrange the segmented lung nodule images according to the lung nodule classification features, and train a multimodal contrastive learning model based on the contrastive learning features.
[0030] Preferably, constructing a lung nodule image segmentation module using image segmentation processing technology, and segmenting the lung nodule image based on the probability prediction results of the image foreground and the image background includes the following steps:
[0031] S211, a pulmonary nodule image segmentation module is formed by a preprocessing module, an upsampling module and a downsampling module, and the pulmonary nodule image is input into the preprocessing module to increase the pulmonary nodule feature information of the pulmonary nodule image;
[0032] S212, transmitting the lung nodule image processed by the preprocessing module to the upsampling module and the downsampling module in sequence for downsampling and upsampling processing;
[0033] S213, input the lung nodule image after downsampling and upsampling processing into the foreground and background prediction module to integrate the lung nodule feature information, and use the normalization function to output the probability distribution of the lung nodule image foreground and the nodule image background, so as to achieve the segmentation of the lung nodule image.
[0034] Preferably, extracting lung nodule features from the segmented lung nodule image, optimizing and classifying the lung nodule features in sequence, and extracting a text embedding set and an attribute embedding set of lung nodule classification features include the following steps:
[0035] S221, using an image encoder to extract features from the segmented pulmonary nodule image, and generating a feature map using the extracted pulmonary nodule features through an attention pooling module;
[0036] S222. Input the attribute embedding set into the text decoder to generate lung nodule attribute features, and input the attribute annotation content into the text decoder to generate a text embedding set of lung nodule classification features.
[0037] Preferably, using the attention pooling feature mapping module to map the feature recognition information to obtain the comparative learning features includes the following steps:
[0038] S241, reshape and flatten the feature map generated by the attention pooling module of the lung nodule image features into a feature vector;
[0039] S242, performing full pooling processing on the feature vector, and embedding the learning position parameter into the feature vector after the full pooling processing to obtain an embedded feature vector;
[0040] S243. Generate a feature mapping vector from the embedded feature vector through a multi-head attention mechanism, and use the feature mapping vector as a comparative learning feature.
[0041] Preferably, arranging the segmented pulmonary nodule images according to the pulmonary nodule classification features and training the multimodal contrastive learning model based on the contrastive learning features comprises the following steps:
[0042] S251, generating a loss function of a contrastive learning module by combining the alignment loss function of the lung nodule image and the image category, the alignment loss function of the lung nodule image and the image attribute, and the loss function of the category and attribute alignment;
[0043] S252, combining the weighted binary cross entropy loss function with the Dice coefficient loss function to generate a loss function of the lung nodule image segmentation module;
[0044] S253, calculating the overall loss function by combining the loss function of the contrastive learning module and the loss function of the lung nodule image segmentation module with the loss function of the classification decoder, and training the multimodal contrastive learning model based on the overall loss function.
[0045] Preferably, adjusting the parameters of the multimodal contrastive learning model after the initial training and performing secondary training, and sequentially performing performance testing and performance evaluation on the multimodal contrastive learning model after the training include the following steps:
[0046] S31, training the multimodal contrastive learning model based on a preset training cycle, and updating model parameters during the training process of the multimodal contrastive learning model;
[0047] S32, analyzing whether the loss curve and performance index of the multimodal contrastive learning model during the training process meet the preset conditions, and when the preset conditions are met, taking the current multimodal contrastive learning model as the final multimodal contrastive learning model;
[0048] S33. Obtain the mean value and standard deviation, combine the image encoder and the classification decoder to generate the final classification result of the lung nodule image, and evaluate the performance of the multimodal contrast learning model based on the final classification result.
[0049] Preferably, the weight calculation formula is:
[0050]
[0051] In the formula, ω m is the weight vector;
[0052] v m Represents the corresponding lung nodule attribute α m Ratings;
[0053] m is the mth sample;
[0054] M is the total number of lung nodule attribute embeddings.
[0055] (III) Beneficial effects
[0056] Compared with the prior art, the present invention provides a medical image prediction method based on multimodal contrast learning, which has the following advantages:
[0057] Beneficial effects:
[0058] 1. The present invention achieves precise alignment of images and texts in the latent semantic space by introducing a lung nodule pre-segmentation module, a channel-based attribute extraction module, a lung nodule attribute weighting module, and contrastive learning guided by text knowledge, effectively improving the ability of the classification model to identify true positive nodules, and showing great potential and value in tasks such as image understanding, text generation, multimodal interaction, and lung nodule detection.
[0059] 2. The present invention uses a lung nodule pre-segmentation module to not only increase the feature information of the image, reduce the size of the feature map of the lung nodule image, but also increase the receiving field, gradually repair the details and spatial dimensions of the feature image, reduce the interference caused by the lung nodule background, and provide convenience for subsequent models to focus on lung nodule images; through a channel-based attribute extraction module, a potential consistency relationship is established between lung nodule image information and complex attribute annotations, which provides interpretability for the attention map focusing on clinical characteristics; through a lung nodule attribute weighting module, different scores given to different degrees of expression of several complex attributes of lung nodules are used to affect the complex attribute characteristics of lung nodules in the form of weights, adjust the attention of the model, and thereby improve the prediction accuracy.
[0060] 3. The present invention deeply explores the potential relationship among CT images, complex attributes, and benign and malignant characteristics of lung nodules through a comparative learning method, and uses their similarities and differences to optimize the image feature extraction network in the multimodal comparative learning model, thereby improving its ability to distinguish similar lung nodules. At the same time, the textual knowledge of lung nodules is used to guide the comparison of image optimization, thereby achieving cross-modal feature alignment and similarity learning of image features, complex attribute features, and benign and malignant features of lung nodules, helping the model to quickly learn the correct category while better capturing the boundary information and details of the lung nodules. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0062] Figure 1 is a flowchart of a medical image prediction method based on multimodal contrast learning according to an embodiment of the present invention;
[0063] Figure 2 It is a schematic diagram of a specific implementation of a medical image prediction method based on multimodal contrast learning according to an embodiment of the present invention. DETAILED DESCRIPTION
[0064] To further illustrate each embodiment, the present invention provides drawings, which are part of the disclosure of the present invention and are mainly used to illustrate the embodiments. They can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these contents, ordinary technicians in this field should be able to understand other possible implementation methods and advantages of the present invention.
[0065] According to an embodiment of the present invention, a medical image prediction method based on multimodal contrastive learning is provided.
[0066] The present invention is further described with reference to the accompanying drawings and specific embodiments. Figure 1-Figure 2 As shown, according to the medical image prediction method based on multimodal contrastive learning according to an embodiment of the present invention, the medical image prediction method based on multimodal contrastive learning includes the following steps:
[0067] S1. Obtain a lung nodule image dataset and pair text embedding data for the image dataset; preprocess the lung nodule image dataset and text embedding data respectively.
[0068] Wherein, obtaining a pulmonary nodule image dataset and pairing text embedding data with the image dataset; preprocessing the pulmonary nodule image dataset and the text embedding data respectively includes the following steps:
[0069] S11. Acquire a lung nodule image dataset including lung nodule images, mark the center of the lung nodule position in each lung nodule image, and use the marked center as a cropping center to perform region extraction on the lung nodule image.
[0070] It should be noted that the CT image of the lung nodule is obtained, the center of the lung nodule is annotated, and a cube containing the CT background image and the lung nodule image is extracted with the annotated center of the lung nodule as the cropping center and twice the equivalent diameter as the side length. Then the lung nodule sample is adjusted to a volume of 32×32×32 to facilitate the subsequent processing of the multimodal contrast learning model.
[0071] S12. Attribute annotation is performed on each lung nodule image in the lung nodule image dataset, and a corresponding relationship between the attribute annotation content and the lung nodule position is defined.
[0072] It should be noted that the acquired lung nodule images were annotated with attributes, and all multimodal images were annotated with the same eight attributes, including: "subtlety", "internal structure", "calcification", "sphericity", "edge", "lobulation", "spiny" and "texture"; most of the standard ranges of the attributes were 1-5, and the calcification and internal structure scores ranged from 1-6. Lung nodules with attribute annotations between 2.5 and 3.5 were defined as uncertain nodules, lung nodules with attribute annotations below 2.5 were defined as benign nodules, and lung nodules with attribute annotations above 3.5 were defined as malignant nodules.
[0073] S13. Create a sub-dataset based on the correspondence between the attribute annotation content and the location of the lung nodules, and embed the category label text in the sub-dataset.
[0074] It should be noted that three sub-datasets were created based on the given pulmonary nodule image dataset and score definition, and the three sub-datasets include PARTS-A, PARTS-B, and PARTS-C;
[0075] Among them, the training and test sets of the sub-dataset PARTS-A contain three types of pulmonary nodules (benign nodules, malignant nodules, and uncertain nodules); the training set of the sub-dataset PARTS-B contains three types of pulmonary nodules, and the test set only contains benign and malignant nodules; the training and test sets of the sub-dataset PARTS-C contain both benign and malignant nodules.
[0076] S14. Input the attribute annotation content and category label text into the pre-trained text encoder to obtain the lung nodule classification feature attributes.
[0077] It should be noted that the pre-trained CLIP text encoder VIT-B / 16 is used as the text encoder. After the above attribute annotations and benign and malignant are passed through the same text encoder, the complex attribute features of pulmonary nodules A∈R M×d , lung nodule classification features C∈R K×d , where d represents the length of the feature vector, specifically 512; R M×d Represented as an image feature matrix with M rows and d columns, R K×d Represents the class feature matrix with K rows and d columns.
[0078] S2. Build a multimodal contrastive learning model based on the preprocessed lung nodule image dataset and text embedding data, and perform initial training on the multimodal contrastive learning model.
[0079] It should be noted that a multimodal contrastive learning model is constructed, and a lung nodule pre-segmentation module is used to combine individual pixels to predict the image foreground and background probabilities to achieve lung nodule segmentation and improve segmentation accuracy. At the same time, a channel attribute extraction module is used to perform feature splitting and information extraction for subsequent comparative learning of images with their complex attributes and categories of lung nodules. A lung nodule attribute weighting module is introduced to distinguish different lung nodule samples, providing more identification information while using the training set to train the multimodal contrastive learning model.
[0080] Among them, building a multimodal contrastive learning model based on the preprocessed lung nodule image dataset and text embedding data, and initially training the multimodal contrastive learning model includes the following steps:
[0081] S21. Use image segmentation processing technology to construct a lung nodule image segmentation module, and segment the lung nodule image based on the probability prediction results of the image foreground and image background.
[0082] Among them, using image segmentation processing technology to build a lung nodule image segmentation module, and segmenting the lung nodule image based on the probability prediction results of the image foreground and image background includes the following steps:
[0083] S211, a pulmonary nodule image segmentation module is formed by a preprocessing module, an upsampling module and a downsampling module, and the pulmonary nodule image is input into the preprocessing module to increase the pulmonary nodule feature information of the pulmonary nodule image;
[0084] S212, transmitting the lung nodule image processed by the preprocessing module to the upsampling module and the downsampling module in sequence for downsampling and upsampling processing;
[0085] S213, input the lung nodule image after downsampling and upsampling processing into the foreground and background prediction module to integrate the lung nodule feature information, and use the normalization function to output the probability distribution of the lung nodule image foreground and the nodule image background, so as to achieve the segmentation of the lung nodule image.
[0086] It should be noted that the lung nodule pre-segmentation module is mainly composed of a preprocessing module, 4 upsampling modules, and 4 downsampling modules for foreground and background prediction. The preprocessing module consists of two 1×1×1 convolutional layers, and its main purpose is to increase the depth of the network and CT images and increase the feature information of the image; the upsampling part and the downsampling part are respectively composed of convolution and transposed convolution with a convolution kernel of 3×3×3 and a step size of 2; the main task of the downsampling part is to reduce the size of the feature map of the lung nodule image and increase the receiving domain, while the main task of the upsampling is to amplify the resolution and gradually repair the details and spatial dimensions of the feature image; finally, after the lung nodule image passes through the upsampling and downsampling modules, it is input into the foreground and background prediction module, which includes a 1×1×1 convolutional layer and a softmax function of the channel dimension. The foreground and background prediction module can predict the probability of the foreground and background based on individual pixels of the image, thereby realizing lung nodule segmentation and improving segmentation accuracy.
[0087] S22. Extract lung nodule features from the segmented lung nodule image, optimize and classify the lung nodule features in turn, and extract a text embedding set and an attribute embedding set of the lung nodule classification features.
[0088] Among them, extracting lung nodule features from the segmented lung nodule image, optimizing and classifying the lung nodule features in turn, and extracting a text embedding set and an attribute embedding set of the lung nodule classification features include the following steps:
[0089] S221. Use an image encoder to extract features from the segmented lung nodule image, and generate a feature map using the extracted lung nodule features through an attention pooling module.
[0090] It should be noted that the image encoder (the image encoder is ResNet-34) is used to extract the lung nodule image I i The characteristics of F∈R b×c×h×w×l, where b, c, h, w and d are the batch, channel, length, width and height of the pulmonary nodule features respectively, which are passed through the channel-wise attention pooling feature mapping module to generate the feature map F′∈R b×d , where d is the length of the feature vector, R b×d The attribute feature matrix with a total of b rows and d columns is embedded in the attribute. The generated feature map is used for subsequent comparative learning of the image and its complex attributes and categories of lung nodules.
[0091] S222. Input the attribute embedding set into the text decoder to generate lung nodule attribute features, and input the attribute annotation content into the text decoder to generate a text embedding set of lung nodule classification features.
[0092] It should be noted that the text encoder uses ViT-B / 16 as the text encoding for the benign and malignant nature of lung nodules and various complex attribute annotations, which is used to optimize and classify the visual features of lung nodules using text annotation information. The image encoder only uses the feature extraction part of ResNet-34 and discards its original image classification part, making the training process more stable.
[0093] ResNet-34 is a deep convolutional neural network architecture, part of the ResNet (residual network) family. Residual connections allow information to flow more freely in the network, avoiding the gradient vanishing problem and making training very deep neural networks more stable. Image encoders are used to extract industrial part images. i The features of , generate feature maps, and input the attribute embedding set into the pre-trained text decoder g φ Generate the corresponding attribute feature g φ (α m )=A m , where A m Denote m corresponding to the attribute embedding matrix, and input the attribute annotation into the pre-trained text decoder to generate the corresponding text embedding set of category labels.
[0094] S23. Use the lung nodule attribute weighting module to calculate the weights of the word embedding elements in the text embedding set and the attribute embedding set to obtain feature recognition information.
[0095] It should be noted that after the complex attribute embedding set of pulmonary nodules is standardized, the pulmonary nodule attribute weighting module is used to distinguish benign and malignant pulmonary nodules, and the corresponding feature recognition information is obtained to provide more recognition information for model training. The weight calculation formula is:
[0096]
[0097] In the formula, ω m is the weight vector;
[0098] v m Represents the corresponding lung nodule attribute α m Ratings;
[0099] m is the mth sample;
[0100] M is the total number of lung nodule attribute embeddings.
[0101] S24. Use the attention pooling feature mapping module to map the feature recognition information to obtain comparative learning features.
[0102] It should be noted that the obtained features are generated into feature maps through the attention pooling feature mapping module in the channel direction, which are used for subsequent comparative learning of the image and its complex attributes and categories of lung nodules, helping the model to better understand the complexity and diversity of the potential feature information of lung nodules. Among them, the feature recognition information is mapped using the attention pooling feature mapping module to obtain comparative learning features, which includes the following steps:
[0103] S241, reshape and flatten the feature map generated by the attention pooling module of the lung nodule image features into a feature vector;
[0104] S242, performing full pooling processing on the feature vector, and embedding the learning position parameter into the feature vector after the full pooling processing to obtain an embedded feature vector;
[0105] S243. Generate a feature mapping vector from the embedded feature vector through a multi-head attention mechanism, and use the feature mapping vector as a comparative learning feature.
[0106] It should be noted that the generated feature map is reshaped and flattened into a vector F through a 1×1×1 convolutional layer. conv1 ∈R hdl×b×c , F conv1 Perform global pooling and embed the learnable position parameters into the pooled F conv1 Get vector F pos ∈R (hdl+1)×b×c , and obtain the feature mapping vector F′∈R through the multi-head attention mechanism b×d It is used for comparative learning of subsequent images and their complex attributes and categories of lung nodules, where b, c, l, w, and h represent the batch, channel, length, width, and height of lung nodule features, respectively, and d is the feature vector length, which is set to 512.
[0107] S25. Arrange the segmented lung nodule images according to the lung nodule classification features, and train a multimodal contrastive learning model based on the contrastive learning features.
[0108] It should be noted that the pulmonary nodule classification dataset is arranged as {I, Y, C, A}, where is the lung nodule image, i is the number of samples, is the corresponding class label set, y i represents each class label, N is the total number of images, is the classification feature of lung nodules, c k is the labeling of benign and malignant pulmonary nodules, K is the number of categories, k is the kth category, is the complex attribute embedding set of lung nodules, each element α m represents the embedding of each lung nodule attribute word, and M is the total number of attribute embeddings.
[0109] Arranging the segmented lung nodule images according to the lung nodule classification features and training the multimodal contrastive learning model based on the contrastive learning features includes the following steps:
[0110] S251. Generate a loss function for the contrastive learning module by combining the alignment loss function of the lung nodule image and the image category, the alignment loss function of the lung nodule image and the image attribute, and the loss function for the category and attribute alignment.
[0111] It should be noted that the loss function L of the contrastive learning module for pulmonary nodule text knowledge-guided image optimization is ali The purpose of contrastive learning is to reduce the distance between the positive sample and the negative sample, so that the distance between the positive sample and the anchor point is much smaller than the distance between the negative sample and the anchor point; the contrastive learning module realizes the image features, complex attribute features, benign and malignant features of pulmonary nodules, cross-modal feature alignment and similarity learning, among which the loss function L of the contrastive learning module is ali Mainly composed of the image-category alignment loss function L I-C , image-attribute alignment loss function L I-A And attribute-category alignment loss function L C-A The calculation formula is as follows:
[0112] L ali =L I-C +αL I-A +βL C-A ;
[0113] In the formula, α and β are hyperparameters for adjusting the loss function and are set to 1 and 0.5 respectively.
[0114] It should be noted that the image-category alignment loss function L is generated by minimizing the cross entropy loss combined with the predicted probability to align the image and class information. I-C , and its calculation formula is as follows:
[0115]
[0116]
[0117] Where σ is the cosine similarity of the two features, T is the total number of vector rows, t is each row of the vector, K is the number of classes, k is the kth class, τ is the temperature term in the loss function, and p is the i is the predicted probability of the classification network for the lung nodule, y i is the true classification value of the lung nodule, F t is the eigenvector corresponding to row t, c k Mark the benign and malignant nature of lung nodules.
[0118] It should be noted that the image and attribute information are aligned by minimizing the cross entropy loss combined with the predicted probability. In order to solve the problem that each complex attribute score of each lung nodule is different, the weight of a single lung nodule attribute score in the overall score is also inconsistent. m Previously, it was multiplied by the weight of the corresponding complex attribute, realizing that some image feature maps can have complex attributes with scoring weights for guidance and optimization, where the image-attribute alignment loss function L I-A The calculation formula is as follows:
[0119]
[0120] In the formula, is the minimum contrastive learning loss for image attributes, F t is the eigenvector corresponding to row t, ω m is the weight vector matrix corresponding to m, A m is the attribute embedding vector matrix corresponding to m, ω m′ is the weight vector matrix corresponding to m′, A m′ is the attribute embedding vector matrix corresponding to m′, T is the total number of vector rows, τ is the temperature term in the loss function; M is the total number of lung nodule attribute embeddings, and m is the mth sample.
[0121] It should be noted that the minimization of cross entropy loss combined with predicted probability is used to align class and attribute information. Although the two-point image features of lung nodules have been aligned with the classes and attributes, the complex attributes of lung nodules and their weights still play a very important role in the judgment of benign and malignant lung nodules. At the same time, it is also necessary to avoid the embedding of benign and malignant classification features, which may be biased in the latent space, resulting in inconsistency between the class space and the attribute space, affecting the diagnosis of benign and malignant lung nodules. Therefore, class-attribute alignment is also performed by minimizing InfoNCE loss (Information Noise-Contrastive Estimation Loss, InfoNCE loss is a loss function commonly used in self-supervised learning and representation learning, mainly used to train models to learn effective representations of data). Among them, the class-attribute alignment loss function L C-A The calculation formula is as follows:
[0122]
[0123] In the formula, is the class-attribute alignment loss function, c k To mark benign and malignant pulmonary nodules, m is the weight vector matrix corresponding to m, A m is the attribute embedding vector matrix corresponding to m, ω m′ is the weight vector matrix corresponding to m′, A m′ is the attribute embedding vector matrix corresponding to m′, and τ is the temperature term in the loss function.
[0124] S252. Combining the weighted binary cross entropy loss function with the Dice coefficient loss function to generate a loss function for the lung nodule image segmentation module.
[0125] It should be noted that in order to solve the problems of difficult segmentation of lung nodule edge details and frequent imbalance between lung nodules and background pixels, the lung nodule image segmentation loss function L seg Defined as the weighted binary cross entropy loss function And Dice coefficient loss function L Dice The calculation formula is as follows:
[0126]
[0127] Where, L seg is the lung nodule image segmentation loss function, is the weighted binary cross entropy loss function, L Dice is the Dice coefficient loss function, and W represents the weight vector.
[0128] It should be noted that the binary cross entropy loss function It is a loss function widely used in image segmentation. W is the weight vector. This loss function can converge faster in training, while the Dice coefficient loss function L Dice The similarity between the predicted segmentation and the true segmentation is directly quantified. Combining the two loss functions can take advantage of their advantages, helping the model to quickly learn the correct category while better capturing the boundary information and details of the lung nodules.
[0129] S253, calculating the overall loss function by combining the loss function of the contrastive learning module and the loss function of the lung nodule image segmentation module with the loss function of the classification decoder, and training the multimodal contrastive learning model based on the overall loss function.
[0130] It should be noted that the cross entropy loss function between the pulmonary nodule classification decoder and its true value label is used. The loss function L of the pulmonary nodule classification decoder is cls, and its calculation formula is as follows:
[0131]
[0132] In the formula, p i is the predicted probability of the classification network for the lung nodule, y i is the true classification value of the lung nodule.
[0133] It should be noted that the overall loss function mainly includes the loss functions of three modules, namely, the loss function L of the lung nodule image segmentation module and the loss function L of the pulmonary nodule image segmentation module. seg , the loss function L of the contrastive learning module for pulmonary nodule text knowledge-guided image optimization ali , the loss function L of the pulmonary nodule classification decoder cls , the calculation formula of the overall loss function is as follows:
[0134] L=L seg +L ali +L cls ;
[0135] Where, L seg is the loss function of the lung nodule image segmentation module, L ali The loss function of the contrastive learning module for pulmonary nodule text knowledge guided image optimization, L cls is the loss function of the decoder for lung nodule classification.
[0136] S3. Adjust the parameters of the multimodal contrastive learning model after the initial training and conduct secondary training, and perform performance testing and performance evaluation on the multimodal contrastive learning model after the training.
[0137] Among them, adjusting the parameters of the multimodal contrastive learning model after the initial training and performing secondary training, and sequentially performing performance testing and performance evaluation on the multimodal contrastive learning model after the training include the following steps:
[0138] S31, training the multimodal contrastive learning model based on a preset training cycle, and updating model parameters during the training process of the multimodal contrastive learning model;
[0139] S32, analyzing whether the loss curve and performance index of the multimodal contrastive learning model during the training process meet the preset conditions, and when the preset conditions are met, taking the current multimodal contrastive learning model as the final multimodal contrastive learning model;
[0140] S33. Obtain the mean value and standard deviation, combine the image encoder and the classification decoder to generate the final classification result of the lung nodule image, and evaluate the performance of the multimodal contrast learning model based on the final classification result.
[0141] S4. Use the multimodal contrastive learning model that meets the performance evaluation standards to predict the lung nodule image dataset and obtain the prediction results of benign and malignant lung nodules.
[0142] It should be noted that the image-text fusion contrast learning model was trained. During training, the batch size (batchsize) was evaluated with 12 and 500 epochs. The optimizer was stochastic gradient descent, the initial learning rate was 0.0001, the momentum was 0.9, the weight decay was 0.008, the temperature τ was initialized to 0.07, and the model parameters were updated during the training process; the model was saved every 12 epochs, and when the curve was stable for 500 epochs, the current image-text fusion contrast learning model was saved; the mean and standard deviation were reported, the lung nodule image information was input into the lung nodule image encoder, and the final classification result was obtained directly through the lung nodule classification decoder, and the recall rate and F1 score values were used to evaluate the image-text fusion contrast learning model.
[0143] In summary, with the help of the above-mentioned technical scheme of the present invention, the present invention realizes the precise alignment of images and texts in the latent semantic space by introducing a lung nodule pre-segmentation module, a channel-based attribute extraction module, a lung nodule attribute weighting module and contrastive learning guided by text knowledge, effectively improving the ability of the classification model to identify true positive nodules, and showing great potential and value in tasks such as image understanding, text generation, multimodal interaction and lung nodule detection; the present invention not only increases the feature information of the image and reduces the size of the feature map of the lung nodule image through the lung nodule pre-segmentation module, but also increases the receiving field, gradually repairs the details and spatial dimensions of the feature image, reduces the interference caused by the lung nodule background, and provides convenience for subsequent models to focus on lung nodule images; through the channel-based attribute extraction module, the lung nodule image information is potentially consistent with the complex attribute annotations. The present invention provides an explainable attention map focusing on clinical features. The lung nodule attribute weighting module uses different scores given to different degrees of expression of several complex attributes of lung nodules to influence the complex attribute characteristics of lung nodules in the form of weights, adjusts the attention of the model, and thus improves the prediction accuracy. The present invention deeply explores the potential relationship among CT images, complex attributes of lung nodules, and benign and malignant characteristics in lung nodules through a contrastive learning method, and optimizes the image feature extraction network in the multimodal contrastive learning model by using their similarities and differences, thereby improving its ability to distinguish similar lung nodules. At the same time, the textual knowledge of lung nodules is used to guide the comparison of image optimization, thereby realizing the cross-modal feature alignment and similarity learning of the image features, complex attribute features, and benign and malignant features of lung nodules, helping the model to quickly learn the correct category while better capturing the boundary information and details of the lung nodules.
[0144] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A medical image prediction method based on multimodal contrastive learning, It is characterized in that The medical image prediction method based on multimodal contrastive learning includes the following steps: S1. Obtain a lung nodule image dataset and pair text embedding data for the image dataset; preprocess the lung nodule image dataset and text embedding data respectively; S2. Building a multimodal contrastive learning model based on the preprocessed lung nodule image dataset and text embedding data, and performing initial training on the multimodal contrastive learning model; S3, adjusting the parameters of the multimodal contrastive learning model after the initial training and performing secondary training, and performing performance testing and performance evaluation on the multimodal contrastive learning model after the training; S4. Use the multimodal contrastive learning model that meets the performance evaluation standards to predict the lung nodule image dataset and obtain the prediction results of benign and malignant lung nodules.
2. The medical image prediction method based on multimodal contrastive learning according to claim 1, It is characterized in that The method of obtaining a pulmonary nodule image dataset and pairing text embedding data with the image dataset; and preprocessing the pulmonary nodule image dataset and the text embedding data respectively comprises the following steps: S11, obtaining a lung nodule image data set including lung nodule images, marking the center of the lung nodule position in each lung nodule image, and performing region extraction on the lung nodule image using the marked center as a cropping center; S12, annotating attributes of each lung nodule image in the lung nodule image dataset, and defining a corresponding relationship between the attribute annotation content and the lung nodule position; S13, creating a sub-dataset based on the correspondence between the attribute annotation content and the location of the lung nodules, and embedding the category label text in the sub-dataset; S14. Input the attribute annotation content and category label text into the pre-trained text encoder to obtain the lung nodule classification feature attributes.
3. The medical image prediction method based on multimodal contrastive learning according to claim 2, It is characterized in that The sub-datasets include data set PARTS-A, data set PARTS-B and data set PARTS-C; The training set and test set of the sub-dataset PARTS-A both contain benign nodules, malignant nodules, and nodules that cannot be determined; The training set of the sub-dataset PARTS-B contains benign nodules, malignant nodules and nodules that cannot be judged, and the test set of the sub-dataset PARTS-B contains benign nodules and malignant nodules; The training set and the test set of the sub-dataset PARTS-C contain both benign nodules and malignant nodules.
4. The medical image prediction method based on multimodal contrastive learning according to claim 3, It is characterized in that The method of constructing a multimodal contrastive learning model based on the preprocessed lung nodule image dataset and text embedding data and performing initial training on the multimodal contrastive learning model includes the following steps: S21. constructing a lung nodule image segmentation module using image segmentation processing technology, and segmenting the lung nodule image based on probability prediction results of the image foreground and image background; S22, extracting lung nodule features from the segmented lung nodule image, optimizing and classifying the lung nodule features in turn, and extracting a text embedding set and an attribute embedding set of the lung nodule classification features; S23, using a lung nodule attribute weighting module to calculate weights for word embedding elements in a text embedding set and an attribute embedding set to obtain feature recognition information; S24, using the attention pooling feature mapping module to map the feature recognition information to obtain comparative learning features; S25. Arrange the segmented lung nodule images according to the lung nodule classification features, and train a multimodal contrastive learning model based on the contrastive learning features.
5. The medical image prediction method based on multimodal contrastive learning according to claim 4, It is characterized in that The method of constructing a lung nodule image segmentation module by using image segmentation processing technology and segmenting the lung nodule image based on the probability prediction results of the image foreground and the image background includes the following steps: S211, a pulmonary nodule image segmentation module is formed by a preprocessing module, an upsampling module and a downsampling module, and the pulmonary nodule image is input into the preprocessing module to increase the pulmonary nodule feature information of the pulmonary nodule image; S212, transmitting the lung nodule image processed by the preprocessing module to the upsampling module and the downsampling module in sequence for downsampling and upsampling processing; S213, input the lung nodule image after downsampling and upsampling processing into the foreground and background prediction module to integrate the lung nodule feature information, and use the normalization function to output the probability distribution of the lung nodule image foreground and the nodule image background, so as to achieve the segmentation of the lung nodule image.
6. The medical image prediction method based on multimodal contrastive learning according to claim 5, It is characterized in that The method of extracting lung nodule features from the segmented lung nodule image, optimizing and classifying the lung nodule features in sequence, and extracting a text embedding set and an attribute embedding set of the lung nodule classification features comprises the following steps: S221, using an image encoder to extract features from the segmented pulmonary nodule image, and generating a feature map using the extracted pulmonary nodule features through an attention pooling module; S222. Input the attribute embedding set into the text decoder to generate lung nodule attribute features, and input the attribute annotation content into the text decoder to generate a text embedding set of lung nodule classification features.
7. The medical image prediction method based on multimodal contrastive learning according to claim 6, It is characterized in that The method of using the attention pooling feature mapping module to map the feature recognition information to obtain the comparative learning features includes the following steps: S241, reshape and flatten the feature map generated by the attention pooling module of the lung nodule image features into a feature vector; S242, performing full pooling processing on the feature vector, and embedding the learning position parameter into the feature vector after the full pooling processing to obtain an embedded feature vector; S243. Generate a feature mapping vector from the embedded feature vector through a multi-head attention mechanism, and use the feature mapping vector as a comparative learning feature.
8. The medical image prediction method based on multimodal contrastive learning according to claim 7, It is characterized in that The step of arranging the segmented pulmonary nodule images according to the pulmonary nodule classification features and training the multimodal contrastive learning model based on the contrastive learning features comprises the following steps: S251, generating a loss function of a contrastive learning module by combining the alignment loss function of the lung nodule image and the image category, the alignment loss function of the lung nodule image and the image attribute, and the loss function of the category and attribute alignment; S252, combining the weighted binary cross entropy loss function with the loss function of the similarity coefficient to generate a loss function of the lung nodule image segmentation module; S253, calculating the overall loss function by combining the loss function of the contrastive learning module and the loss function of the lung nodule image segmentation module with the loss function of the classification decoder, and training the multimodal contrastive learning model based on the overall loss function.
9. The medical image prediction method based on multimodal contrastive learning according to claim 8, It is characterized in that The adjusting of the parameters of the multimodal contrastive learning model after the initial training and the secondary training, and the sequential performance testing and performance evaluation of the multimodal contrastive learning model after the training include the following steps: S31, training the multimodal contrastive learning model based on a preset training cycle, and updating model parameters during the training process of the multimodal contrastive learning model; S32, analyzing whether the loss curve and performance index of the multimodal contrastive learning model during the training process meet the preset conditions, and when the preset conditions are met, taking the current multimodal contrastive learning model as the final multimodal contrastive learning model; S33. Obtain the mean value and standard deviation, combine the image encoder and the classification decoder to generate the final classification result of the lung nodule image, and evaluate the performance of the multimodal contrast learning model based on the final classification result.
10. The medical image prediction method based on multimodal contrastive learning according to claim 9, It is characterized in that The weight calculation formula is: In the formula, ω m is the weight vector; v m Indicates the score corresponding to the attribute of lung nodules; m is the mth sample; M is the total number of lung nodule attribute embeddings.
Citation Information
Patent Citations
Pulmonary nodule benign and malignant classification method based on 3D multi-target feature learning
CN110517253A
Contrast learning prediction method based on image-text fusion
CN117611576A
Cited By
Defect severity prediction method based on multi-modal contrast learning
CN121455797A
