Prompt learning pulmonary nodule segmentation method based on anchor points
By introducing the SAM module and Prompt Encoder into the YoSAM model, combined with prompt learning and mask encoder, the problem of misdiagnosis and missed diagnosis in pulmonary nodule segmentation is solved, the segmentation accuracy and speed are improved, and the sensitivity to small target features is enhanced. and noise robustness, reducing false negative and false positive results.
Patent Information
- Application Number
- CN202410880886.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2024-10-01
AI Technical Summary
The existing technology has problems of misjudgment and missed diagnosis in pulmonary nodule segmentation, especially the lack of robustness to small target features, resulting in segmentation results that are susceptible to noise interference, over-segmentation or under-segmentation problems, and the computer-aided detection system The misdiagnosis rate is high.
A YoSAM model based on anchor convolutional neural network is designed, by adding SAM module and Prompt Encoder, introducing hint learning and mask encoder, improving the Head module to improve feature segmentation accuracy, and through semi-automatic supervision method and data enhancement technology , improve the detection and segmentation capabilities of the network.
It effectively improves the accuracy and speed of pulmonary nodule segmentation, reduces false detections and missed detections, improves the model's sensitivity to small target features and robustness to noise, and reduces the occurrence of false negative and false positive results.
Smart Images

Figure BDA0004924464560000031 
Figure FT_1 
Figure FT_2
Abstract
Description
Technical Field
[0001] The present invention relates to the field of medical imaging and deep learning, and specifically to a segmentation method for lung and lung tumor dataset format conversion and lung tumor dataset format conversion and a prompt-learning encoder network. Background Art
[0002] Lung cancer is a malignant disease with a high incidence and mortality rate. The incidence and mortality rates of lung cancer are increasing rapidly in countries around the world. Lung nodules are the main symptom of early lung cancer. If we can diagnose early lung nodules in time and track and treat suspected patients, we can effectively reduce the incidence of lung cancer. Current lung imaging technologies mainly include X-ray imaging, CT (computed tomography) and MRI (magnetic resonance imaging). Due to its high resolution and the ability to detect locations that X-rays cannot, CT has been used in the screening of many diseases. Although magnetic resonance imaging can better distinguish each area of the lungs than CT images, when there is a large amount of gas in the lungs, the observation effect of magnetic resonance imaging is far inferior to CT. In addition, magnetic resonance imaging technology has high equipment costs and has not been promoted. Therefore, CT is the mainstream lung imaging technology.
[0003] CT scanning is one of the most reliable, stable and accurate medical detection methods for lung cancer detection. The incidence and mortality rates of lung cancer are rising rapidly in countries around the world. The global cancer data released by the World Health Organization's International Agency for Research on Cancer (IARC) in 2021 showed that there were 2.2 million new cases of lung cancer worldwide, second only to 2.26 million cases of breast cancer. In 2021, the global number of cancer deaths was 9.96 million, of which 1.8 million deaths from lung cancer ranked first. Lung nodules are the main manifestation of early lung cancer. They appear as translucent or opaque spherical tissues on CT images. If nodules appear in the lungs, they can be diagnosed in time at an early stage and suspected patients can be followed up and treated. The incidence of lung cancer can be effectively reduced. The popularity of CT equipment has led to the need for doctors to observe a large number of images every day. Due to long-term viewing of CT scan results, doctors may misjudge and miss lesions. It is of great significance to use computer-aided detection (CAD) systems to help doctors diagnose test results.
[0004] According to statistics, the misdiagnosis rate of medical imaging can reach 10% to 30%. The resulting false negative results will cause patients to miss the best treatment opportunity, while false positive cases generally rely on clinical methods such as biopsy to exclude, which not only increases the cost of patients, but also adds to their pain and the risk of worsening of their condition. In this situation, computer-aided detection (CADe) and computer-aided diagnosis (CADx) have become the needs of the times. Summary of the invention
[0005] Aiming at the current problem of the accuracy of lung nodule segmentation, many models are not robust enough to small target features, which makes the lung nodule segmentation results often easily interfered by the noise factors in medical images, and the segmented lung nodules are prone to over-segmentation and under-segmentation. This invention designs strategies and solutions for the above problems, and proposes a fast conversion method for three-dimensional medical images and a Yolov5 model based on anchor convolutional neural network: YoSAM is used for lung nodule segmentation, and the improved Head module is used for feature segmentation. In order to improve the accuracy of the model, after generating 3 feature maps in the Head part, a SAM module is added. The SAM module is as follows Figure 3 As shown in the figure, the Prompt Encoder of the SAM module is redesigned, Anchors are replaced with the original boxes, Classification is replaced with the original text, Point input is reduced, and a semi-automatic supervision method is used. It has been verified that this module can effectively improve segmentation accuracy and speed. Improvements are made to the problems of missed detection and false detection caused by the insensitivity of the classic Yolo series model to small target features. By designing an image encoder, prompt learning and mask encoder are introduced. The segmentation speed of the network is accelerated, the network's detection and segmentation capabilities for lung nodules are improved, and the speed of segmentation and detection is improved.
[0006] The technical solution of the present invention: Anchor-based prompt learning encoder and detection segmentation visualization method, the flow chart is as follows Figure 1 The steps shown include:
[0007] S1. Process the public chest medical images to produce two-dimensional medical images containing lung nodules;
[0008] S2, preprocessing the prepared two-dimensional lung medical images;
[0009] S3, performing data enhancement on the preprocessed medical images;
[0010] S4, divide the data-enhanced dataset into a training set and a test set in a ratio of 7:3;
[0011] S5, build the YoSAM network model, and pass the processed two-dimensional medical image training set into the built network for training, obtain the optimal training weight, and save the optimal model;
[0012] S6. Load the divided test set data set into the optimal model for testing, obtain the segmentation results, and compare them with the annotated lung nodule locations in the public data set and the lung nodule gold standard.
[0013] Further generalization of S1 includes the following 1 steps:
[0014] Step 1: Based on the gold standard data of lung nodules, the largest publicly available three-dimensional lung medical imaging dataset, Luna16, is used to eliminate slices without lungs and lung nodules according to the proportion of lung nodules in the image. At the same time, in order to avoid format confusion in the labels of the gold standard slices after two-dimensional conversion, the scanned pixel values of the lung nodules are first normalized to pixel 1 for the lung nodule part and pixel 0 for the rest. The pixel values of the lungs in the labels are uniformly set to (127, 127, 127).
[0015] Further generalization of S2 includes the following 1 steps:
[0016] Step 1: Process the original image. First, use the K-means clustering algorithm and image binarization to separate the lung tissue from the foreign tissue according to the average value of the pixels in the lung tissue. Secondly, use morphological erosion and dilation operations to retain the detailed information of tissues such as blood vessels, and dilate the overall characteristic information of the lung through erosion and dilation. Finally, calculate the image connectivity domain, use the maximum connectivity domain as the lung mask, continue to perform dilation operations to fill the lung mask and optimize the lung parenchyma edge and erosion operations, create a new lung image, and remove worthless slices according to the two-dimensional label so that the name of the new lung image is consistent with the new two-dimensional label.
[0017] Further summarizing S3 includes the following 1 steps:
[0018] Step 1: Data enhancement of the original image, including mirror inversion, center rotation, horizontal flipping, and then adjusting saturation, contrast, and brightness. In order to expand the number of samples, reduce the impact of overfitting, and improve the accuracy of pixel segmentation in local edge areas, the present invention randomly crops the generated data set, and uniformly sets the cropping size to 640×640dpi.
[0019] Further generalization of S4 includes the following 1 steps:
[0020] Design a Python program to store the absolute address of each image and the absolute address of the label, and label them in sequence from 1 to 10, and store them in an .xlsx file. Then store the images and labels numbered 1-7 in the .xlsx file of the test set, and 8-10 in the .xlsx file of the training set. This can ensure the balance between training and testing, prevent overfitting, and improve the generalization ability of the network.
[0021] Further summarizing S5 includes the following 1 steps:
[0022] Step 1: In the training stage of the proposed YoSAM model, the test set in the pulmonary medical impact dataset is first preprocessed and data augmented, the images are cropped into the same size of 640×640×3, and then the processed pulmonary medical images are input into the YoSAM model for training. After training, the optimal weights of pulmonary nodule segmentation will be generated.
[0023] Further summarizing S6 includes the following 1 steps:
[0024] Step 1: Import the training set divided in step 4 into the model for testing and verification, and finally obtain the optimal lung nodule segmentation result.
[0025] Experimental parameters:
[0026] In the lung nodule segmentation experiment, the hardware environment is: NVIDIA GeForce RTX2080Ti Graphics card, video memory 11G; operating system: Windows11; Pytorch deep learning framework. Adam optimizer is used to update parameters. The initial learning rate (lr) is set to (1e-4)*3, the betas parameter is set to (0.9, 0.999), the batch size is set to 14, and the total number of training rounds (epochs) is set to 500. During the training process, the learning rate cosine annealing decay strategy is adopted. The learning rate at the tth epoch can be expressed as: BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 Make a flow chart for the dataset
[0028] Figure 2 Segmentation flow chart
[0029] Figure 3 SAM module diagram
[0030] Figure 4 Preprocessing results for the lung dataset
[0031] Figure 5 YoSAM network structure diagram DETAILED DESCRIPTION
[0032] The following is a clear and complete description of the technical solution for implementing the present invention in combination with the drawings in the embodiments of the present invention. What is described is a part but not all of the embodiments of the present invention. Based on the embodiments in the invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0033] The distribution and sorting flow chart of the present invention is as follows Figure 1 The entire process shown is divided into two stages: dataset preparation and segmentation.
[0034] 1. Dataset Preparation Phase
[0035] like Figure 1 , Figure 2 Shown
[0036] In the dataset preparation stage, the image data format is first converted, and the three-dimensional .nii format Luna16 lung medical dataset is converted into a two-dimensional image dataset containing lung nodules. Then the image preprocessing operation is performed, and then data enhancement is performed to expand the dataset to form a new dataset.
[0037] (1) Dataset conversion
[0038] According to the gold standard data of lung nodules, Luna16 was used to eliminate slices without lungs and lung nodules according to the proportion of lung nodules in the image. At the same time, in order to avoid format confusion in the labels of the gold standard slices after two-dimensional conversion, the scanned pixel values of the lung nodules were normalized to pixel 1 and the rest to pixel 0. The pixel values of the lungs in the labels were uniformly set to (127, 127, 127).
[0039] (2) Data preprocessing
[0040] Process the original image: 1. Set an initial value S. Usually, S is the average of the maximum and minimum gray values in the image. 2. Set the area with gray values greater than S as the foreground, and the area with gray values less than T as the background. Calculate the average gray value SF of the foreground and the average gray value SB of the background. 3. Update the threshold S, S = (SF + SB) / 2. 4. Repeat steps 2.3. until T no longer changes, and negate the result. However, there may still be some remaining noise elements. In order to remove interference, first, use the K-means clustering algorithm and image binarization according to the lung group. The average value of the pixels within the tissue separates the lung tissue from the foreign tissue. Secondly, the morphological erosion and dilation operations are used to retain the detailed information of tissues such as blood vessels, and the overall characteristic information of the lung is expanded through erosion and expansion. Finally, the image connected domain is calculated, and the maximum connected domain is used as the lung mask. The expansion operation is continued to fill the lung mask and optimize the edge of the lung parenchyma with the erosion operation to create a new lung image. The worthless slices are removed according to the two-dimensional label to make the new lung image name consistent with the new two-dimensional label. It can further increase the contrast of the image, reduce the interference of noise elements, and improve the generalization of the network and the segmentation ability of the model.
[0041] (3) Data enhancement
[0042] Use OpenCV to design a Python program to implement random flipping. Horizontal and vertical flipping help increase the diversity of training samples. Random rotation: randomly rotate the image in the range of -15 to 15 degrees. This small rotation does not change the basic structure of the medical image. Random scaling: randomly scaling the image in the range of 0.9 to 1.1 can simulate nodules of different sizes and improve the robustness of the model. Add Gaussian noise: add random Gaussian noise to the image to enhance the robustness of the model to noise. Random brightness, contrast, and saturation adjustment: adjust the brightness, contrast, and saturation of the image to enhance the visual effect of the image and help the model learn features better. Random shearing: randomly shear the image in the x and y directions to increase the diversity of samples. Through these data enhancement techniques, more training samples can be generated, the generalization ability and robustness of the model can be improved, and thus the performance in practical applications can be improved.
[0043] 2. Segmentation
[0044] Network construction:
[0045] YoSAM, which is an improvement on the Yolov5 network in the traditional Yolo series, is a semi-automatic neural network based on prompt learning. The network structure is shown in the figure Figure 5 As shown in the figure, the hint learning module is added to the Head structure and the feature extraction of anchor points is used to realize semi-automatic supervised learning. Its structure is as follows Figure 4 As shown in the figure, the three feature images of 80×80, 40×40, and 20×20 are used to extract the main features without losing the extraction of small target features, which enhances the network's ability to extract small target features. After the extraction, the corresponding images, masks, anchor points, and categories are placed in the image encoder, convolution kernel, and prompt learning decoder respectively. The image decoder and the convolution kernel are embedded to capture important information of the input image. The mask is downsampled to a lower resolution using a convolutional neural network, and the channel dimension is mapped to 256 through a 1x1 convolution, and then added element by element with the image embedding, as shown in the figure. Figure 3 shown.
[0046] The purpose of the image encoder is to convert the input image into a fixed-size feature embedding, which captures the visual information of the image. In SAM, the image encoder uses a pre-trained Vision Transformer (ViT), specifically the ViT-H / 16 model pre-trained by MAE (Masked Autoencoders). This model extracts image features through a series of Transformer layers. In SAM, a 14x14 window attention mechanism and several global attention blocks are used. The output of the image encoder is a downsampled feature map, usually 1 / 16 of the input image size. A 1x1 convolutional layer is used to reduce the number of channels of the feature map to 256, and then another 3x3 convolutional layer is used to maintain 256 channels. These operations are followed by layer normalization.
[0047] The prompt encoder is responsible for converting different types of prompts into feature representations that match the output of the image encoder. Position encoding is used to represent the position of the anchor point. The encoder uses two embeddings to represent the upper left and lower right corners of the box. The text encoder of the CLIP model is used to process free-form categorical text prompts and convert the category text into a vector representation. Mask: For dense mask prompts, the mask is first downsampled to a lower resolution than the input image, and then further reduced in dimension through a convolutional neural network. Finally, the number of channels is mapped to 256 through a 1x1 convolution. The output of the prompt encoder is added to the output of the image encoder at the element level to combine the image and prompt information. The output is a vector representation that contains all the prompt information and is combined with the feature embedding of the image encoder to provide input for the mask decoder.
[0055] Although the above describes the illustrative specific embodiments of the present invention to facilitate technical personnel in the technical field to understand the present invention, and it should be clear that the present invention is not limited to the scope of the specific embodiments, for ordinary technicians in this technical field, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations using the concept of the present invention are protected.
Claims
1. Anchor-based prompt learning method for pulmonary nodule segmentation, characterized in that: include: S11: Process the public chest medical images to produce two-dimensional medical images containing lung nodules; S12: preprocessing the prepared two-dimensional lung medical images; S13: Perform data enhancement on the preprocessed medical images; S14: The data augmented dataset is divided into a training set and a test set in a ratio of 7:3; S15: Build the YoSAM network model, and pass the processed two-dimensional medical image training set into the built network for training, obtain the optimal training weight, and save the optimal model; S16: Load the divided test set data set into the optimal model for testing, obtain the segmentation results, and compare them with the lung nodule locations marked in the public data set and the lung nodule gold standard.
2. The anchor-based prompt learning method for pulmonary nodule segmentation according to claim 1, characterized in that: The S1 includes: S21: processing according to the gold standard data of lung nodules, using the existing largest publicly available three-dimensional lung medical image dataset Luna16, and eliminating slices without lungs and lung nodules according to the proportion of lung nodules in the image, and at the same time normalizing the scanned pixel values of the lung nodule part, the lung nodule part is pixel 1, and the rest is pixel 0, and the pixel value of the lung in the label is uniformly set to (127, 127, 127).
3. The anchor-based prompt learning method for pulmonary nodule segmentation according to claim 1, characterized in that: The S2 includes: S31: The original image is processed. First, the lung tissue is separated from the foreign tissue according to the average value of the pixels in the lung tissue using the K-means clustering algorithm and image binarization; S32: Morphological erosion and dilation operations are used to preserve the detailed information of tissues such as blood vessels, through erosion and dilation of the overall characteristic information of the lung; S33: Calculate the image connected domain, use the largest connected domain as the lung mask, continue to perform expansion operations to fill the lung mask and optimize the lung parenchyma edge and erosion operations, create a new lung image, and remove worthless slices according to the two-dimensional label so that the new lung image name is consistent with the new two-dimensional label.
4. The anchor-based prompt learning method for pulmonary nodule segmentation according to claim 1, characterized in that: The S3 includes: S41: Perform data enhancement on the original image, including mirror reversal, center rotation, horizontal flipping, and random adjustment of saturation, contrast, and brightness; S42: In order to expand the number of samples, reduce the impact of overfitting, and improve the accuracy of pixel segmentation in local edge areas, the generated data sets are randomly cropped, and the cropping size is uniformly set to 640×640 dpi.
5. The anchor-based prompt learning method for pulmonary nodule segmentation according to claim 1, characterized in that: The S5 includes: S51: In the training phase of the proposed YoSAM model, the training set in the lung medical image dataset is preprocessed and data augmented; S52: The images are cropped into the same size of 640×640×3, and then the processed lung medical images are input into the YoSAM model for training. After training, the optimal weights for lung nodule segmentation are generated.
6. The anchor-based prompt learning method for pulmonary nodule segmentation according to claim 1, characterized in that: The S6 includes: S61: loading the divided test set data into the optimal model for testing and verification, and finally obtaining the optimal lung nodule segmentation result, and comparing and verifying it with the gold standard.
7. The anchor-based prompt learning method for pulmonary nodule segmentation according to claim 1, characterized in that: Improvements to the YoSAM network include: S71: Add a prompt learning module to the Head module of the traditional Yolov5 model, and realize semi-automatic supervised learning through anchor feature extraction; S72: After generating three feature maps in the Head part, add the SAM module and redesign the Prompt Encoder, replace the Anchors with the original boxes, replace the Classification with the original text, reduce the Point input, and use the semi-automatic supervision method to improve the segmentation accuracy and speed.
Citation Information
Patent Citations
Lung CAD system based on data enhancement and CA-YOLO-V4
CN114387231A
Machine vision-based atmospheric natural environment test industrial product identification and segmentation method
CN116824135A
Semi-supervised medical image segmentation method based on image text collaborative constraint
CN117952993A
Cited By
Automatic positioning method for eyeground middle plasma leakage point
CN119850594A
