Masking pre-training method for ultrasound image segmentation
The ultrasound image segmentation model is pre-trained through the mask pre-training method, and the mask matrix and loss function are used to optimize the model, which solves the problems of low resolution and noise in ultrasound image segmentation technology, and improves the segmentation accuracy and accuracy of the model under small sample data. Feature extraction capabilities, suitable for medical applications with limited labeled data.
Patent Information
- Application Number
- CN202410663448.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-27
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-05-27
AI Technical Summary
Ultrasound image segmentation technology is limited by low resolution, high noise, and lack of high-quality annotated data, resulting in insufficient model performance, especially poor performance in fine structure recognition and boundary clarity, and deep learning models rely on large-scale labeled data sets. It is highly sensitive and difficult to work effectively when labeled data is limited.
The mask pre-training method is used to perform data pre-processing and model pre-training on ultrasound images. A mask matrix is generated by randomly masking some pixels of the input image. The mean square error and Tversky loss function are used to optimize the model and improve the model's performance under small sample data. Feature extraction capability and segmentation accuracy.
In the case of limited labeled data, the feature extraction capability and segmentation accuracy of the ultrasound image segmentation model are significantly improved. It can effectively process unlabeled images and help annotators determine precise regional boundaries. It is suitable for ultrasound image segmentation scenarios in smart medical care.
Smart Images

