Medical image segmentation method, device and equipment and readable storage medium
By employing a two-stage segmentation method and a boundary learning module, the problem of poor segmentation of lesion regions in ultrasound images was solved, achieving high-precision lesion segmentation while reducing costs and manpower consumption.
Patent Information
- Application Number
- CN202310075406.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-07
- Publication Date
- 2026-01-09
- Estimated Expiration
- 2043-02-07
AI Technical Summary
Existing ultrasound image segmentation methods are not effective in segmenting lesion areas and cannot meet clinical needs. Furthermore, methods to improve image clarity and annotation accuracy are costly and labor-intensive.
A two-stage segmentation method is adopted. First, coarse segmentation is performed based on the center point of the lesion. Then, fine segmentation is performed based on the cropped and enlarged image. The segmentation accuracy of the lesion boundary is improved by combining a boundary learning module. The trained model is used for image preprocessing and loss function optimization.
It significantly improves the segmentation effect of lesion areas, meets the requirements of clinical use, and at the same time reduces the requirements for image quality and annotation accuracy, thus reducing segmentation costs.
Smart Images

Figure CN116091522B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of medical image processing, and in particular to a medical image segmentation method, device, equipment and readable storage medium. BACKGROUND
[0002] In medical diagnosis, for many internal diseases, such as diseases of organs such as liver and lung, visual auxiliary detection technology is usually used to help doctors determine the lesion position. The most commonly used of these auxiliary detection technologies include ultrasonic detection (US), computed tomography (CT) and magnetic resonance imaging (MRI), etc. These detection technologies can non-destructively obtain the lesion condition in the patient's body, and therefore have been widely used.
[0003] Among the above detection technologies, ultrasonic detection has the lowest cost and the fastest speed, and therefore is most widely used. However, ultrasonic detection is limited by its detection principle, and the obtained ultrasonic image has low clarity, many noise points and low contrast. When using existing segmentation methods to determine the lesion position, the accuracy of the segmentation result will be relatively low, and it cannot meet the requirements of clinical use. In the case of using existing segmentation models, there are mainly two methods to improve the segmentation accuracy: improving the image clarity and the accuracy of image annotation. The former cannot be further improved due to the limitation of the principle of ultrasonic detection, and the latter requires professional doctors to manually process, which consumes a lot of manpower and material resources. SUMMARY
[0004] The main purpose of the present application is to provide a medical image segmentation method, device, equipment and readable storage medium, which aims to solve the technical problem of poor lesion region segmentation effect of the existing image segmentation method for ultrasonic images.
[0005] In a first aspect, the present application provides a medical image segmentation method, which comprises the following steps:
[0006] Pretreating a to-be-tested medical image to obtain a first-stage test image;
[0007] Coarsely segmenting the first-stage test image based on a first preset model trained to obtain a coarse segmentation result;
[0008] Cutting and enlarging the first-stage test image based on a first lesion center point in the coarse segmentation result to obtain a second-stage test image, and recording the vertex coordinate information when cutting and the size information of the first-stage test image;
[0009] Fine segmenting the second-stage test image based on a second preset model trained to obtain a fine segmentation result;
[0010] Based on the vertex coordinate information at the time of clipping and the size information of the first-stage test image, the segmentation result is restored to the same size as the medical image to be tested, and a target segmentation result is obtained.
[0011] Optionally, the preprocessing includes removing text and background in the medical image to be tested, intercepting the contrast region in the medical image to be tested, and normalizing the medical image to be tested.
[0012] Optionally, before the step of preprocessing the medical image to be tested to obtain the first-stage test image, the method further comprises:
[0013] Obtain a sample image set, the sample image set includes a preset frame training image and a preset training label corresponding to the training image, the training image is a preprocessed medical image, and the preset training label includes lesion information of a lesion region in the medical image;
[0014] Adjust the training image to a first preset size to obtain a first-stage training image of the first preset size;
[0015] Determine a second lesion center point of the preset training label based on the lesion information, determine a preset radius region with the second lesion center point as the center, take the preset radius region as a new lesion region in the preset training label, and obtain a new preset training label;
[0016] Adjust the new preset training label to the first preset size to obtain a first-stage training label of the first preset size;
[0017] Input the first-stage training image into a first preset model to be trained to obtain a sample coarse segmentation result;
[0018] Calculate a first loss function value corresponding to the first-stage training label and the sample coarse segmentation result based on a first loss function, and determine whether the first loss function value converges, wherein the first loss function is a binary cross entropy loss function, a set similarity measure loss function, or a combination of the binary cross entropy loss function and the set similarity measure loss function;
[0019] If the first loss function value does not converge, the first loss function value is back propagated to the first preset model to be trained, and the first preset model to be trained is retrained;
[0020] If the first loss function value converges, the latest first preset model is taken as a training completed first preset model.
[0021] Optionally, before the step of preprocessing the medical image to be tested to obtain the first-stage test image, the method further comprises:
[0022] The training image and the preset training label are cropped and enlarged based on the second lesion center point to obtain a second-stage training image and a second-stage training label of a second preset size;
[0023] The second-stage training image is input into the second preset model to be trained to obtain a sample fine segmentation result;
[0024] A second loss function value corresponding to the second-stage training label and the sample fine segmentation result is calculated based on a second loss function, and it is determined whether the second loss function value converges, wherein the second loss function is a combination of the first loss function and a boundary loss function;
[0025] If the second loss function value does not converge, the second loss function value is back propagated to the second preset model to be trained, and the second preset model to be trained is retrained;
[0026] If the second loss function value converges, the latest second preset model is taken as a training completed second preset model.
[0027] Optionally, a boundary learning module is added to each of the last three convolution modules in the decoding module of the second preset model to be trained, and the boundary learning module includes a boundary map calculation layer and a convolution layer.
[0028] In a second aspect, the present application further provides a medical image segmentation device, which comprises:
[0029] A preprocessing module is configured to preprocess a medical image to be tested to obtain a first-stage test image;
[0030] A coarse segmentation module is configured to perform coarse segmentation on the first-stage test image based on the first preset model to obtain a coarse segmentation result;
[0031] A size changing module is configured to crop and enlarge the first-stage test image based on a first lesion center point in the coarse segmentation result to obtain a second-stage test image, and record vertex coordinate information during the cropping and size information of the first-stage test image;
[0032] A fine segmentation module is configured to perform fine segmentation on the second-stage test image based on the second preset model to obtain a fine segmentation result;
[0033] A size restoring module is configured to restore the fine segmentation result to the same size as the medical image to be tested based on the vertex coordinate information during the cropping and the size information of the first-stage test image to obtain a target segmentation result.
[0034] Optionally, the preprocessing includes removing text and background in the medical image to be tested, intercepting a contrast region in the medical image to be tested, and normalizing the medical image to be tested.
[0035] Optionally, the medical image segmentation device further comprises a first training module, configured to:
[0036] obtain a sample image set, the sample image set comprising a preset frame training image and a preset training label corresponding to the training image, the training image being a preprocessed medical image, and the preset training label comprising lesion information of a lesion region in the medical image;
[0037] adjust the training image to a first preset size to obtain a first-stage training image of the first preset size;
[0038] determine a second lesion center point of the preset training label based on the lesion information, determine a preset radius region with the second lesion center point as the center, and take the preset radius region as a new lesion region in the preset training label to obtain a new preset training label;
[0039] adjust the new preset training label to the first preset size to obtain a first-stage training label of the first preset size;
[0040] input the first-stage training image into a first preset model to be trained to obtain a sample coarse segmentation result;
[0041] calculate a first loss function value corresponding to the first-stage training label and the sample coarse segmentation result based on a first loss function, and determine whether the first loss function value converges, wherein the first loss function is a binary cross-entropy loss function, a set similarity measure loss function, or a combination of the binary cross-entropy loss function and the set similarity measure loss function;
[0042] If the first loss function value does not converge, the first loss function value is back-propagated to the first preset model to be trained, and the first preset model to be trained is retrained;
[0043] If the first loss function value converges, the latest first preset model is taken as a first preset model trained.
[0044] Optionally, the medical image segmentation device further comprises a second training module, configured to:
[0045] perform cropping and magnifying processing on the training image and the preset training label based on the second lesion center point to obtain a second-stage training image and a second-stage training label of a second preset size;
[0046] input the second-stage training image into a second preset model to be trained to obtain a sample fine segmentation result;
[0047] calculate a second loss function value corresponding to the second-stage training label and the sample fine segmentation result based on a second loss function, and determine whether the second loss function value converges, wherein the second loss function is a combination of the first loss function and a boundary loss function.
[0048] If not converged, the second loss function value is back-propagated to the second preset model to be trained, and the second preset model to be trained is retrained.
[0049] If converged, the latest second preset model is taken as the trained second preset model.
[0050] Optionally, a boundary learning module is added in the last three convolution modules in the decoding module of the second preset model to be trained, and the boundary learning module comprises a boundary map calculation layer and a convolution layer.
[0051] In a third aspect, the present application further provides a medical image segmentation device, which comprises a processor, a memory, and a medical image segmentation program stored in the memory and executable by the processor, wherein the medical image segmentation program, when executed by the processor, implements the steps of the medical image segmentation method as described above.
[0052] In a fourth aspect, the present application further provides a readable storage medium, which stores a medical image segmentation program, wherein the medical image segmentation program, when executed by a processor, implements the steps of the medical image segmentation method as described above.
[0053] The application provides a medical image segmentation method, device, equipment and readable storage medium, the medical image segmentation method comprises: preprocessing a to-be-tested medical image to obtain a first-stage test image; performing coarse segmentation on the first-stage test image based on a first preset model trained to obtain a coarse segmentation result; performing cropping and magnification processing on the first-stage test image based on a first lesion center point in the coarse segmentation result to obtain a second-stage test image, and recording vertex coordinate information at the time of cropping and size information of the first-stage test image; performing fine segmentation on the second-stage test image based on a second preset model trained to obtain a fine segmentation result; and restoring the fine segmentation result to the same size as the to-be-tested medical image based on the vertex coordinate information at the time of cropping and the size information of the first-stage test image to obtain a target segmentation result. The application significantly improves the segmentation effect of a lesion region in a medical image, has low requirements on the quality of the medical image, does not need to improve the accuracy of image labeling, and meets the requirements of clinical use on the premise of not improving the cost of medical image segmentation. In the coarse segmentation stage, the inflation result of the lesion center point is used as a label for training in this stage, which can realize relatively accurate positioning of the approximate range of the lesion, obtain the most basic interest region and perform cropping for training in the fine segmentation stage, and can remove many false positive error prediction lesion results; in the fine segmentation stage, a boundary learning module is additionally added in the last three convolution modules in the decoder of the preset segmentation model in this stage, the module is composed of a boundary map calculation layer and a convolution layer, distance map calculation and integration of boundary information of an upper layer feature and addition of boundary supervision can improve the segmentation accuracy of the model for the lesion boundary, and then improve the segmentation effect of the lesion. BRIEF DESCRIPTION OF DRAWINGS
[0054] Figure 1 A flowchart of an embodiment of the medical image segmentation method of the application;
[0055] Figure 2 A flowchart of the first preset model training stage of an embodiment of the medical image segmentation method of the application;
[0056] Figure 3 A flowchart of the second preset model training stage of an embodiment of the medical image segmentation method of the application
[0057] Figure 4 A functional module schematic diagram of an embodiment of the medical image segmentation device of the application;
[0058] Figure 5 A hardware structure schematic diagram of the medical image segmentation device involved in the embodiment scheme of the application.
[0059] The implementation, functional features and advantages of the application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0060] It should be understood that the specific embodiments described herein are merely exemplary and do not limit the application.
[0061] In a first aspect, an embodiment of the present application provides a medical image segmentation method.
[0062] Reference Figure 1 , Figure 1 FIG. 1 is a flowchart of an embodiment of the medical image segmentation method of the present application.
[0063] In an embodiment of the medical image segmentation method of the present application, the medical image segmentation method comprises:
[0064] In step S10, the to-be-tested medical image is preprocessed to obtain a first-stage test image.
[0065] In this embodiment, the to-be-tested medical image includes CT images, ultrasound images, etc. When the above medical images are generated by detection, in addition to the contrast region corresponding to the organ part, background noise and the like that affect the noise of the entire medical image segmentation process are also carried, and the original medical image generated by detection is not convenient for subsequent image segmentation processing. Therefore, before the to-be-tested medical image is segmented, the to-be-tested medical image needs to be preprocessed to obtain a first-stage test image, so as to facilitate subsequent segmentation processing and determine the lesion region in the to-be-tested image.
[0066] In step S20, the first-stage test image is coarsely segmented based on the trained first preset model to obtain a coarse segmentation result.
[0067] In this embodiment, after obtaining the first-stage test image, the first-stage test image is input as an input image into the first-stage image segmentation model (i.e., the trained first preset model) for coarse segmentation processing to obtain a coarse segmentation result. The coarse segmentation result is a mask containing lesion region information measured based on the first preset model. The trained first preset model is sensitive to the positioning location of the lesion region, but is not sensitive to the specific size and shape of the lesion region. Therefore, the lesion region positioning information of the obtained coarse segmentation result is highly accurate, but the specific size and shape of the lesion region are not highly accurate, and further second-stage image segmentation processing is needed to improve the accuracy of all related lesion information of the segmented lesion region, so as to improve the segmentation effect of the lesion region in the to-be-tested medical image.
[0068] Step S30, based on the first lesion center point in the rough segmentation result, the first stage test image is cropped and enlarged to obtain the second stage test image, and the vertex coordinate information and the size information of the first stage test image during cropping are recorded;
[0069] In this embodiment, after obtaining the rough segmentation result, the lesion center point in the test medical image is first determined based on the rough segmentation result, and then the first stage test image is cropped and enlarged to obtain the second stage test image, and the lesion center point is determined as the reference center point. The second stage test image is obtained based on the second stage test image. The image segmentation processing of the second stage is carried out. Since the second stage test image is the image after cropping and enlargement, and the image segmentation result determined thereafter also needs to be consistent with the size of the test medical image, the vertex coordinate information during cropping and the size information of the first stage test image are recorded, so as to facilitate the recovery of the corresponding size in the subsequent process.
[0070] Step S40, based on the second preset model trained, the second stage test image is finely segmented to obtain the fine segmentation result;
[0071] In this embodiment, after obtaining the second stage test image, the second stage test image is finely segmented based on the second preset model trained to obtain the fine segmentation result. Since the test image is accurately positioned based on the first stage rough segmentation result before the image segmentation processing of the second stage, the second stage test image is processed by the lesion center positioning. At this time, the second stage test image is finely segmented based on the second preset model trained, so as to obtain the fine segmentation result containing accurate lesion positioning, size and shape information.
[0072] Step S50, based on the vertex coordinate information during cropping and the size information of the first stage test image, the fine segmentation result is recovered to the same size as the test medical image to obtain the target segmentation result.
[0073] In this embodiment, since the fine segmentation result is obtained by the second preset model trained based on the second stage test image, the size of the fine segmentation result corresponds to the size information of the second stage test image, and the second stage test image is obtained by cropping and enlarging based on the rough segmentation result, which is not consistent with the size of the initial test medical image. The size of the rough segmentation result is consistent with the size of the first stage test image, and the size of the first stage test image is consistent with the size of the test medical image. Therefore, based on the recorded vertex coordinate information during cropping and the size information of the first stage test image, the fine segmentation result can be recovered to the same size as the test medical image to obtain the final target segmentation result.
[0074] Further, in an embodiment, the preprocessing includes removing text and background in the medical image to be tested, extracting a contrast region in the medical image to be tested, and normalizing the medical image to be tested.
[0075] In this embodiment, when the medical image to be tested is preprocessed, the text and background in the medical image to be tested are removed first to avoid the noise influence of the text and background in the medical image on the subsequent segmentation of the lesion region. At the same time, the contrast region of the medical organ where the lesion may exist is segmented out, and the medical image to be tested is normalized so that each pixel point value on the image is between (0, 1), which facilitates the subsequent image segmentation processing of the lesion region.
[0076] Further, in an embodiment, before the step of preprocessing the medical image to be tested to obtain the first-stage test image, the method further includes:
[0077] obtaining a sample image set, the sample image set including a preset frame training image and a preset training label corresponding to the training image, the training image being a preprocessed medical image, and the preset training label including lesion information of a lesion region in the medical image;
[0078] adjusting the training image to a first preset size to obtain a first-stage training image of the first preset size;
[0079] determining a second lesion center point of the preset training label based on the lesion information, determining a preset radius region with the second lesion center point as the center, taking the preset radius region as a new lesion region in the preset training label, and obtaining a new preset training label;
[0080] adjusting the new preset training label to the first preset size to obtain a first-stage training label of the first preset size;
[0081] inputting the first-stage training image into a first preset model to be trained to obtain a sample coarse segmentation result;
[0082] calculating a first loss function value corresponding to the first-stage training label and the sample coarse segmentation result based on a first loss function, and determining whether the first loss function value converges, wherein the first loss function is a binary cross-entropy loss function, a set similarity measure loss function, or a combination of the binary cross-entropy loss function and the set similarity measure loss function;
[0083] If the first loss function value does not converge, the first loss function value is back-propagated to the first preset model to be trained, and the first preset model to be trained is retrained;
[0084] If the convergence is achieved, the latest first preset model is taken as the trained first preset model.
[0085] In this embodiment, before determining the lesion region of the to-be-tested medical image through image segmentation processing, the neural network model corresponding to the image segmentation processing needs to be trained to ensure the segmentation effect and accuracy of the model on the lesion region of the to-be-tested medical image. When training the image segmentation model, the corresponding sample image set is first obtained. The sample image set involved in the training includes training images and preset training labels corresponding to the training images. The training images are preprocessed medical images, and the preset training labels are obtained through manual annotation of the medical images. The preset training labels correspond to the masks containing the lesion information of the lesion region in the medical images. Referring to Figure 2 Because the sizes of the training images in the sample image set are different, in order to facilitate the training, the sizes need to be adjusted to a uniform size such as 256*256 to obtain first-stage training images of a corresponding uniform first preset size.
[0086] Meanwhile, the present scheme uses a cascaded unet to perform coarse and fine segmentation on the sample medical image in two stages. The focus of the lesion information of the lesion region in the sample medical image is different between the coarse segmentation processing in the first stage and the fine segmentation processing in the second stage. During the training of the coarse segmentation processing in the first stage, the focus is mainly on the learning of the positioning information of the lesion region in the medical image, and the learning of the focus on the size and shape of the lesion region is not required. Therefore, at this time, only the lesion center point is determined through the preset training label, and then the preset radius region (such as a region with a radius of 30 pixel points) is determined through the inflation processing based on the lesion center point as the center. The above preset radius region is used to replace the lesion region in the preset training label to obtain a new preset training label, so that the model focuses on learning the positioning information of the lesion region in the image. In addition, because the training images are uniform in size, the corresponding new preset training labels also need to be uniform in size to obtain first-stage training labels of the first preset size.
[0087] The obtained first-stage training images are input into the first preset model to be trained for image segmentation processing, and a sample coarse segmentation result is obtained. The sample coarse segmentation result corresponds to the mask of the lesion information obtained by inputting the medical image into the first preset model. By comparing the first-stage training label and the sample coarse segmentation result, it can be determined whether the learning and training of the first preset model are completed. Specifically, the training process of the first preset model is supervised through a first loss function. The first loss function can be a binary cross-entropy loss function, a set similarity measure loss function, or a combination of the binary cross-entropy loss function and the set similarity measure loss function.
[0088] The first loss function value corresponding to the first stage training label and the sample coarse segmentation result can be calculated based on the first loss function. The first preset model after training has a first loss function value that converges in training. Whether the training is completed can be determined by judging whether the first loss function value converges. If it is determined that the first loss function value does not converge, the first loss function value is back propagated to the first preset model to be trained for parameter adjustment, and the first preset model to be trained is retrained. If it is determined that the first loss function value converges, the latest first preset model is taken as the first preset model after training.
[0089] Further, in an embodiment, before the step of preprocessing the medical image to be tested to obtain the first stage test image, the method further comprises:
[0090] The training image and the preset training label are cropped and enlarged based on the second lesion center point to obtain a second stage training image and a second stage training label of a second preset size;
[0091] The second stage training image is input into the second preset model to be trained to obtain a sample fine segmentation result;
[0092] The second loss function value corresponding to the second stage training label and the sample fine segmentation result is calculated based on the second loss function, and whether the second loss function value converges is judged, wherein the second loss function is a combination of the first loss function and the boundary loss function;
[0093] If it does not converge, the second loss function value is back propagated to the second preset model to be trained, and the second preset model to be trained is retrained;
[0094] If it converges, the latest second preset model is taken as the second preset model after training.
[0095] In this embodiment, during the training of the coarse segmentation processing in the first stage, the key learning of the lesion region positioning information in the medical image has been completed. During the training of the fine segmentation processing in the second stage, the key learning of the size and shape information of the lesion region is mainly based on the accurate positioning information of the lesion region in the first stage. Therefore, with reference to Figure 3 At this time, only the lesion center point determined based on the preset training label is used to crop and enlarge the training image and the preset training label to obtain the second stage training image and the second stage training label of a second preset size, such as 800*800. Through the above cropping and enlargement based on the lesion center point, the image segmentation model in the second stage, i.e., the second preset model, can focus on the region of interest in the medical image to remove other false positive (misidentification of non-lesion region) error prediction segmentation results of the lesion region.
[0096] The obtained second-stage training image is input into the second preset model to be trained for image segmentation processing, and a sample sub-segmentation result is obtained. The sample sub-segmentation result corresponds to a mask of the lesion information obtained by inputting the medical image into the second preset model. By comparing the second-stage training label and the sample sub-segmentation result, it can be determined whether the learning and training of the second preset model is completed. Specifically, the training process of the second preset model is supervised by a second loss function. Considering that the second preset model focuses more on the learning of boundary information such as the size and shape of the lesion area, the second loss function combines a boundary loss function on the basis of the first loss function.
[0097] Based on the second loss function, a second loss function value corresponding to the second-stage training label and the sample sub-segmentation result can be calculated. The second preset model that has completed training has a second loss function value that converges in training. By judging whether the second loss function value converges, it can be determined whether the training is completed. If it is determined that the second loss function value does not converge, the second loss function value is back-propagated to the second preset model to be trained for parameter adjustment, and the second preset model to be trained is retrained. If it is determined that the second loss function value converges, the latest second preset model is taken as the second preset model that has completed training.
[0098] Further, in an embodiment, a boundary learning module is added to each of the last three convolution modules in the decoding module of the second preset model to be trained, and the boundary learning module includes a boundary map calculation layer and a convolution layer.
[0099] In the fine segmentation stage, the method additionally adds a boundary learning module in the last three convolution modules in the decoder of the nnUNet model in this stage. The boundary learning module is composed of a boundary map calculation layer and a convolution layer. By distance map calculation and adding boundary supervision on the boundary information of the upper layer feature, the segmentation accuracy of the lesion boundary can be improved, and the segmentation effect of the lesion can be improved. Specifically, after adding the boundary learning module to the last three convolution modules in the decoding module of the second preset model, the original feature map x output by the last three convolution modules in the decoding module of the second preset model is classified into two categories to obtain a new feature map, wherein the two classifications can make x = sigmoid(x), x[x>0.5] = 1, and x[x<0.5] = 0; the new feature map is input into the boundary learning module for processing to obtain a boundary information map bd = x-maxpooling(x) corresponding to the feature map, wherein for the boundary information map, the value at the boundary is 1, and the value of other backgrounds is 0; bd = 1-bd, at this time the boundary is 0 and the other background is 1; bd = distance(bd), distance is a distance function in the opencv library, which can calculate the distance between each non-zero pixel point and the nearest 0 pixel point, so the value of the pixel point closer to the boundary is smaller; bd = max(bd)-bd+e, which is equal to taking the inverse of the above relationship, at this time the value of the pixel point closer to the boundary is larger, and e is a constant; bd = conv(bd), a 2D convolution (such as 3*3 convolution) is used to learn the boundary information calculated above; finally x = bd*x, bd is spliced to the original feature map x, the feature of the pixel point closer to the boundary is larger, the learning weight of the lesion boundary is improved, and the segmentation accuracy of the lesion boundary is improved.
[0100] In the embodiment, a medical image segmentation method is provided, including: preprocessing a to-be-tested medical image to obtain a first-stage test image; performing coarse segmentation on the first-stage test image based on a first preset model trained to obtain a coarse segmentation result; performing cropping and magnification processing on the first-stage test image based on a first lesion center point in the coarse segmentation result to obtain a second-stage test image, and recording vertex coordinate information when cropping and size information of the first-stage test image; performing fine segmentation on the second-stage test image based on a second preset model trained to obtain a fine segmentation result; and restoring the fine segmentation result to the same size as the to-be-tested medical image based on the vertex coordinate information when cropping and the size information of the first-stage test image to obtain a target segmentation result. The medical image segmentation method provided by the embodiment significantly improves the segmentation effect of a lesion region in a medical image, has low requirements on the quality of the medical image, does not need to improve the accuracy of image labeling, and meets the requirements of clinical use on the premise of not increasing the cost of medical image segmentation. In the coarse segmentation stage, the expansion result of the lesion center point is used as a label for training in this stage, which can realize relatively accurate positioning of the approximate range of the lesion, obtain the most basic interest region, and perform cropping for training in the fine segmentation stage, so that many false positive error prediction lesion results can be removed. In the fine segmentation stage, a boundary learning module is additionally added in the last three convolution modules in the decoder of the nnUNet model in this stage, the module is composed of a boundary map calculation layer and a convolution layer, and the segmentation accuracy of the lesion boundary of the model can be improved by performing distance map calculation and integration on the boundary information of the upper layer features and adding boundary supervision, and then the segmentation effect of the lesion can be improved.
[0101] In a second aspect, the embodiment of the present application further provides a medical image segmentation device.
[0102] Reference Figure 4 , a functional module schematic diagram of an embodiment of the medical image segmentation device.
[0103] In the embodiment, the medical image segmentation device includes:
[0104] The preprocessing module 10 is configured to preprocess the to-be-tested medical image to obtain the first-stage test image.
[0105] The coarse segmentation module 20 is configured to perform coarse segmentation on the first-stage test image based on the first preset model trained to obtain the coarse segmentation result.
[0106] The size changing module 30 is configured to perform cropping and magnification processing on the first-stage test image based on the first lesion center point in the coarse segmentation result to obtain the second-stage test image, and record the vertex coordinate information when cropping and the size information of the first-stage test image.
[0107] The fine segmentation module 40 is configured to perform fine segmentation on the second-stage test image based on the second preset model trained to obtain a fine segmentation result.
[0108] The size recovery module 50 is configured to recover the fine segmentation result to the same size as the medical image to be tested based on the vertex coordinate information during the cropping and the size information of the first-stage test image to obtain a target segmentation result.
[0109] Further, in an embodiment, the preprocessing includes removing text and background in the medical image to be tested, intercepting the contrast region in the medical image to be tested, and performing normalization processing on the medical image to be tested.
[0110] Further, in an embodiment, the medical image segmentation device further includes a first training module configured to:
[0111] obtain a sample image set, the sample image set including preset frame training images and preset training labels corresponding to the training images, the training images being medical images after preprocessing, and the preset training labels including lesion information of a lesion region in the medical image;
[0112] adjust the training images to a first preset size to obtain first-stage training images of the first preset size;
[0113] determine a second lesion center point of the preset training label based on the lesion information, determine a preset radius region with the second lesion center point as the center, take the preset radius region as a new lesion region in the preset training label, and obtain a new preset training label;
[0114] adjust the new preset training label to the first preset size to obtain the first-stage training label of the first preset size;
[0115] input the first-stage training image into the first preset model to be trained to obtain a sample coarse segmentation result;
[0116] calculate a first loss function value corresponding to the first-stage training label and the sample coarse segmentation result based on a first loss function, and determine whether the first loss function value converges, wherein the first loss function is a binary cross-entropy loss function, a set similarity measure loss function, or a combination of the binary cross-entropy loss function and the set similarity measure loss function;
[0117] If the first loss function value does not converge, the first loss function value is back-propagated to the first preset model to be trained, and the first preset model to be trained is retrained;
[0118] If the first loss function value converges, the latest first preset model is taken as the trained first preset model.
[0119] Further, in an embodiment, the medical image segmentation apparatus further comprises a second training module configured to:
[0120] perform cropping and magnifying processing on the training image and the preset training label based on the second lesion center point to obtain a second stage training image and a second stage training label of a second preset size;
[0121] input the second stage training image into the second preset model to be trained to obtain a sample fine segmentation result;
[0122] calculate a second loss function value corresponding to the second stage training label and the sample fine segmentation result based on a second loss function, and determine whether the second loss function value converges, wherein the second loss function is a combination of the first loss function and a boundary loss function;
[0123] if the second loss function value does not converge, the second loss function value is back propagated to the second preset model to be trained, and the second preset model to be trained is retrained;
[0124] if the second loss function value converges, the latest second preset model is taken as the trained second preset model.
[0125] Further, in an embodiment, a boundary learning module is added to each of the last three convolution modules in the decoding module of the second preset model to be trained, and the boundary learning module comprises a boundary map calculation layer and a convolution layer.
[0126] The functions of each module in the medical image segmentation apparatus correspond to the steps in the medical image segmentation method, and the functions and implementation processes will not be repeated here.
[0127] In a third aspect, an embodiment of the present application provides a medical image segmentation device, which can be a personal computer (PC), a notebook computer, a server, or other devices with data processing functions.
[0128] Reference Figure 5 , Figure 5Fig. 1 is a schematic diagram of a hardware structure of a medical image segmentation device according to an embodiment of the present application. The medical image segmentation device according to an embodiment of the present application can include a processor 1001 (for example, a central processing unit, CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is configured to enable communication between the components. The user interface 1003 can include a display and an input unit such as a keyboard. The network interface 1004 can include a standard wired interface, a wireless interface (for example, a WI-FI interface), or the like. The memory 1005 can be a random access memory (RAM) or a non-volatile memory such as a disk memory. The memory 1005 can be a storage device independent of the processor 1001. Those skilled in the art can understand that the hardware structure shown in Fig. 1 does not limit the present application, and can include more or fewer components, or some components can be combined, or different components can be arranged. Figure 5 The hardware structure shown in Fig. 1 does not limit the present application, and can include more or fewer components, or some components can be combined, or different components can be arranged.
[0129] With reference to Fig. 1, Figure 5 Figure 5 The memory 1005 can be a computer storage medium, and can include an operating system, a network communication module, a user interface module, and a medical image segmentation program. The processor 1001 can invoke the medical image segmentation program stored in the memory 1005, and execute the medical image segmentation method according to an embodiment of the present application.
[0130] In a fourth aspect, an embodiment of the present application provides a readable storage medium.
[0131] The readable storage medium according to an embodiment of the present application stores a medical image segmentation program. When the medical image segmentation program is executed by a processor, the steps of the medical image segmentation method according to the above embodiment are implemented.
[0132] The method implemented by the medical image segmentation program can refer to the medical image segmentation method according to each embodiment of the present application, and will not be described herein.
[0133] It should be noted that, in this document, the terms "comprises", "comprising", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or system. An element proceeded by "comprises a" does not, without more constraints, exclude the presence of additional identical elements in the process, method, article, or system that comprises the element.
[0134] The above-mentioned embodiment numbers of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0135] From the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be realized by means of software and necessary general hardware platforms, and of course can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk) as described above, and includes a number of instructions for causing a terminal device to execute the methods described in the various embodiments of the present application.
[0136] The above is only the preferred embodiment of the present application, and does not limit the patent scope of the present application, and any equivalent structure or equivalent flow transformation made by using the content of the specification and drawings of the present application, or directly or indirectly applied to other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A medical image segmentation method characterized by, The medical image segmentation method comprises: performing preprocessing on the to-be-tested medical image to obtain a first-stage test image; performing coarse segmentation on the first-stage test image based on a first preset model trained to obtain a coarse segmentation result; performing cropping and magnification processing on the first-stage test image based on a first lesion center point in the coarse segmentation result to obtain a second-stage test image, and recording vertex coordinate information at the time of cropping and size information of the first-stage test image; performing fine segmentation on the second-stage test image based on a second preset model trained to obtain a fine segmentation result; restoring the fine segmentation result to the same size as the to-be-tested medical image based on the vertex coordinate information at the time of cropping and the size information of the first-stage test image to obtain a target segmentation result; Before the step of performing preprocessing on the to-be-tested medical image to obtain a first-stage test image, the method further comprises: obtaining a sample image set, wherein the sample image set comprises preset frame training images and preset training labels corresponding to the training images, the training images are medical images after preprocessing, and the preset training labels comprise lesion information of lesion regions in the medical images; adjusting the training images to a first preset size to obtain first-stage training images of the first preset size; determining a second lesion center point of the preset training label based on the lesion information, determining a preset radius region with the second lesion center point as the center, taking the preset radius region as a new lesion region in the preset training label to obtain a new preset training label; adjusting the new preset training label to the first preset size to obtain first-stage training labels of the first preset size; inputting the first-stage training images into a first preset model to be trained to obtain sample coarse segmentation results; calculating a first loss function value corresponding to the first-stage training labels and the sample coarse segmentation results based on a first loss function, and determining whether the first loss function value converges, wherein the first loss function is a binary cross-entropy loss function, a set similarity measure loss function, or a combination of the binary cross-entropy loss function and the set similarity measure loss function; if the first loss function value does not converge, the first loss function value is back-propagated to the first preset model to be trained, and the first preset model to be trained is retrained; if the first loss function value converges, the latest first preset model is taken as the first preset model trained.
2. The medical image segmentation method of claim 1, wherein: The preprocessing comprises removing text and background in the to-be-tested medical image, intercepting a contrast region in the to-be-tested medical image, and performing normalization processing on the to-be-tested medical image.
3. The medical image segmentation method of claim 1, wherein, Before the step of performing preprocessing on the to-be-tested medical image to obtain a first-stage test image, the method further comprises: performing cropping and magnification processing on the training images and the preset training labels based on the second lesion center point to obtain second-stage training images of a second preset size and second-stage training labels; inputting the second-stage training images into a second preset model to be trained to obtain sample fine segmentation results; calculating a second loss function value corresponding to the second-stage training labels and the sample fine segmentation results based on a second loss function, and determining whether the second loss function value converges, wherein the second loss function is a combination of the first loss function and a boundary loss function; If the second loss function value does not converge, the second loss function value is back-propagated to the second preset model to be trained, and the second preset model to be trained is retrained. If the second loss function value converges, the latest second preset model is taken as the trained second preset model.
4. The medical image segmentation method of claim 3, wherein: The last three convolution modules in the decoding module of the second preset model to be trained are each added with a boundary learning module, and the boundary learning module includes a boundary map calculation layer and a convolution layer.
5. A medical image segmentation apparatus characterized by comprising: The medical image segmentation device includes: a preprocessing module configured to preprocess a medical image to be tested to obtain a first-stage test image; a coarse segmentation module configured to perform coarse segmentation on the first-stage test image based on the trained first preset model to obtain a coarse segmentation result; a size changing module configured to perform cropping and magnification processing on the first-stage test image based on a first lesion center point in the coarse segmentation result to obtain a second-stage test image, and record vertex coordinate information during the cropping and size information of the first-stage test image; a fine segmentation module configured to perform fine segmentation on the second-stage test image based on the trained second preset model to obtain a fine segmentation result; a size restoring module configured to restore the fine segmentation result to the same size as the medical image to be tested based on the vertex coordinate information during the cropping and the size information of the first-stage test image to obtain a target segmentation result; The medical image segmentation device further includes a first training module configured to: obtain a sample image set, the sample image set including preset frame training images and preset training labels corresponding to the training images, the training images being preprocessed medical images, and the preset training labels including lesion information of lesion regions in the medical images; adjust the training images to a first preset size to obtain first-stage training images of the first preset size; determine a second lesion center point of the preset training label based on the lesion information, determine a preset radius region with the second lesion center point as the center, take the preset radius region as a new lesion region in the preset training label, and obtain a new preset training label; adjust the new preset training label to the first preset size to obtain first-stage training labels of the first preset size; input the first-stage training images to the first preset model to be trained to obtain sample coarse segmentation results; calculate a first loss function value corresponding to the first-stage training labels and the sample coarse segmentation results based on a first loss function, and determine whether the first loss function value converges, wherein the first loss function is a binary cross entropy loss function, a set similarity measure loss function, or a combination of the binary cross entropy loss function and the set similarity measure loss function; if the first loss function value does not converge, the first loss function value is back-propagated to the first preset model to be trained, and the first preset model to be trained is retrained; if the first loss function value converges, the latest first preset model is taken as the trained first preset model.
6. The medical image segmentation apparatus of claim 5, wherein: The preprocessing includes removing text and background in the medical image to be tested, intercepting a contrast region in the medical image to be tested, and performing normalization processing on the medical image to be tested.
7. A medical image segmentation apparatus characterized by comprising: The medical image segmentation device includes a processor, a memory, and a medical image segmentation program stored on the memory and executable by the processor, wherein the medical image segmentation program, when executed by the processor, implements the steps of the medical image segmentation method according to any one of claims 1 to 4.
8. A readable storage medium, characterized by, The readable storage medium has stored thereon a medical image segmentation program, wherein the medical image segmentation program, when executed by a processor, implements the steps of the medical image segmentation method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Domain adaptive semantic segmentation method based on similarity space alignment
CN110322446A
Image segmentation method, device, equipment and storage medium
US20220207742A1