Medical image quality control method based on Chinese big language model
Through a method based on the Chinese large language model, combined with 2D/3D convolution and LoRA fine-tuning, the problem of unified learning and lack of labels for 2D/3D medical images is solved, efficient image quality control is achieved, and model performance and accuracy are improved. Adapting domain migration in the medical field.
Patent Information
- Application Number
- CN202410705138.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-03
- Publication Date
- 2024-09-24
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing technology makes it difficult to uniformly learn 2D and 3D medical images of different image forms, and most images lack labels, which increases the difficulty of model learning. The application of large language models in medical image quality control is still in the exploratory stage.
Adopt a method based on the Chinese large language model, use 2D/3D convolution and masked autoencoder for self-supervised learning pre-training, combine with LoRA for efficient fine-tuning, and use text prompts and image encoding through visual language model and contrastive learning method Perform quality control.
It realizes 2D/3D medical image quality control in the absence of labels, improves the performance and accuracy of the model, reduces training costs, can effectively learn images of different image forms, and adapts to domain migration in the medical field.
Smart Images

Figure CN118692632A
Abstract
Description
Technical Field
[0001] The present invention relates to computer image processing technology, and in particular to a medical image quality control method based on a Chinese large language model. Background Art
[0002] Radiological imaging technologies, including X-rays, CT, MRI, and ultrasound, are indispensable tools in disease diagnosis, providing an intuitive view of the inside of the disease. With the advancement of science and technology, these technologies have been significantly improved and are increasingly valued in the medical field for their improvement of the diagnostic process. However, differences in equipment in different medical institutions lead to uneven quality of radiological images, which affects the consistency and accuracy of diagnosis. In addition, radiological images are similar in appearance and large in number, which requires radiologists to have a high level of interpretation accuracy and professional skills. Because the quality of the image directly affects the difficulty of disease diagnosis. The quality of the image directly determines the difficulty of disease diagnosis. Therefore, using deep learning as the main technical means, studying radiological image quality control methods can improve the efficiency and accuracy of diagnosis, which has very important clinical practical application value.
[0003] At present, various deep learning network-based methods have been successfully applied to the learning and quality control of radiological images. However, most methods focus on a single category of radiological images, and there is rarely a unified framework for processing various categories of radiological images. How to uniformly learn 2D and 3D images with different image forms is still a problem to be solved. At the same time, most radiological images are not processed and do not have corresponding labels, which undoubtedly increases the difficulty of model learning disease diagnosis.
[0004] As a widely used self-supervised learning method, the Masked Autoencoder (MAE) can effectively solve the problem of preliminary training on images without labels based on its encoder-decoder architecture. However, its original structure cannot solve the problem of unified learning of radiological images with different structures.
[0005] In recent years, large language models have been widely developed. Relying on a large number of parameters and pre-training data, they have shown high efficiency and generalization ability in a variety of natural language processing tasks. However, how to apply large language models to visual tasks and migrate them well to the field of medical diagnosis is still in the exploratory stage. Visual language models provide a new paradigm for applying large language models to visual tasks. Its main mechanism is to explore the correlation between images and texts, and to achieve better mutual understanding between them by measuring the similarity between images and texts. At the same time, fine-tuning the model using medical information as text prompts can effectively improve its generalization ability in the medical field.
[0006] In summary, the existing medical image quality control methods have the following problems:
[0007] (1) Most radiological images do not have corresponding labels, which increases the difficulty of model learning disease diagnosis. At the same time, how to uniformly learn medical images with different image formats (2D and 3D) remains a difficult problem to be solved.
[0008] (2) Although large language models have been widely developed, there are still challenges in applying them to medical image quality control. How to apply them to visual tasks and achieve good domain transfer is still in the exploratory stage. Summary of the invention
[0009] Purpose of the invention: The purpose of the present invention is to solve the deficiencies in the prior art and provide a medical image quality control method based on a Chinese large language model. The present invention uses 2D / 3D convolution to support 2D / 3D image quality control with very few parameters, and can complete the pre-training of the visual encoder in the absence of labels and text information (only containing pictures). Using LoRA, only a small number of parameters are required, which is efficient and has low requirements on equipment; the present invention can be used for quality control of 2D and 3D medical images (such as chest X-rays, magnetic resonance imaging, CT, etc.).
[0010] Technical solution: A medical image quality control method based on a Chinese large language model of the present invention comprises the following steps:
[0011] Step 1: Input medical image X. Medical image X is a two-dimensional image or a three-dimensional image, where C, H, and W represent the dimension, height, and width of medical image X, respectively. D is optional and only applies to 3D images. That is, if the input medical image is two-dimensional, then If the input medical image is three-dimensional, then
[0012] Step 2: Pre-train the visual encoder based on the masked autoencoder MAE of self-supervised learning;
[0013] Step 2.1, divide the input medical image X into N regular and non-overlapping blocks, perform masking on 50% of the blocks, and then only feed the unmasked blocks into the visual encoder;
[0014] Step 2.2: Use 2D / 3D convolution on the blocks obtained by segmenting the medical image X to obtain features of the same size, that is, average pooling is performed on the 3D convolution depth, and then the same downsampling ratio as 2D is performed on the height and width, and the position code is added and then input into the shared encoding module to output the image code;
[0015] Step 2.3, use the image code and the masked block to input the visual decoder, output the reconstructed image, use the mean square error MSE between the reconstructed image and the original image as the loss, calculate the distance between the reconstructed image and the original image through the loss, and complete the self-supervised training;
[0016] Step 3: Input the labeled medical image and its corresponding text description, use the pre-trained visual encoder to encode the medical image without masking, and use the text encoder to encode its corresponding text description, project the obtained visual encoding and text encoding to the same size, and then splice them;
[0017] Step 4: Use the efficient fine-tuning method LoRA to fine-tune the Chinese large language model and obtain a quality control report;
[0018] Add additional low-rank matrices to the specified parameters (weight matrices) in parallel on the large language model, and during the model training process, only train the parameters of the additional parallel low-rank matrices and freeze other parameters;
[0019] Given pre-trained weights Gradient update weights Decompose ΔW into low-rank ΔW = BA, r is a very small rank; d and k are the dimensions of the pre-trained weight matrix;
[0020] During the training process, W0 is fixed, A and B are trainable parameters, F is regarded as input, and the forward pass is expressed as:
[0021] F′=W0F+BAF
[0022] Among them, F′ represents the input of the next layer, A is initialized with random Gaussian, and B is initialized with zero;
[0023] Step 5: Based on the Unified Medical Language System (UMLS), a Chinese large language model is used to extract entities from the quality control report (for example, the Chinese large language model Baichuan3 is used to input the quality control report as content to determine which lesions the patient has), and the extracted entities and the true labels of the images are encoded respectively, the distance between the two is calculated, and the training is iteratively performed by optimizing the contrast loss.
[0024] Furthermore, the detailed method of step 3 is:
[0025] Encode the medical image X using the pre-trained visual encoder:
[0026]
[0027] Where N represents the number of blocks into which the input medical image is segmented, and d1 represents the dimension of the obtained visual encoding;
[0028] At the same time, the text description T is encoded using a text encoder based on the Chinese large language model:
[0029]
[0030] Among them, LanguageEncoder(·) represents the frozen Chinese large language model Baichuan3, and d2 represents the dimension of the obtained text encoding.
[0031] Furthermore, the specific content of step 5 is as follows:
[0032] Step 5.1, first extracting entities in the quality control report, wherein the entities refer to words related to visual features, physiological processes, or diagnostic disease classifications, such as "fibrosis";
[0033] Step 5.2: Encode the obtained entities and true labels respectively to obtain the entity encoding set ε x and the label encoding set ε y ;
[0034] and label encoding set N x and N y Represent the number of entities and tags respectively;
[0035] Step 5.3: Encode the i-th label Calculate each entity code and The distance between them is recorded as the closest entity encoding as the positive sample The rest are negative samples
[0036] Step 5.4: Use the contrast loss function for fine-tuning. The final training target is as follows:
[0037]
[0038] Where τ is the temperature coefficient.
[0039] Beneficial effects: Based on the mechanism of visual language model, the present invention introduces the Chinese large language model, uses the efficient fine-tuning method (LoRA) for fine-tuning, and uses the corresponding image description as a text prompt to further adapt to the medical field and complete good domain transfer. Finally, the contrastive learning method is used to help the model complete training. This greatly improves the performance and accuracy of the model.
[0040] Compared with the prior art, the present invention has the following advantages:
[0041] (1) The visual encoder of the present invention can effectively learn 2D and 3D medical radiological images in different image formats. Based on the self-supervised learning method, it can complete sufficient training without the need for labeled images.
[0042] (2) Based on the mechanism of visual language model, the present invention uses efficient fine-tuning method and text prompts to fine-tune the Chinese large language model, thereby achieving efficient learning with relatively low training cost.
[0043] (3) The present invention uses contrastive learning method to calculate the distance between quality control report entity and image label, further improving the performance of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is a schematic diagram of the overall process of the present invention;
[0045] Figure 2 Schematic diagram of the model framework in the embodiment;
[0046] Figure 3 A schematic diagram of a medical image input for an embodiment;
[0047] Figure 4 Schematic diagram of the blocks of the input visual encoder in the embodiment. DETAILED DESCRIPTION
[0048] The technical solution of the present invention is described in detail below, but the protection scope of the present invention is not limited to the embodiments.
[0049] like Figure 1 As shown, a medical image quality control method based on a Chinese large language model of the present invention comprises the following steps:
[0050] Step 1: Input medical image X. Medical image X is a two-dimensional image or a three-dimensional image, where C, H, and W represent the dimension, height, and width of medical image X, respectively. D is optional and only applies to 3D images. That is, if the input medical image is two-dimensional, then If the input medical image is three-dimensional, then
[0051] Step 2: Pre-train the visual encoder based on the masked autoencoder MAE of self-supervised learning;
[0052] Step 2.1, the input medical image X is divided into N regular and non-overlapping blocks, 50% of the blocks are masked, and then only the unmasked blocks are sent to the visual encoder; the present invention selects 50% of the blocks for masking, which can efficiently train large models, speed up the training speed (3 times or more) and improve the accuracy; and the use of MAE can complete the pre-training of the visual encoder in the absence of image labels;
[0053] Step 2.2, use 2D / 3D convolution respectively on the blocks obtained by segmenting the medical image X to obtain features of the same size, that is: average pooling is performed on the 3D convolution depth, and then the same downsampling ratio as 2D is performed on the height and width, and the position code is added and then input into the shared encoding module (such as the transformer encoder), and the image code is output, which contains the image information, that is, the result of the visual encoder encoding the block of the unmasked image; in addition, in this embodiment, if the input medical image X is a 2D image, 2D convolution is performed, and if it is a 3D image, 3D convolution is performed;
[0054] Step 2.3, use the image code and the masked block to input the visual decoder, output the reconstructed image, and use the mean square error MSE between the reconstructed image and the original image as the loss;
[0055] Step 3: Input the labeled medical image and its corresponding text description, use the pre-trained visual encoder to encode the medical image without performing a mask operation, and use the text encoder to encode its corresponding text description, project the obtained visual encoding and text encoding to the same size, and then splice them; the text description of this embodiment is first manually annotated with the image category of the medical image, that is, "chest X-ray, magnetic resonance or CT, etc." If the image category is CT, the text description is "This is a" + "CT";
[0056] Step 4: Use the efficient fine-tuning method LoRA to fine-tune the Chinese large language model and obtain a quality control report;
[0057] Add additional low-rank matrices to the specified parameters (weight matrices) in parallel on the large language model, and during the model training process, only train the parameters of the additional parallel low-rank matrices and freeze the other parameters. Given pre-trained weights Gradient update weights Decompose ΔW into low-rank ΔW = BA, r is a very small rank. During the training process, W0 is fixed, A and B are trainable parameters, F is regarded as input, and the forward pass is expressed as:
[0058] F′=W0F+BAF
[0059] Among them, F′ represents the input of the next layer, A is initialized with random Gaussian, and B is initialized with zero;
[0060] Step 5: Based on the Unified Medical Language System (UMLS), use the Chinese large language model to extract entities from the quality control report (for example, use the Chinese large language model Baichuan3, take the quality control report as content input, and determine what lesions the patient has). Extract entities from the quality control report, encode the extracted entities and the true labels of the images respectively, calculate the distance between the two, and iterate the training by optimizing the contrast loss.
[0061] In this embodiment, the detailed method of step 3 is:
[0062] Encode the medical image X using the pre-trained visual encoder:
[0063]
[0064] Where N represents the number of blocks into which the input medical image is segmented, and d1 represents the dimension of the obtained visual encoding;
[0065] At the same time, the text description T is encoded using a text encoder based on the Chinese large language model:
[0066]
[0067] Among them, LanguageEncoder(·) represents the frozen Chinese large language model Baichuan3, and d2 represents the dimension of the obtained text encoding.
[0068] The specific contents of step 5 in this embodiment are as follows:
[0069] Step 5.1, first extracting entities in the quality control report, wherein the entities refer to words related to visual features, physiological processes, or diagnostic disease classifications, such as "fibrosis";
[0070] Step 5.2: Encode the obtained entities and true labels respectively to obtain the entity encoding set ε x and the label encoding set ε y ;
[0071] and label encoding set N x and N y Represent the number of entities and tags respectively;
[0072] Step 5.3: Encode the i-th label Calculate each entity code and The distance between them is recorded as the closest entity encoding as the positive sample The rest are negative samples
[0073] Step 5.4: Use the contrast loss function for fine-tuning. The final training target is as follows:
[0074]
[0075] Where τ is the temperature coefficient.
[0076] Example
[0077] This embodiment Figure 3 The medical image quality control of the present invention is performed on unlabeled medical images (chest X-rays). First, the medical image is input into a pre-trained visual decoder for encoding. The corresponding text description of the medical image is encoded using a text encoder at the same time. The obtained visual encoding and text encoding are projected to the same size and spliced. Then, they are input into a Chinese large language model fine-tuned using the efficient fine-tuning method LoRA to obtain a quality control report.
Claims
1. A medical image quality control method based on a Chinese large language model, characterized in that: The following steps are involved: Step 1: Input medical image X. The medical image X is a two-dimensional image or a three-dimensional image, where C, H, and W represent the dimension, height, and width of the medical image X, respectively; Step 2: Pre-train the visual encoder based on the masked autoencoder MAE of self-supervised learning; Step 2.1, divide the input medical image X into N regular and non-overlapping blocks, perform masking on 50% of the blocks, and then only feed the unmasked blocks into the visual encoder; Step 2.2: Use 2D / 3D convolution on the blocks obtained by segmenting the medical image X to obtain features of the same size, that is, average pooling is performed on the 3D convolution depth, and then the same downsampling ratio as 2D is performed on the height and width, and the position code is added and then input into the shared coding module to output the image code; Step 2.3, use the image code and the masked block to input the visual decoder, output the reconstructed image, and use the mean square error MSE between the reconstructed image and the original image as the loss; Step 3: Input the labeled medical image and its corresponding text description, use the pre-trained visual encoder to encode the medical image without masking, and use the text encoder to encode its corresponding text description, project the obtained visual encoding and text encoding to the same size, and then splice them; Step 4: Use the efficient fine-tuning method LoRA to fine-tune the Chinese large language model and obtain a quality control report. The specific method is: add an additional low-rank matrix to the weight matrix in parallel on the Chinese large language model, and during the training of the Chinese large language model, only train the parameters of the additional parallel low-rank matrix and freeze other parameters; Given pre-trained weights Gradient update weights Decompose ΔW into a low-rank r is a very small rank, d and k are the dimensions of the pre-trained weight matrix; W0 is fixed during the training process, A and B are trainable parameters, F is regarded as input, and the forward pass is expressed as: F′=W0F+BAF Among them, F′ represents the input of the next layer, A is initialized with random Gaussian, and B is initialized with zero; Step 5: Based on the Unified Medical Language System (UMLS), the Chinese Large Language Model is used to extract entities from the quality control report, and the extracted entities and the true labels of the images are encoded respectively, the distance between the two is calculated, and the training is iteratively performed by optimizing the contrast loss.
2. The medical image quality control method based on the Chinese large language model according to claim 1 is characterized in that: The detailed method of step 3 is: Use the pre-trained visual encoder to encode the medical image X. The encoding formula is as follows: Where N represents the number of blocks into which the input medical image is segmented, and d1 represents the dimension of the obtained visual encoding; At the same time, a text encoder based on the Chinese large language model is used to encode the text T description. The encoding formula is as follows: Among them, LanguageEncoder(·) represents the frozen Chinese large language model Baichuan3, and d2 represents the dimension of the obtained text encoding.
3. The medical image quality control method based on the Chinese large language model according to claim 1 is characterized in that: The specific contents of step 5 are as follows: Step 5.1, first extracting entities in the quality control report, wherein the entities refer to words related to visual features, physiological processes or diagnostic disease classification; Step 5.2: Encode the obtained entities and true labels respectively to obtain the entity encoding set ε x and the label encoding set ε y ; and label encoding set N x and N y Represent the number of entities and tags respectively; Step 5.3: Encode the i-th label Calculate each entity code and The distance between them is recorded as the closest entity encoding as the positive sample The rest are negative samples Step 5.4: Use the contrast loss function for fine-tuning. The final training target is as follows: Where τ is the temperature coefficient.
Citation Information
Patent Citations
Chest X-ray quality evaluation method fusing medical field knowledge
CN116245828A
Stomach diagnosis report generation system based on self-supervised joint learning
CN116884561A
Gastroscopy report generation device and equipment and computer readable storage medium
CN116913455A
Cross-modal retrieval method and system based on self-supervised comparative learning concept alignment
CN117150068A
Speech signal processing using artificial intelligence
US20240028838A1
Cited By
Medical image classification method based on prior knowledge enhanced mask and alignment modeling
CN119399523A
A Medical Image Classification Method Based on Prior Knowledge-Enhanced Masking and Alignment Modeling
CN119399523B
Unstructured temporal bone image report semantic tag modeling and extracting method based on large model instruction fine tuning
CN120011564A
Unified anomaly detection method and system based on conditional adapter
CN120526232A
A unified anomaly detection method and system based on conditional adapter
CN120526232B