Figure CN118537348A
Abstract
Description
Technical Field
[0001] The present invention belongs to the interdisciplinary technical field of medical image segmentation and deep learning, and specifically provides a mask pre-training method for ultrasound image segmentation. Background Art
[0002] Among modern medical imaging technologies, ultrasound imaging is widely used worldwide due to its advantages such as no radiation, low cost, high portability and ability to provide real-time images. As a key diagnostic tool, ultrasound imaging is particularly suitable for maternal care, cardiovascular disease assessment, and soft tissue and internal organ examinations, providing doctors with valuable information that can help them detect diseases as quickly as possible and treat them. However, despite the many advantages of ultrasound imaging, its application is limited by image quality factors. Ultrasound images often have low resolution and high noise levels due to technical limitations, making it difficult to provide clear tissue boundary information and detailed structural information, and this problem is particularly prominent in situations where high-precision image analysis is required.
[0003] In order to overcome the above limitations and improve the application value of ultrasound imaging in clinical diagnosis, computer-assisted ultrasound image segmentation technology has become a research hotspot in recent years. Advanced algorithms are used to automatically divide images into clinically significant areas to assist doctors in making quick and accurate diagnoses. Among them, the U-Net model has achieved remarkable success in the field of automatic medical image segmentation due to its original structure and capabilities. The U-Net model uses its deep network structure to capture image features while retaining rich contextual information through specially designed jump connections, making it perform well in a variety of medical image segmentation tasks. However, in the face of the low spatial resolution and contrast, artifacts and noise characteristics of ultrasound images, the model performance is subject to certain limitations, especially in fine structure recognition and boundary clarity.
[0004] In addition, the development of ultrasound image segmentation technology faces an important bottleneck: the lack of high-quality, professionally annotated datasets, which is particularly prominent in specific medical applications, such as the diagnosis of rare diseases. High-quality ultrasound image annotation not only requires a lot of time and expertise, but is also restricted by medical data privacy policies, further exacerbating the difficulty of obtaining such data. Since deep learning models often rely on large amounts of training data to learn complex image features and patterns, data shortages further limit the performance of deep learning models; therefore, developing deep learning models that can work effectively with limited labeled data has become a key need in the field of ultrasound image segmentation, which can not only improve the generalization ability of the model, but also reduce the model's dependence on large-scale labeled datasets, providing important support for improving the quality of global medical services and sustainable development. Summary of the invention
[0005] The purpose of the present invention is to address the defects of the above-mentioned prior art and propose a masking pre-training method for ultrasound image segmentation, which is used to greatly enhance the feature extraction capability by utilizing limited labeled images when there are a large number of unrelated and unlabeled images, and to achieve accurate segmentation under small sample data sets. The method is particularly suitable for ultrasound image segmentation scenarios in smart medical care with limited labeled images and a large number of unlabeled images.
[0006] To achieve the above object, the technical solution adopted by the present invention is:
[0007] A mask pre-training method for ultrasound image segmentation comprises the following steps:
[0008] Step 1: Perform data preprocessing on the ultrasound image to construct a training set, where the training sample is represented by (x, y), x represents the sample image, and y represents the sample label;
[0009] Step 2: Use the training set obtained in step 1 to perform mask pre-training on the ultrasound image segmentation model, and save the model pre-training parameters;
[0010] Step 3, using the model pre-training parameters obtained in step 2 as model initialization parameters, and using the training set obtained in step 1 to perform segmentation task training on the ultrasound image segmentation model to obtain a trained ultrasound image segmentation model;
[0011] Step 4: After data preprocessing, the ultrasound image to be processed is input into the ultrasound image segmentation model trained in step 3, and the ultrasound image segmentation model outputs the ultrasound image segmentation result.
[0012] Furthermore, in step 1, the specific process of data preprocessing is:
[0013] Step 1.1, grayscale the ultrasound image to convert it into a single-channel grayscale image;
[0014] Step 1.2, scaling the ultrasound image processed in step 1.1 to unify the resolution of the ultrasound image to a preset size;
[0015] Step 1.3: Convert the storage format of the ultrasound image processed in step 1.2 to obtain a binary file and store it.
[0016] Furthermore, in step 2, the specific process of mask pre-training is:
[0017] Step 2.1, generate a mask matrix M for the sample image;
[0018] Step 2.2, generate a (1-M) matrix according to the mask matrix M, use the (1-M) matrix to perform a dot product operation with the sample image x to obtain the input image x1 of the ultrasound image segmentation model; use the mask matrix M to perform a dot product operation with the sample image x to obtain the mask pre-training label y1;
[0019] Step 2.3, perform a dot product operation on the output image Y of the ultrasound image segmentation model and the mask matrix M to obtain the output image Y1; calculate the mean square error (MSE) between the output image Y1 and the mask pre-training label y1 as the loss, and use the Adamax optimizer to train the model, where the parameters are set to the learning rate lr = 0.001, β1 = 0.9, β2 = 0.999 to complete the mask pre-training.
[0020] Furthermore, in step 2.1, the mask matrix M is generated as follows:
[0021] Step 2.1.1, perform zero padding expansion on the sample image x upward and to the left, and the expansion size is p pixels to obtain an expanded image;
[0022] Step 2.1.2: Randomly select a pixel point of the extended image as the starting point and generate a mask block with a side length of p.
[0023] Step 2.1.3: Construct a mask matrix of the same size as the sample image x based on the mask block. The mask matrix uses a 0-1 matrix, where the masked part is 1 and the non-masked part is 0.
[0024] Furthermore, in step 2.1.2, the probability q of each pixel being masked is:
[0025]
[0026] Among them, w and h represent the length and width of the image.
[0027] Furthermore, in step 2.1.2, the side length p of the generated mask block ranges from 10 pixels to 100 pixels, and the masking ratio is 0.2 or 0.6.
[0028] Furthermore, in step 3, the specific process of segmentation task training is as follows:
[0029] Step 3.1: Use the model pre-training parameters obtained in step 2 as the model initialization parameters for the segmentation task training process;
[0030] Step 3.2: Set the loss function to Tversky loss and use Adamax optimizer to complete the segmentation task training.
[0031] Furthermore, in step 3.2, the Tversky loss is expressed as:
[0032]
[0033] Among them, y is the sample label, Y is the output image of the ultrasound image segmentation model, <,> represents the matrix dot product operation, and β is the weight coefficient.
[0034] Based on the above technical solution, the beneficial effects of the present invention are:
[0035] The present invention provides a masking pre-training method for ultrasonic image segmentation. In the case of limited labeled images in the domain and a large number of related unlabeled images, an ultrasonic image segmentation model is pre-trained to predict unknown content by randomly masking part of the pixels in the input ultrasonic image, so as to adapt the model to the current fitting scenario before formal training, and the parameter weights in the masking pre-training are used as the initial state of the subsequent segmentation task; based on this, a large number of unlabeled images can greatly enhance the feature extraction capability, and in the case of very limited labeled data, greatly improve the segmentation accuracy; in particular, the trained ultrasonic image segmentation model can also be used to segment the remaining unlabeled images to help annotators determine the precise region boundaries. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 It is a flowchart of the mask pre-training method for ultrasound image segmentation in the present invention.
[0037] Figure 2 Result diagram of the segmentation performance of the ultrasound image segmentation model trained at various mask ratios in the embodiment of the present invention. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solution and beneficial effects of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments.
[0039] This embodiment provides a mask pre-training method for ultrasound image segmentation. Figure 1 As shown, the mask pre-training and small sample pre-training methods are introduced, which specifically include the following steps:
[0040] Step 1: Perform data preprocessing on all ultrasound images to obtain the training set and test set data required for the subsequent training and testing stages; where the training sample is represented by (x, y), x represents the sample image, and y represents the sample label;
[0041] The specific process is:
[0042] All ultrasound images are divided into training set and test set according to a specific ratio, and then they are preprocessed in the same way;
[0043] The following preprocessing operations are performed on all images in the training set and the test set:
[0044] Step 1.1, grayscale the original ultrasound image, and convert the ultrasound image from the original RGB three-channel color image to a single-channel grayscale image;
[0045] Step 1.2, scaling the ultrasound image processed in step 1.1 to unify the resolution of the ultrasound image into a 256×256 format;
[0046] Step 1.3, performing a storage format conversion operation on the ultrasound image processed in step 1.2, converting the ultrasound image file into a binary file in ".npz" format to speed up data reading;
[0047] Step 2: Use the training set obtained in step 1 to perform mask pre-training on the ultrasound image segmentation model and save the model pre-training parameters. The specific process of mask pre-training is as follows:
[0048] Step 2.1: Generate a mask matrix M for each sample image. The generation process is:
[0049] Step 2.1.1, expand the sample image x upward and to the left by zero padding, and the expansion size is p pixels to obtain an expanded image, so as to ensure that the probability of each pixel being masked is the same;
[0050] Step 2.1.2: Randomly select a pixel point of the extended image as the starting point, generate a mask block with a side length of p, and the probability q of each pixel being masked is:
[0051]
[0052] Among them, w and h represent the length and width of the image, and p represents the side length of the square mask block;
[0053] Step 2.1.3, construct a mask matrix with the same size as the sample image x according to the mask block, and the mask matrix adopts a 0-1 matrix, in which the masked part is 1 and the non-masked part is 0;
[0054] Step 2.2, generate a (1-M) matrix according to the mask matrix M, use the (1-M) matrix to perform a dot product operation with the sample image x to obtain an image with non-masked pixels as the input image x1 of the ultrasound image segmentation model; use the mask matrix M to perform a dot product operation with the sample image x to obtain an image with partially masked pixels as the mask pre-training label y1;
[0055] Step 2.3, perform a dot product operation on the output image Y of the ultrasound image segmentation model and the mask matrix M, so that the output image only contains the pixels of the masked part, and obtain the output image Y1; calculate the mean square error (MSE) between the output image Y1 and the mask pre-training label y1 as the loss, and use the Adamax optimizer to train the model, where the parameters are set to the learning rate lr = 0.001, β1 = 0.9, β2 = 0.999 to complete the mask pre-training;
[0056] Step 3: Use the model pre-training parameters obtained in step 2 as the model initialization parameters, use the training set and validation set obtained in step 1 to perform segmentation task training on the ultrasound image segmentation model, and save the final model parameters; the specific process of segmentation task training is as follows:
[0057] Step 3.1: Use the model pre-training parameters obtained in step 2 as the model initialization parameters for the segmentation task training process;
[0058] Step 3.2, set the loss function to Tversky loss, and use Adamax optimizer to complete the segmentation task training; Tversky loss is expressed as:
[0059]
[0060] Where y is the sample label, Y is the output image of the ultrasound image segmentation model, <,> represents the matrix dot product operation, and β is the weight coefficient;
[0061] Step 4: Use the test set obtained in step 1 to perform a performance test on the ultrasound image segmentation model trained in step 3. The performance test uses Dice as the evaluation indicator.
[0062] The beneficial effects of the present invention are described in detail below in conjunction with simulation tests. The simulation tests are performed on an Intel(R) Xeon(R) Silver 4210R CPU@2.40GHz central processing unit, an NVIDIA GeForce RTX 3090 24GB video memory graphics card, and an Ubuntu20.04.1LTS operating system, and TensorFlow is used as back-end computing support; the TN3k dataset is used, which was proposed by Gong et al. in the document "Gong H, Chen G, Wang R, et al. Multi-task learning for thyroid nodule segmentation with thyroid region prior[C] / / 2021IEEE 18thinternational symposium on biomedical imaging(ISBI).IEEE,2021:257-261." The dataset contains 3493 thyroid nodule ultrasound images and corresponding segmentation labels from 2421 patients.
[0063] In this embodiment, MS-UNet is selected as the basic model, and the sizes (pixels) of the mask blocks are set to 10×10, 20×20, 40×40, 80×80, 100×100, and mixed masking of 40×40 and 100×100. In addition, the masking ratio refers to the ratio of the masked area to the entire image, which is set to 0.2 and 0.6 in this embodiment. In each case, the image segmentation performance is shown in Table 1:
[0064] Table 1
[0065]
[0066] It can be seen from Table 1 that the optimal size of the mask block in this embodiment is 40×40. On this basis, the size of the mask block is fixed to 40×40, and the segmentation performance results under various mask ratios are as follows: Figure 2As shown, it can be seen that good segmentation performance can be obtained when the masking ratio varies between 0.2 and 0.6, but when the masking ratio is greater than 0.7, the performance drops sharply; different from the masked pre-training method and simMIM method proposed in the literature "Masked autoencoders are scalable vision learners, in Proceedings of CVPR, 2022, pp. 16000–16009" and the literature "Simmim: A simple framework for masked image modeling, in Proceedings of CVPR, 2022, pp. 9653–9663", the latter proves that a high masking ratio (such as 0.75) will produce better performance in subsequent supervised tasks of natural image processing; it is precisely because of the inherent differences between natural images and ultrasound images, limited by the small amount of supervised training data and the single-channel and low-precision characteristics, it is difficult to infer the masked part from the known area, therefore, a relatively low masking rate is more suitable for masked pre-training of ultrasound images.
[0067] Furthermore, this embodiment uses U-Net, U-Net-R, U-Net-RS, and MS-UNet models as the basis, and the segmentation performance on a small sample set of ultrasound images of fetal chest space-occupying lesions is shown in Table 2, wherein the masked pre-training method of the present invention is marked with "(P)", corresponding to the labeled data size of 10, 20, and 50 images; it can be seen that the masked pre-training proposed in the present invention greatly improves the segmentation accuracy of the ultrasound image, and when only 10 ultrasound images are used for training, the achieved segmentation accuracy is close to the segmentation accuracy achieved with five times the number of images; it can be seen that the masked pre-training proposed in the present invention can improve the accuracy of the segmentation model on a small number of annotated samples, thereby being used to segment the remaining unlabeled images to help the annotator determine the accurate ROI boundary.
[0068] Table 2
[0069]
[0070] In addition, this embodiment performs segmentation on congenital diaphragmatic hernia ultrasound images. The small sample set of congenital diaphragmatic hernia ultrasound images includes 94 ultrasound images of congenital diaphragmatic hernia belonging to 17 patients. The training and testing ratios are 2:8, 4:6 and 6:4, and all images belonging to the same case are used for training or testing. The results are shown in Table 3. It can be seen that the masked pre-training proposed in the present invention improves the segmentation accuracy of all models on congenital diaphragmatic hernia images, further verifying that the masked pre-training method proposed in the present invention is very suitable for the segmentation of small sample ultrasound images of rare diseases.
[0071] Table 3
[0072]
[0073] The above description is only a specific implementation mode of the present invention. Any feature disclosed in this specification, unless otherwise stated, can be replaced by other alternative features that are equivalent or have similar purposes; all the disclosed features, or all the steps in the methods or processes, except for mutually exclusive features and / or steps, can be combined in any way.
Claims
1. A mask pre-training method for ultrasound image segmentation, It is characterized in that The following steps are involved: Step 1: Perform data preprocessing on the ultrasound image to construct a training set, where the training sample is represented by (x, y), x represents the sample image, and y represents the sample label; Step 2: Use the training set obtained in step 1 to perform mask pre-training on the ultrasound image segmentation model, and save the model pre-training parameters; Step 3, using the model pre-training parameters obtained in step 2 as model initialization parameters, and using the training set obtained in step 1 to perform segmentation task training on the ultrasound image segmentation model to obtain a trained ultrasound image segmentation model; Step 4: After data preprocessing, the ultrasound image to be processed is input into the ultrasound image segmentation model trained in step 3, and the ultrasound image segmentation model outputs the ultrasound image segmentation result.
2. The mask pre-training method for ultrasound image segmentation according to claim 1, It is characterized in that In step 1, the specific process of data preprocessing is: Step 1.1, grayscale the ultrasound image to convert it into a single-channel grayscale image; Step 1.2, scaling the ultrasound image processed in step 1.1 to unify the resolution of the ultrasound image to a preset size; Step 1.3: Convert the storage format of the ultrasound image processed in step 1.2 to obtain a binary file and store it.
3. The mask pre-training method for ultrasound image segmentation according to claim 1, It is characterized in that In step 2, the specific process of mask pre-training is: Step 2.1, generate a mask matrix M for the sample image; Step 2.2: Generate a (1-M) matrix based on the mask matrix M, and perform a dot product operation between the (1-M) matrix and the sample image x to obtain the input image x of the ultrasound image segmentation model. 1 ; Use the mask matrix M to do a dot product operation with the sample image x to obtain the mask pre-trained label y 1 ; Step 2.3: Perform a dot product operation on the output image Y of the ultrasound image segmentation model and the mask matrix M to obtain the output image Y 1 ; Calculate the output image Y 1 and masked pre-trained labels y 1 The mean square error (MSE) is used as the loss, and the Adamax optimizer is used to train the model. The parameters are set to the learning rate lr = 0.001, β1 = 0.9, and β2 = 0.999 to complete the mask pre-training.
4. The mask pre-training method for ultrasound image segmentation according to claim 3, It is characterized in that In step 2.1, the mask matrix M is generated as follows: Step 2.1.1, perform zero padding expansion on the sample image x upward and to the left, and the expansion size is p pixels to obtain an expanded image; Step 2.1.2: Randomly select a pixel point of the extended image as the starting point and generate a mask block with a side length of p. Step 2.1.3: Construct a mask matrix of the same size as the sample image x based on the mask block. The mask matrix uses a 0-1 matrix, where the masked part is 1 and the non-masked part is 0.
5. The mask pre-training method for ultrasound image segmentation according to claim 4, It is characterized in that In step 2.1.2, the probability q of each pixel being masked is: Among them, w and h represent the length and width of the image.
6. The mask pre-training method for ultrasound image segmentation according to claim 4, It is characterized in that In step 2.1.2, the side length p of the generated mask block ranges from 10 pixels to 100 pixels, and the masking ratio is 0.2 or 0.
6.
7. The mask pre-training method for ultrasound image segmentation according to claim 1, It is characterized in that In step 3, the specific process of segmentation task training is: Step 3.1: Use the model pre-training parameters obtained in step 2 as the model initialization parameters for the segmentation task training process; Step 3.2: Set the loss function to Tversky loss and use Adamax optimizer to complete the segmentation task training.
8. The mask pre-training method for ultrasound image segmentation according to claim 7, It is characterized in that In step 3.2, the Tversky loss is expressed as: Among them, y is the sample label, Y is the output image of the ultrasound image segmentation model, <,> represents the matrix dot product operation, and β is the weight coefficient.
Citation Information
Patent Citations
Metalearning-based thyroid ultrasound nodule fuzzy boundary-oriented segmentation method
CN114511552A
Ultrasonic image sample generation method and equipment
CN114998168A
CARDIAC MAGNETIC RESONANCE IMAGE REGISTRATION METHOD BASED ON MASK AUTOCODER CNN-TRANForMER
CN116012344A
Point cloud instance segmentation method based on comparative language image pre-training technology
CN116152267A
Multi-task hybrid supervised medical image segmentation method and system based on federated learning
JP7386370B1
Cited By
Multi-modal image segmentation model training method and multi-modal image segmentation method
CN118982674A
Medical ultrasound image data set construction method and system and storage medium
CN120766056A
