Lung lesion classification method based on comparative learning and active learning
Through comparative learning and active learning methods, unlabeled data are used to build a medical multi-modal basic model, and samples are actively selected for labeling on private data sets, which solves the problem of high labeling costs of deep learning models in the diagnosis of lung lesions. A more efficient and accurate classification of lung lesions is achieved.
Patent Information
- Application Number
- CN202410601951.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-15
- Publication Date
- 2024-08-27
AI Technical Summary
Deep learning models rely on a large amount of labeled data in the diagnosis of lung lesions, making manual annotation costly and time-consuming. Moreover, the characteristics of lung lesions are complex and diverse, making it difficult to effectively utilize unlabeled data for training.
Methods based on contrastive learning and active learning are used to build a medical multimodal basic model on public data sets through multimodal comparative learning, and active learning algorithms are used to actively select samples for labeling on private data sets to form a labeled training set. , to further fine-tune the lung lesion classification model, reduce labeling costs and improve model performance.
Effective use of unlabeled data reduces labeling costs, improves the model's ability to understand lung image features and variations, enhances classification accuracy and interpretability, reduces the need for large amounts of labeled data, and improves the model's performance in specific tasks. performance.
Smart Images

Figure CN118552771A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer multimodality and medical field, and relates to a method of medical multimodality pre-training and active learning, and specifically to a lung lesion classification method based on contrastive learning and active learning. Background Art
[0002] Lung lesion diagnosis is an important branch of medical imaging. With the development of artificial intelligence technology, deep learning models have shown great potential in the diagnosis of lung lesions. However, the training of deep learning models requires a large amount of labeled data and relies heavily on the experience of professional doctors and fine manual annotation. This process is not only time-consuming but also costly.
[0003] At present, the training of conventional deep learning-based lung lesion diagnosis networks is an end-to-end learning process using labeled data, which has high requirements on the quality and quantity of labeled data. The characteristics of lung lesions are diverse and complex, and the cost of manually labeling data is expensive. Summary of the invention
[0004] To solve the above problems, we provide a lung lesion classification method based on contrastive learning and active learning. The invention adopts the following technical solutions:
[0005] The present invention provides a lung lesion classification method based on contrastive learning and active learning, which can make full use of unlabeled data and save labeling costs to complete the training of the lung lesion diagnosis network, including the following steps:
[0006] Step S1, first preprocess the data. The preprocessing of chest X-ray images includes format conversion (DICOM to JPG) and image size cropping, and removes irrelevant information from the original text report. This step ensures that the input data received by the model is of consistent quality, which helps the subsequent pre-training process;
[0007] Step S2, in the pre-training stage, the semantic correspondence between medical images and their corresponding text reports is used to perform multimodal comparative learning on a public chest X-ray image-text report dataset to obtain a medical multimodal basic model, which has a certain feature extraction capability for medical multimodal data.
[0008] Step S3, for the chest X-ray image dataset of the private dataset, input the unlabeled data into the lung lesion classification model, actively select some samples for lung lesion labeling through the active learning algorithm, form a labeled training set, use the labeled data for supervised training, and complete further fine-tuning of the lung lesion classification model.
[0009] Furthermore, the lung lesion classification method based on contrastive learning and active learning provided by the present invention may also have such a technical feature, wherein the classification result of the lung lesions is obtained by the following steps:
[0010] Step T1, in image mode, input the chest X-ray image into a pre-trained image encoder to obtain image features of the chest X-ray image.
[0011] Step T2, in text mode, input the preset text information of lung lesions into the pre-trained text encoder to obtain the text features of lung lesions.
[0012] In step T3, the text features are used as query and the image features are used as key and value, which are input into the Decoder structure of Transformer for attention calculation. The output is the binary classification result of whether the lesion exists.
[0013] Furthermore, the lung lesion classification method based on contrastive learning and active learning provided by the present invention may also have such a technical feature, wherein step S1 includes the following sub-steps:
[0014] Step S1-1, data preprocessing stage, convert the chest X-ray image from DICOM format to JPG format, and we adjust the larger side of the image file to 256 pixels to ensure the uniformity of the input image size;
[0015] Step S1-2, selecting the Findings and Impression parts reflecting the lesions of the chest X-ray images from the text report, removing irrelevant information to prevent interference with model training;
[0016] Furthermore, the lung lesion classification method based on contrastive learning and active learning provided by the present invention may also have such a technical feature, wherein step S2 includes the following sub-steps:
[0017] Step S2-1, inputting the pre-processed chest X-ray image and text report into an image encoder and a text encoder respectively to obtain image features and text features;
[0018] Step S2-2, in the feature space, shorten the distance between the positive sample pairs of the image and text, and lengthen the distance between the negative sample pairs of the image and text.
[0019] Furthermore, the lung lesion classification method based on contrastive learning and active learning provided by the present invention may also have such a technical feature, wherein step S3 includes the following sub-steps:
[0020] Step S3-1, input the image into the lung lesion classification network, calculate the size of the gradient return according to the output pseudo-label, and form a feature set F by selecting samples with larger gradient norm to ensure the uncertainty of sample selection;
[0021] Step S3-2, using the clustering algorithm KMeans++ in the feature set F, selects samples with relatively long distances in the feature space from the set F to ensure the diversity of sample selection;
[0022] Step S3-3, using the selected information-rich samples to annotate to form a labeled training set, and training the lung lesion classification network.
[0023] Function and Effect of the Invention
[0024] According to the lung lesion classification method based on contrastive learning and active learning of the present invention, by performing multimodal contrastive learning on a public data set, a large amount of unlabeled data is fully utilized to reduce the sample annotation cost. Through unsupervised learning, we deeply explore the semantic connection between chest X-ray images and text reports, build a medical multimodal pre-training basic model, and obtain multimodal representations of chest X-ray images and diagnostic reports. The present invention uses an active learning algorithm in the fine-tuning stage, which can actively select the data samples that are most valuable for model improvement for manual annotation. This strategy is mainly used for multi-label classification tasks of lung lesions, and the purpose is to provide more accurate and targeted data for the fine-tuning stage of the pre-training model. Through this method, we not only greatly reduce the demand for a large amount of labeled data, thereby reducing the annotation cost, but also improve the performance of the model on specific tasks, so that the model can better understand and adapt to various characteristics and variations of lung images, thereby achieving higher accuracy in practical applications. For the lung lesion classification network, we use a Transformer-based Decoder module as a query network. This network not only outputs the multi-label classification results of lung lesions, but also displays the attention distribution of the lung lesion classification obtained by the model in the chest X-ray image, clearly indicates the location of the lesion, and increases the interpretability of the classification results. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 is a flow chart of a lung lesion classification method based on contrastive learning and active learning of the present invention;
[0026] Figure 2 is a schematic diagram of the fine-tuning process of the lung lesion classification network in an embodiment of the present invention; DETAILED DESCRIPTION
[0027] In order to make the technical means, creative features, objectives and effects achieved by the present invention easy to understand, the lung lesion classification method based on contrastive learning and active learning of the present invention is specifically described below in combination with embodiments and drawings.
[0028] <Example 1>
[0029] The lung lesion classification method based on contrastive learning and active learning of this embodiment is implemented based on a computer, and the computer has at least one graphics card for GPU acceleration. The medical multimodal basic model and the lung lesion query model used in the lung lesion classification method are stored in the computer in the form of executable code.
[0030] The datasets used in this embodiment are MIMIC-CXR and ChestXRay14 datasets. MIMIC-CXR is a public dataset jointly developed by the Massachusetts Institute of Technology (MIT), Massachusetts General Hospital, and Beth Israel Deaconess Medical Center of Harvard Medical School. It is one of the largest publicly available chest X-ray datasets, containing more than 370,000 chest X-ray images, covering more than 65,000 patients, and its images are associated with detailed electronic health record (EHR) data, including radiology reports. MIMIC-CXR is widely used in the study of medical multimodal contrastive learning. ChestX-ray14 was developed by the National Institutes of Health (NIH) and contains more than 112,000 chest X-ray images, covering 30,805 patients, and contains labels for 14 common chest lesions. These labels are reviewed and annotated by experienced radiologists and are a very valuable labeled dataset for lung lesions.
[0031] Figure 1 4 is a flow chart of a lung lesion classification method based on contrastive learning and active learning in an embodiment of the present invention.
[0032] like Figure 1 As shown, the lung lesion classification method based on contrastive learning and active learning includes the following steps:
[0033] Step S1, performing data preprocessing on chest X-ray images and text reports.
[0034] In this embodiment, the data set comes from MIMIC-CXR, which contains 377,110 chest radiographs in front and side views and 227,835 corresponding radiology reports. Among them, since the image format in the MIMIC-CXR data cannot be directly read and there are differences in image resolution, and the text contains information irrelevant to the lesion, we need to preprocess the data before pre-training. Step S1 includes the following sub-steps S1-1 to S1-2:
[0035] Step S1-1 Image data preprocessing: The preprocessing of chest X-ray images includes batch conversion of DICOM format image files into JPG format to ensure that the image is compatible with a wider range of applications and algorithm libraries in the subsequent image processing and analysis stages. We resize the larger side of the image file to 256 pixels to unify the input image size, which is helpful for subsequent pre-training.
[0036] Step S1-2 Text data preprocessing: The text data in the MIMIC-CXR dataset mainly contains two key parts: Findings and Impression modules. Findings module: This part usually describes the specific details observed in the chest X-ray image, including but not limited to abnormalities of the lungs, pleural effusion, heart size, changes in lung texture, etc. Findings is a detailed description of what the radiologist sees in the image, usually organized according to anatomical structure, listing various findings one by one. Impression module: This part is a summary and evaluation of the Findings, usually containing clinical judgments or recommendations on the patient's condition. Impression is the most important part of the entire report because it provides an evaluation of the possible explanations and clinical significance of the lesions, and sometimes includes recommendations for further diagnosis or treatment. Therefore, we chose to retain these two modules and remove text in the report that is not related to the description of lung lesions.
[0037] Step S2, the diagnosis report contains key descriptions of the patient's symptoms, lesion characteristics, etc. in the image. The correspondence between the medical image and the text diagnosis report can be used to mine the semantic association between the medical image and the diagnosis report. Therefore, multimodal comparative learning pre-training is performed on the pre-processed chest X-ray image and text report dataset. Step S2 includes the following sub-steps S2-1 to S2-2:
[0038] Step S2-1: In this process, the preprocessed chest X-ray images and text data are input into the image encoder and text encoder respectively. We select the ImageNet pre-trained ResNet50 network as the image encoder and PubMedBert as the text encoder to obtain image features and text features.
[0039] Step S2-2: The model uses contrastive learning to shorten the distance between positive sample pairs and increase the distance between negative sample pairs in the feature space, thus realizing the semantic association between medical images and reports. This stage improves the model's ability to extract and interpret the semantic relationship between images and texts through contrastive learning.
[0040] Step 3: Different regions, different races, and different ages may lead to differences in the representation of lung images, so the model needs to be fine-tuned for specific downstream tasks. In the fine-tuning stage, we use active learning to select samples for annotation. Step S3 includes the following sub-steps S3-1 to S3-3:
[0041] Step S3-1: First, this step involves inputting medical images into the lung lesion classification network and outputting the corresponding pseudo-labels. We use the pseudo-labels to calculate the gradient return size of each sample to evaluate the information value of each sample. The size of the gradient return refers to the adjustment amplitude of the network parameters during the learning process. It is measured by the degree of response of the network to a specific sample in the current learning state. The purpose of this step is to construct a feature set F by selecting samples with larger gradient norms. This selection method helps to ensure the uncertainty and information value of sample selection and retain the most challenging samples.
[0042] Step S3-2: In the formed feature set F, we use the KMeans++ clustering algorithm. In this step, we select samples with relatively long distances in the feature space from the feature set F through the KMeans++ clustering algorithm. The purpose of this process is to ensure the diversity of the selected samples, thereby avoiding overfitting of the algorithm to a certain type of sample during training, and improving the generalization ability of the model to unseen samples.
[0043] Step S3-3: Finally, based on the information-rich and diverse samples screened out through the above two steps, experts annotate the screened samples to form a high-quality labeled training set. This training set contains the samples that the network needs to learn most in the current learning stage, so it can effectively improve learning efficiency and model performance to further train the lung lesion classification network.
[0044] Figure 2 Schematic diagram of the fine-tuning process of the lung lesion classification network in an embodiment of the present invention
[0045] In the image mode, the chest X-ray image is input into the pre-trained image encoder to obtain the image features of the chest X-ray image. In the text mode, the preset text information of the lung lesions is input into the pre-trained text encoder to obtain the text features of the lung lesions.
[0046] Transformer's Decoder is an advanced neural network architecture specifically designed to handle complex sequence-to-sequence conversion tasks. It parses and fuses information from different modalities through self-attention mechanisms and encoder-decoder attention mechanisms. In the lung lesion classification network, the Decoder can effectively integrate and compare the features extracted by the image encoder and the text encoder through its unique structure, thereby more accurately classifying and identifying lung lesions. Its power lies in its ability to capture the deep semantic relationship between images and texts, improving the accuracy and reliability of diagnosis. The text features are used as queries, and the image features are used as keys and values. They are input into the Transformer's Decoder structure for attention calculation, and the output is a binary classification of whether the lesion exists.
[0047] Specifically, the Transformer decoder includes an input layer, a self-attention layer, a cross-attention layer, a feedforward neural network, and an output layer. The network uses a cross-attention mechanism to integrate and understand the relationship between text and images, thereby accurately classifying lesions. The calculation formula of the attention mechanism is:
[0048]
[0049] Among them, Q, K, and V are query, key, and value matrices respectively, and d k is the dimension of key. Among them, Q is the text feature, while K and V are image features. In this way, the model can find the lesion area corresponding to the text description in the image, helping to complete the classification task of lung lesions.
[0050] Example Function and Effect
[0051] According to the lung lesion classification method based on contrastive learning and active learning of the present invention, we can effectively utilize the multimodal data between medical images and text reports, and deeply explore the semantic association between the two modalities through contrastive learning. This method not only improves the model's ability to extract features from medical images and reports, but also greatly reduces the annotation cost and dependence in the application of unlabeled data, enhancing the practicality and wide applicability of the model.
[0052] In the fine-tuning stage of lung lesion classification, the present invention adopts an active learning strategy to accurately select the data samples that are most valuable for model improvement for manual annotation. This strategy not only optimizes the efficiency of the use of annotation resources, but also ensures the accuracy and practicality of the model for specific tasks. In this way, the model can better understand and adapt to the various characteristics and variations of lung images, improving the accuracy and reliability in actual clinical applications.
[0053] In addition, our lung lesion classification network uses a Transformer-based Decoder module. This architecture can not only output multi-label lung lesion classification results, but also show the model's attention distribution in chest X-ray images. This not only improves the accuracy of the classification results, but also increases the interpretability of the model results. Doctors can intuitively see the lesion areas that the model focuses on, which is of great significance for clinical decision-making and further medical research.
[0054] In general, the embodiments of the present invention not only demonstrate the advanced application of deep learning technology in the field of medical imaging diagnosis, but also reflect the actual value and potential of artificial intelligence in the field of medical health. Through intelligent data processing and precise model training methods, the present invention provides a more efficient, accurate and economical solution for the diagnosis of lung lesions.
Claims
1. A lung lesion classification method based on contrastive learning and active learning, characterized in that: The following steps are involved: Step S1, first preprocess the data. The preprocessing of chest X-ray images includes format conversion (DICOM to JPG) and image size cropping, and removing irrelevant information from the original text report. This step ensures that the input data received by the model is of consistent quality, which is helpful for the subsequent pre-training process; Step S2, in the pre-training stage, using the semantic correspondence between medical images and their corresponding text reports, multimodal comparative learning is performed on a public chest X-ray image-text report dataset to obtain a medical multimodal basic model, which has a certain feature extraction capability for medical multimodal data; Step S3, for the chest X-ray image dataset of the private dataset, input the unlabeled data into the lung lesion classification model, actively select some samples for lung lesion labeling through the active learning algorithm, form a labeled training set, use the labeled data for supervised training, and complete further fine-tuning of the lung lesion classification model.
2. The lung lesion classification method based on contrastive learning and active learning according to claim 1, characterized in that: The classification result of the lung lesions is obtained by the following steps: Step T1, in image mode, inputting the chest X-ray image into a pre-trained image encoder to obtain image features of the chest X-ray image; Step T2, in text mode, inputting the preset text information of lung lesions into the pre-trained text encoder to obtain text features of lung lesions; In step T3, the text features are used as query and the image features are used as key and value, which are input into the Decoder structure of Transformer for attention calculation. The output is the binary classification result of whether the lesion exists.
3. The lung lesion classification method based on contrastive learning and active learning according to claim 1, characterized in that: The step S2 includes the following sub-steps: Step S2-1, inputting the pre-processed chest X-ray image and text report into an image encoder and a text encoder respectively to obtain image features and text features; Step S2-2, in the feature space, shorten the distance between the positive sample pairs of the image and text, and lengthen the distance between the negative sample pairs of the image and text.
4. The lung lesion classification method based on contrastive learning and active learning according to claim 1, characterized in that: The step S3 includes the following sub-steps: Step S3-1, input the image into the lung lesion classification network, calculate the size of the gradient return according to the output pseudo-label, and form a feature set F by selecting samples with larger gradient norm to ensure the uncertainty of sample selection; Step S3-2, using the clustering algorithm KMeans++ in the feature set F, selects samples with relatively long distances in the feature space from the set F to ensure the diversity of sample selection; Step S3-3, using the selected information-rich samples to annotate to form a labeled training set, and training the lung lesion classification network.
Citation Information
Cited By
Comparative learning and DS evidence theory-based few-sample epidemic disease image diagnosis algorithm
CN119230096A
Multi-modal information fusion AI platform and application method
CN119293726A
Pathological section image analysis method and device based on large language model
CN119648625A
Image labeling method and device for medical image model training, electronic equipment and medium
CN119964739A
Multi-modal health medical data management method and system based on cloud platform
CN121075530A
