Method, device, server and storage medium for marking shadows of lung regions in medical images
Through the pre-trained U-Net model and neural network model, the key feature points of the lungs are detected, and the medical images are divided and marked into lung areas, which solves the marking problem caused by uneven shadow distribution and improves the accuracy of shadow areas.
Patent Information
- Application Number
- CN201910989085.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-17
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2039-10-17
AI Technical Summary
Existing technology cannot accurately mark lung shadows, especially when shadows are unevenly distributed in medical images, making it difficult to accurately locate lung regional partitions.
Use the pre-trained U-Net model to divide the lung area, and combine it with the pre-trained neural network model to detect the key feature points of the lungs. Use these feature points to partition and mark the lung area, and use the preset key feature points to generate segmentation Base lines to mark shaded areas.
The accuracy of shadow area position marking is improved, and the lung area can be accurately segmented and the location of the shadow area determined in medical images with uneven shadow distribution.
Smart Images

Figure CN110930414B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer technology, and in particular, relates to a method, device, server and storage medium for marking shadows in lung areas of medical images. Background Art
[0002] At present, in the field of research based on the partition of the lung area, researchers mainly partition the lungs in medical images (X-ray images) taken by DR equipment based on experience, and conduct relevant research based on the density and size of shadows in each lung area after partitioning. However, the distribution of shadows in X-ray images is uneven, and the positions of some shadow areas are difficult to accurately locate, resulting in the inability to accurately mark the shadows in the lung area based on experience. Summary of the invention
[0003] In view of this, embodiments of the present invention provide a method, device, server, and storage medium for lung region segmentation of medical images to solve the problem that lung shadows cannot be accurately marked in the prior art.
[0004] A first aspect of an embodiment of the present invention provides a method for marking shadows in a lung region of a medical image, comprising:
[0005] Performing lung region segmentation on a medical image containing the lungs according to a pre-trained lung region segmentation model to obtain a lung region image, wherein the lung region segmentation model is a U-Net model trained according to a first preset number of first medical images, wherein the first medical images include medical images with uneven shadow distribution;
[0006] Detecting preset key feature points contained in the lung region image according to a pre-trained lung key feature point detection model, wherein the lung key feature point detection model is a neural network model trained according to a second preset number of lung region images pre-labeled with lung key feature points, and the first lung region image includes a shadow area;
[0007] The lung region image is partitioned based on preset key feature points contained in the lung region image, and shadows contained in the partitioned lung regions are marked.
[0008] Optionally, before performing lung region segmentation on a medical image containing the lungs according to the pre-trained lung region segmentation model to obtain the lung region, the process includes:
[0009] Acquire a first preset number of first medical images, and divide the first medical images into training samples of a first ratio and test samples of a second ratio, wherein the first medical images are medical images in which lung regions are pre-divided;
[0010] Inputting the first ratio of training samples into the U-Net model for training;
[0011] Inputting the test samples of the second ratio into the U-Net model to obtain a second medical image output by the U-Net model that divides the lung area;
[0012] If the overlap rate between the second medical image and the lung regions of each sample in the preset test sample set is greater than or equal to a preset overlap rate threshold, it is determined that the test of the U-Net model passes, and the U-Net model is a trained lung region segmentation model;
[0013] If the overlap rate between the second medical image and the lung area of each sample in the preset test sample set is less than or equal to a preset overlap rate threshold, it is determined that the test of the U-Net model fails, the number of samples in the training sample set is increased, and the first medical image in the training sample set is input into the U-Net model for training.
[0014] Optionally, after inputting the test samples of the second ratio into the U-Net model to obtain the second medical image with the lung area divided corresponding to each of the test samples output by the U-Net model, the method further comprises:
[0015] Obtain a target value of the loss function of the U-Net model, where the target value is the value of the loss function of the U-Net model when the U-Net model analyzes each of the test samples;
[0016] If the rate of change of the target value is less than a preset rate of change threshold, it is determined that the test of the U-Net model passes, and the U-Net model is a trained lung region division model;
[0017] If the rate of change of the target value is greater than or equal to a preset rate of change threshold, it is determined that the test of the U-Net model fails, the number of samples in the training sample set is increased, and the first medical image in the training sample set is input into the U-Net model for training.
[0018] Optionally, the loss function of the trained U-Net model is:
[0019]
[0020] in, The definition is as follows:
[0021]
[0022] in, is a preset mapping function related to the lung region to which the x-th pixel belongs. is the distance between the xth pixel and the lung area. is the second closest distance between the x-th pixel and the lung area, and are the two parameters of the model, Indicates the probability that the x-th pixel belongs to the lung area.
[0023] Optionally, the pre-trained neural network model includes a feature layer and a detection layer;
[0024] Before detecting the preset key feature points contained in the lung area according to the pre-trained lung key feature point detection model, the method includes:
[0025] Input a second preset number of training samples into the feature layer for training, and obtain a second lung region image output by the feature layer, wherein the training samples are first lung region images pre-labeled with key lung feature points, and the second lung region image is a picture labeled with key lung feature points by the feature layer;
[0026] The detection layer performs cluster analysis on the second lung region image to obtain a third lung region image containing the preset key feature points;
[0027] If the similarities between all the second lung region images and the third lung region images are less than a preset similarity threshold, the neural network model is the trained lung key feature point detection model;
[0028] If the similarity between the second lung area image and the third lung area image is greater than or equal to a preset similarity threshold, the number of training samples is increased, and the step of inputting the preset number of training samples into the feature layer for training is re-executed to obtain the second lung area image output by the feature layer.
[0029] Optionally, the preset key feature points include a first lung apex, a first diaphragm bottom, a second lung apex, and a second diaphragm bottom; partitioning the lung area based on the preset key feature points contained in the lung area, and marking shadows contained in the partitioned lung area, includes:
[0030] generating a first straight line based on the first pulmonary apex and the second pulmonary apex;
[0031] generating a second straight line based on the first diaphragm bottom and the second diaphragm bottom;
[0032] Determine a vertical line segment between the first straight line and the second straight line, and obtain three equal division points of the vertical line segment;
[0033] A horizontal line is generated based on each equally divided point, and the shadows contained in the partitioned lung area are marked using the first straight line, the second straight line, the vertical line segment and each of the horizontal lines as segmentation reference lines.
[0034] A second aspect of an embodiment of the present invention provides a lung region shadow marking device for a medical image, comprising:
[0035] A segmentation module, configured to perform lung region segmentation on a medical image containing the lungs according to a pre-trained lung region segmentation model to obtain a lung region image, wherein the lung region segmentation model is a U-Net model trained according to a first preset number of first medical images, wherein the first medical images include medical images with uneven shadow distribution;
[0036] a detection module, configured to detect preset key feature points contained in the lung region image according to a pre-trained lung key feature point detection model, wherein the lung key feature point detection model is a neural network model trained according to a second preset number of lung region images pre-labeled with lung key feature points, wherein the first lung region image includes a shadow region;
[0037] The marking module is used to partition the lung area image based on preset key feature points contained in the lung area image, and mark the shadows contained in the partitioned lung areas.
[0038] Optionally, the pre-trained lung region segmentation model is a trained U-Net model, further comprising:
[0039] an acquisition module, configured to acquire a first preset number of first medical images, and divide the first medical images into a training sample set and a test sample set of preset proportions, wherein the first medical images are medical images in which lung regions are pre-divided;
[0040] A training module, used for inputting the first medical image in the training sample set into a U-Net model for training;
[0041] An acquisition module, used for inputting the first medical image in the test sample set into the U-Net model to obtain a second medical image output by the U-Net model, where the second medical image is a medical image in which the U-Net model divides the lung area;
[0042] A first determination module is used to determine that the test of the U-Net model passes if the overlap rate between the second medical image and the lung area of each sample in the preset test sample set is greater than or equal to a preset overlap rate threshold, and the U-Net model is a trained lung area division model;
[0043] The second determination module is used to determine that the test of the U-Net model fails if the overlap rate between the second medical image and the lung area of each sample in the preset test sample set is less than or equal to a preset overlap rate threshold, increase the number of samples in the training sample set, and execute the input of the first medical image in the training sample set into the U-Net model for training.
[0044] Optionally, after inputting the test samples of the second ratio into the U-Net model to obtain the second medical image with the lung area divided corresponding to each of the test samples output by the U-Net model, the method further comprises:
[0045] Obtain a target value of the loss function of the U-Net model, where the target value is the value of the loss function of the U-Net model when the U-Net model analyzes each of the test samples;
[0046] If the rate of change of the target value is less than a preset rate of change threshold, it is determined that the test of the U-Net model passes, and the U-Net model is a trained lung region division model;
[0047] If the rate of change of the target value is greater than or equal to a preset rate of change threshold, it is determined that the test of the U-Net model fails, the number of samples in the training sample set is increased, and the first medical image in the training sample set is input into the U-Net model for training.
[0048] Optionally, the loss function of the trained U-Net model is:
[0049]
[0050] in, The definition is as follows:
[0051]
[0052] in, is a preset mapping function related to the lung region to which the x-th pixel belongs. is the distance between the xth pixel and the lung area. is the second closest distance between the x-th pixel and the lung area, and is the constant term of the model, Indicates the probability that the x-th pixel belongs to the lung area.
[0053] A third aspect of an embodiment of the present invention provides a server, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method for marking lung area shadows in medical images as described above when executing the computer program.
[0054] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for marking lung area shadows in medical images as described above are implemented.
[0055] Compared with the prior art, the embodiments of the present invention have the following beneficial effects: lung region segmentation is performed on a medical image containing lungs according to a pre-trained lung region segmentation model to obtain a lung region image, wherein the lung region segmentation model is a U-Net model trained according to a first preset number of first medical images; preset key feature points contained in the lung region image are detected according to a pre-trained lung key feature point detection model, wherein the lung key feature point detection model is a neural network model trained according to a second preset number of lung region images pre-labeled with lung key feature points; the lung region map is partitioned based on the preset key feature points contained in the lung region image, and shadows contained in the partitioned lung region are marked. Since the lung region division model is a model trained based on a first preset number of first medical images, the first medical image includes a medical image with uneven shadow distribution; the pre-trained lung key feature point detection model is a model trained based on a second preset number of first lung region images with pre-annotated lung key feature points, and the first lung region image includes a shadow region; therefore, performing lung region segmentation on a medical image containing lungs according to the pre-trained lung region division model can accurately segment the lung region without being affected by the uneven distribution of shadows in the medical image, and then performing preset key feature point detection on the segmented lung region according to the pre-trained lung key feature point detection model, and partitioning the lung region image based on the preset key feature points contained in the lung region image, marking the shadows contained in the partitioned lung region, and accurately determining the lung region where the shadow region is located, thereby improving the accuracy of the shadow region position marking. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0057] Figure 1 is a flowchart of the implementation of the lung region shadow marking method of the medical image provided by the first embodiment of the present invention;
[0058] Figure 2 is a flowchart of the implementation of the lung region shadow marking method of medical images provided by the second embodiment of the present invention;
[0059] Figure 3 is a flowchart of the implementation of the lung region shadow marking method of medical images provided by the third embodiment of the present invention;
[0060] Figure 4 yes Figure 1 The specific implementation flow chart of S103;
[0061] Figure 5 It is a functional module schematic diagram of the lung area shadow marking device of medical images provided by the present invention;
[0062] Figure 6 It is a schematic diagram of the internal functions of the server provided by the present invention. DETAILED DESCRIPTION
[0063] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.
[0064] In order to illustrate the technical solution of the present invention, the following is a description through specific embodiments. Figure 1 FIG. 1 is a flowchart of a method for marking shadows in the lung region of a medical image provided by the first embodiment of the present invention. The execution subject of this embodiment is a server. The details are as follows:
[0065] S101, performing lung region segmentation on a medical image containing the lungs according to a pre-trained lung region segmentation model to obtain a lung region image, wherein the lung region segmentation model is a U-Net model trained according to a first preset number of first medical images, wherein the first medical image includes a medical image with uneven shadow distribution. It can be understood that a medical image containing the lungs is an important basis in the diagnosis process of pneumoconiosis, and a common medical image containing the lungs is a pneumoconiosis chest film, also known as an X-ray chest film. In the diagnosis process of pneumoconiosis, doctors need to judge the texture and features of each lung region in the medical image containing the lungs based on experience. In an embodiment of the present scheme, in order to improve the accuracy of the doctor's diagnosis, the medical image containing the lungs is firstly subjected to lung region segmentation, specifically, segmentation is performed according to a pre-trained lung region segmentation model. The pre-trained lung region segmentation model is a U-Net model.
[0066] S102, detecting preset key feature points contained in the lung area image according to a pre-trained lung key feature point detection model, wherein the lung key feature point detection model is a neural network model trained according to a first lung area image pre-labeled with lung key feature points of a second preset number, and the first lung area image includes a shadow area.
[0067] Preferably, in this embodiment, the pre-trained lung key feature point detection model is a neural network model, the neural network model includes a feature layer and a detection layer, the detection layer is a Gaussian Mixture Model (GMM), and the GMM model is used to perform cluster analysis on the features of each layer of the feature layer, and to perform feature positioning of each layer of the feature layer from coarse to fine, and finally obtain a model for accurately positioning the features of each layer of the feature layer.
[0068] Preferably, in this embodiment, the GMM model includes convolution layers CL1-CL4, CL1-CL3 include convolution layers conv and maximum pooling layers MP respectively, CL4 includes a convolution layer with a convolution kernel of 2×2, and FC5-FC6 are fully connected layers.
[0069] S103, partitioning the lung region image based on preset key feature points contained in the lung region image, and marking shadows contained in the partitioned lung regions.
[0070] Furthermore, in the present embodiment, the preset key feature points include the first lung apex, the first diaphragmatic low, the second lung apex and the second diaphragmatic low; it is understandable that in some other embodiments, the preset key feature points may also include the first diaphragmatic top and the second diaphragmatic top, which is not specifically limited here.
[0071] Specifically, Figure 2 As shown, Figure 1 The specific implementation flow chart of S103 is as follows: Figure 2 It can be seen that S103 includes:
[0072] S1031, generating a first straight line based on the first pulmonary apex and the second pulmonary apex;
[0073] Typically, a human body includes left and right lung lobes. In this embodiment, the apex included in the left and right lung lobes in the medical image are preset as the first apex and the second apex, respectively, and the diaphragm included in the left and right lung lobes are preset as the first diaphragm low and the second diaphragm low, respectively, and a first straight line is generated based on the first apex and the second apex.
[0074] S1032: Generate a second straight line based on the first diaphragm bottom and the second diaphragm bottom.
[0075] S1033: Determine a vertical line segment between the first straight line and the second straight line, and obtain points dividing the vertical line segment into three equal parts.
[0076] Specifically, in this embodiment, after the vertical line segment between the first straight line and the second straight line is determined, the vertical line segment is divided into equal parts, so that the lung division is more accurate.
[0077] It is understandable that the number of lung regions into which the lungs are divided usually needs to be determined based on the actual application scenario. For example, in the process of diagnosing lung disease, the number of lung regions into which the lungs are divided is usually determined based on the type of disease caused by lesions in the lung region. In one possible implementation, the vertical distance of the lung apex is divided into three equal parts, and specifically, the three-division points of the vertical line segment are obtained.
[0078] It is understandable that in different implementation processes, depending on the application scenario, it can be divided into any equal parts, and no specific limitation is made here.
[0079] S1034, generating a horizontal line based on each equally divided point, using the first straight line, the second straight line, the vertical line segment and each of the horizontal lines as segmentation reference lines, and marking the shadows contained in the partitioned lung area.
[0080] Understandably, marking the shadows contained in the lung area is of great significance in the medical field. For example, in the diagnosis of lung diseases such as lung cancer and tuberculosis based on medical images, it is particularly important to accurately segment the lung area and determine the shadows contained in each segmented lung area. This is the basis for accurate diagnosis of the disease. Based on the density and size of the shadows in each lung area, lung disease diagnosis can be more accurately performed on medical images containing the lungs. This is because the severity of lung disease is not only related to the density of lung shadows, but also closely related to the distribution area of lung shadows. Therefore, after the lung area is partitioned according to preset key feature points, the shadow density of each lung area can be determined more conveniently and accurately, thereby improving the accuracy of lung disease diagnosis.
[0081] Through the above analysis, it can be known that the lung area shadow marking method of medical images proposed in the present invention performs lung area segmentation on a medical image containing lungs according to a pre-trained lung area division model to obtain a lung area image, wherein the lung area division model is a U-Net model trained according to a first preset number of first medical images; the preset key feature points contained in the lung area image are detected according to a pre-trained lung key feature point detection model, wherein the lung key feature point detection model is a neural network model trained according to a second preset number of lung area images pre-labeled with lung key feature points; the lung area map is partitioned based on the preset key feature points contained in the lung area image, and the shadows contained in the partitioned lung area are marked. Since the lung region division model is a model trained based on a first preset number of first medical images, the first medical image includes a medical image with uneven shadow distribution; the pre-trained lung key feature point detection model is a model trained based on a second preset number of first lung region images with pre-annotated lung key feature points, and the first lung region image includes a shadow region; therefore, performing lung region segmentation on a medical image containing lungs according to the pre-trained lung region division model can accurately segment the lung region without being affected by the uneven distribution of shadows in the medical image, and then performing preset key feature point detection on the segmented lung region according to the pre-trained lung key feature point detection model, and partitioning the lung region image based on the preset key feature points contained in the lung region image, marking the shadows contained in the partitioned lung region, and accurately determining the lung region where the shadow region is located, thereby improving the accuracy of the shadow region position marking.
[0082] Specifically, Figure 3 FIG. 1 is a flowchart of a method for marking shadows in the lung region of a medical image provided by the second embodiment of the present invention. Figure 3 It can be seen that this embodiment and Figure 1Compared with the illustrated embodiment, the specific implementation process of S206-S209 is the same as that of S101-S103, except that S201-S205 are included before S206, wherein the specific implementation process of S201-S205 is described as follows.
[0083] S201 : Acquire a first preset number of first medical images, and divide the first medical images into training samples of a first ratio and test samples of a second ratio.
[0084] Specifically, the first medical image is a medical image in which the lung area is pre-divided; it can be understood that the preset number of first medical images can be obtained from a medical-specific image library. In order to improve the accuracy of model training, the preset number of first medical images are divided into a preset ratio (for example, 7:3) to generate a training sample set generated by training samples of the first ratio and a test sample set generated by test samples of the second ratio.
[0085] S202: Input the first ratio of training samples into a pre-established U-Net model for training.
[0086] Preferably, before training, the training samples of the first ratio are transformed (resized) according to a preset image transformation function to obtain an image of a preset size (such as 224*224); this is because organs in the human body may be in different states at any time, and in some cases may be squeezed by other organs to cause the shape to be distorted. Therefore, before model training, the training samples are transformed, including stretching, scaling, translation and other transformations; the image of the preset size is input into the input network of the U-Net model for training, which can improve the efficiency and accuracy of model training.
[0087] Preferably, the preset image size conversion function may be:
[0088] dsize = Size(round(fx*src), round(fy*src))
[0089] Among them, fx: represents the scaling ratio in the width direction, fy: represents the scaling ratio in the height direction, and src represents the image before the transformation.
[0090] Optionally, a binary mask may be calculated for each pixel point corresponding to each sample in the training sample, and then a corresponding binary image may be generated; and the U-Net model may be trained according to the binary image.
[0091] S203: Input the test samples of the second ratio into the U-Net model to obtain a second medical image output by the U-Net model that divides the lung area.
[0092] It can be understood that as the model training progresses, the U-Net model will output a second medical image with the lung area divided after the training is completed. Specifically, the higher the accuracy of the U-Net model training, the higher the overlap rate between the lung area divided in the second medical image output by it and the lung area divided in the training sample.
[0093] S204: If the overlap rate between the second medical image and the lung area of each sample in the preset test sample set is greater than or equal to a preset overlap rate threshold, it is determined that the test of the U-Net model passes, and the U-Net model is the lung area division model.
[0094] Specifically, the overlap rate between the second medical image and the lung area of each sample in the preset test sample set is recorded as IOU, then
[0095]
[0096] Wherein C represents the lung region of the second medical image, and G represents the lung region in the test sample.
[0097] S205, if the overlap rate of the lung regions of the second medical image and each sample in the preset test sample set is less than or equal to the preset overlap rate threshold, it is determined that the test of the U-Net model fails, the number of samples in the training sample set is increased, and S202 is executed. The lung region shadow marking method of medical images proposed in the present invention performs lung region segmentation on a medical image containing the lungs according to a pre-trained lung region division model to obtain a lung region image, wherein the lung region division model is a U-Net model trained according to a first preset number of first medical images; the preset key feature points contained in the lung region image are detected according to a pre-trained lung key feature point detection model, wherein the lung key feature point detection model is a neural network model trained according to a second preset number of lung region images pre-labeled with lung key feature points; the lung region map is partitioned based on the preset key feature points contained in the lung region image, and the shadows contained in the partitioned lung region are marked. Since the lung region division model is a model trained based on a first preset number of first medical images, the first medical image includes a medical image with uneven shadow distribution; the pre-trained lung key feature point detection model is a model trained based on a second preset number of first lung region images with pre-annotated lung key feature points, and the first lung region image includes a shadow region; therefore, performing lung region segmentation on a medical image containing lungs according to the pre-trained lung region division model can accurately segment the lung region without being affected by the uneven distribution of shadows in the medical image, and then performing preset key feature point detection on the segmented lung region according to the pre-trained lung key feature point detection model, and partitioning the lung region image based on the preset key feature points contained in the lung region image, marking the shadows contained in the partitioned lung region, and accurately determining the lung region where the shadow region is located, thereby improving the accuracy of the shadow region position marking. It should be noted that the above S201 to S205 are the training process of the U-Net model. It can be understood that in different embodiments, the training process of the U-Net model is not limited to the above S201 to S205. For example, in an optional implementation, the training of the U-Net model can be completed by the following steps, which are described in detail as follows:
[0098] Acquire a first preset number of first medical images, and divide the first medical images into training samples of a first ratio and test samples of a second ratio;
[0099] Inputting the first proportion of training samples into a pre-established U-Net model for training;
[0100] Inputting the test samples of the second ratio into the U-Net model, and obtaining a second medical image with a lung region divided corresponding to each of the test samples output by the U-Net model;
[0101] Obtain a target value of the loss function of the U-Net model, where the target value is the value of the loss function of the U-Net model when the U-Net model analyzes each of the test samples;
[0102] If the rate of change of the target value is less than a preset rate of change threshold, it is determined that the test of the U-Net model passes, and the U-Net model is a trained lung region division model;
[0103] If the rate of change of the target value is greater than or equal to a preset rate of change threshold, it is determined that the test of the U-Net model fails, the number of samples in the training sample set is increased, and the first medical image in the training sample set is input into the U-Net model for training.
[0104] In an optional implementation, the loss function of the trained U-Net model is:
[0105]
[0106] in, is a function that measures the pixel x, which is defined as follows:
[0107]
[0108] in, is a function mapping related to the target area (lung area) to which the x pixel belongs. is the closest distance between the x pixel point and the target area, It is the distance between the x pixel point and the target area. and are two parameters of the model; Indicates the probability that the pixel point x belongs to the target area (lung area).
[0109] Specifically, Figure 4 FIG. 1 is a flowchart of a method for marking shadows in the lung region of a medical image provided by the third embodiment of the present invention. Figure 4 It can be seen that this embodiment and Figure 1 Compared with the embodiment shown, the specific implementation process of S301-S303 is the same as S101-S103. The difference is that before S303, S304-307 are also included, wherein S304 and S302 can be executed simultaneously or one of them can be executed selectively. The specific implementation process of S304-S307 is described as follows.
[0110] S304, inputting a second preset number of training samples into the feature layer of the neural network model for training, and obtaining a second lung region image output by the feature layer;
[0111] Specifically, the training sample is a first lung region image with key lung feature points pre-annotated, and the second lung region image is a picture with key lung feature points annotated on the feature layer.
[0112] S305: The detection layer performs cluster analysis on the second lung region image to obtain a third lung region image containing the preset key feature points.
[0113] Specifically, the number of fully linked layers FC5 of the detection layer is assumed to be K. During the training process, the value of K remains unchanged at 1 until the GMM model begins to converge and the value of K begins to change. The features of the training samples obtained through the CL4 layer are clustered and analyzed through the GMM model. During this process, with the clustering analysis of the GMM model, the value of K begins to change, and finally K categories of third lung area images containing the preset key feature points are obtained.
[0114] S306: If the similarities between all the second lung area images and the third lung area images are less than a preset similarity threshold, the neural network model is the trained lung key feature point detection model.
[0115] Specifically, all the second lung area images are re-input into the neural network model respectively, and the similarity between the lung area image containing the preset key feature points obtained after the CL4 layer of the GMM model analyzes the second lung area image and the third lung area image of the K class containing the preset key feature points is calculated.
[0116] S307: If the similarity between the second lung region image and the third lung region image is greater than or equal to a preset similarity threshold, increase the number of training samples and execute S305 again.
[0117] It should be noted that since the characteristics of the diaphragm top position of lungs of different forms are significantly different, during the training process of the model, the characteristics of the training samples are first clustered and analyzed so that the corresponding diaphragm top position can be found more accurately for lungs of different forms. The diaphragm top position is the key feature point of the lungs.
[0118] Preferably, in this solution, the loss function of the CNN neural network model can be expressed as:
[0119]
[0120] It should be noted that the preset key feature points can be preset according to the geometric features of the lungs and the lesion area, and no specific limitation is made here.
[0121] Preferably, in this embodiment, the preset key feature points include the first lung apex, the first diaphragm base, the second lung apex and the second diaphragm base.
[0122] From the above analysis, it can be seen that the lung area shadow marking method of medical images proposed in the present invention performs lung area segmentation on a medical image containing lungs according to a pre-trained lung area division model to obtain a lung area image, wherein the lung area division model is a U-Net model trained according to a first preset number of first medical images; the preset key feature points contained in the lung area image are detected according to a pre-trained lung key feature point detection model, wherein the lung key feature point detection model is a neural network model trained according to a second preset number of lung area images pre-labeled with lung key feature points; the lung area map is partitioned based on the preset key feature points contained in the lung area image, and the shadows contained in the partitioned lung area are marked. Since the lung region division model is a model trained based on a first preset number of first medical images, the first medical image includes a medical image with uneven shadow distribution; the pre-trained lung key feature point detection model is a model trained based on a second preset number of first lung region images with pre-annotated lung key feature points, and the first lung region image includes a shadow region; therefore, performing lung region segmentation on a medical image containing lungs according to the pre-trained lung region division model can accurately segment the lung region without being affected by the uneven distribution of shadows in the medical image, and then performing preset key feature point detection on the segmented lung region according to the pre-trained lung key feature point detection model, and partitioning the lung region image based on the preset key feature points contained in the lung region image, marking the shadows contained in the partitioned lung region, and accurately determining the lung region where the shadow region is located, thereby improving the accuracy of the shadow region position marking. Figure 5 Schematic diagram of the functional modules of the lung region shadow marking device for medical images provided by the present invention. Figure 5 As shown, the lung region segmentation device 5 of the medical image of this embodiment includes: a segmentation module 510, a detection module 520 and a marking module 530. Among them,
[0123] A segmentation module 510 is used to perform lung region segmentation on a medical image containing the lungs according to a pre-trained lung region segmentation model to obtain a lung region image, wherein the lung region segmentation model is a U-Net model trained according to a first preset number of first medical images, wherein the first medical images include medical images with uneven shadow distribution;
[0124] A detection module 520, configured to detect preset key feature points contained in the lung region image according to a pre-trained lung key feature point detection model, wherein the lung key feature point detection model is a neural network model trained according to a second preset number of first lung region images pre-labeled with lung key feature points, wherein the first lung region image includes a shadow region;
[0125] The marking module 530 is used to partition the lung region image based on preset key feature points contained in the lung region image, and mark shadows contained in the partitioned lung regions.
[0126] Preferably, it also includes:
[0127] an acquisition module, configured to acquire a first preset number of first medical images, and divide the first medical images into a training sample set and a test sample set of preset proportions, wherein the first medical images are medical images in which lung regions are pre-divided;
[0128] A training module, used for inputting the first medical image in the training sample set into a U-Net model for training;
[0129] An acquisition module, used for inputting the first medical image in the test sample set into the U-Net model to obtain a second medical image output by the U-Net model;
[0130] A first determination module is used to determine that the test of the U-Net model passes if the overlap rate between the second medical image and the lung area of each sample in the preset test sample set is greater than or equal to a preset overlap rate threshold, and the U-Net model is a trained lung area division model;
[0131] The second determination module is used to determine that the test of the U-Net model fails if the overlap rate between the second medical image and the lung area of each sample in the preset test sample set is less than or equal to a preset overlap rate threshold, increase the number of samples in the training sample set, and execute the input of the first medical image in the training sample set into the U-Net model for training.
[0132] Preferably, the damage function of the trained U-Net model is:
[0133]
[0134] in, The definition is as follows:
[0135]
[0136] in, is a preset mapping function related to the lung region to which the x-th pixel belongs. is the distance between the xth pixel and the lung area. is the second closest distance between the x-th pixel and the lung area, and is the constant term of the model, Indicates the probability that the x-th pixel belongs to the lung area.
[0137] Preferably, it also includes:
[0138] An image acquisition module is used to input a second preset number of training samples into the feature layer for training, and obtain a second lung region image output by the feature layer, wherein the training samples are first lung region images pre-labeled with key lung feature points, and the second lung region image is a picture labeled with key lung feature points by the feature layer;
[0139] A cluster analysis module, configured to perform cluster analysis on the first lung region image based on the detection layer to obtain a third lung region image containing the preset key feature points;
[0140] A first comparison module, configured to determine that the neural network model is the trained lung key feature point detection model if the similarities between all the second lung region images and the third lung region images are less than a preset similarity threshold;
[0141] The second comparison module is used to increase the number of training samples and re-execute the step of inputting the preset number of training samples into the feature layer for training if the similarity between the second lung area image and the third lung area image is greater than or equal to a preset similarity threshold, so as to obtain the second lung area image output by the feature layer.
[0142] Preferably, the preset key feature points include the first lung apex, the first diaphragm bottom, the second lung apex and the second diaphragm bottom; the marking module 530 includes:
[0143] A first generating unit, configured to generate a first straight line based on the first pulmonary apex and the second pulmonary apex;
[0144] A second generating unit, configured to generate a second straight line based on the first diaphragm bottom and the second diaphragm bottom;
[0145] An acquisition generating unit is used to determine a vertical line segment between the first straight line and the second straight line, and to obtain points dividing the vertical line segment into three equal parts;
[0146] A third generating unit, used for generating a horizontal line based on each equally divided point;
[0147] The marking unit is used to use the first straight line, the second straight line, the vertical line segment and each of the horizontal lines as segmentation reference lines to obtain a preset number of lung regions, and mark the shadows contained in the partitioned lung regions.
[0148] Figure 6 Schematic diagram of the internal functions of the server provided by the present invention. Figure 6 As shown, the server 6 of this embodiment includes: a processor 60, a memory 61, and a computer program 62 stored in the memory 61 and executable on the processor 60, such as a medical image lung region shadow marking program. When the processor 60 executes the computer program 62, the steps in the above-mentioned medical image lung region shadow marking method embodiments are implemented, such as Figure 1 Alternatively, when the processor 60 executes the computer program 62, the functions of each module / unit in the above-mentioned medical image lung region shadow marking device embodiment are realized, for example Figure 5 Functions of modules 510 to 530 are shown.
[0149] Exemplarily, the computer program 62 may be divided into one or more modules / units, which are stored in the memory 61 and executed by the processor 60 to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program 62 in the server 6. For example, the computer program 62 may be divided into a partitioning module, a detection module, and a partitioning module (a module in a virtual device), and the specific functions of each module are as follows:
[0150] A segmentation module, configured to perform lung region segmentation on a medical image containing the lungs according to a pre-trained lung region segmentation model to obtain a lung region image, wherein the lung region segmentation model is a U-Net model trained according to a first preset number of first medical images, wherein the first medical images include medical images with uneven shadow distribution;
[0151] a detection module, configured to detect preset key feature points contained in the lung region image according to a pre-trained lung key feature point detection model, wherein the lung key feature point detection model is a neural network model trained according to a second preset number of lung region images pre-labeled with lung key feature points, wherein the first lung region image includes a shadow region;
[0152] A partitioning module is used to partition the lung area image based on preset key feature points contained in the lung area image, and mark shadows contained in the partitioned lung areas.
[0153] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0154] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0155] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0156] In the embodiments provided by the present invention, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0157] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple communication units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0158] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0159] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned method embodiments can be implemented. . Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0160] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A method for marking shadows in lung regions of medical images, characterized in that: include: Performing lung region segmentation on a medical image containing the lungs according to a pre-trained lung region segmentation model to obtain a lung region image, wherein the lung region segmentation model is a U-Net model trained according to a first preset number of first medical images, wherein the first medical images include medical images with uneven shadow distribution; Detecting preset key feature points contained in the segmented lung region image according to a pre-trained lung key feature point detection model, wherein the lung key feature point detection model is a neural network model trained according to a second preset number of first lung region images pre-labeled with lung key feature points, wherein the first lung region image includes a shadow area; Partitioning the lung region image based on preset key feature points contained in the lung region image, and marking shadows contained in the partitioned lung regions; The preset key feature points include a first lung apex, a first diaphragm bottom, a second lung apex, and a second diaphragm bottom; partitioning the lung region image based on the preset key feature points included in the lung region image, and marking shadows included in the partitioned lung regions, including: generating a first straight line based on the first pulmonary apex and the second pulmonary apex; generating a second straight line based on the first diaphragm bottom and the second diaphragm bottom; Determine a vertical line segment between the first straight line and the second straight line, and obtain three equal division points of the vertical line segment; Generate horizontal lines based on each equally divided point; The first straight line, the second straight line, the vertical line segment and each of the horizontal lines are used as segmentation reference lines to obtain a preset number of lung regions, and the shadows contained in the partitioned lung regions are marked.
2. The lung region shadow marking method of medical images according to claim 1, characterized in that: Before performing lung region segmentation on a medical image containing the lungs according to the pre-trained lung region segmentation model to obtain the lung region, the process includes: Acquire a first preset number of first medical images, and divide the first medical images into training samples of a first ratio and test samples of a second ratio, wherein the first medical images are medical images in which lung regions are pre-divided; Inputting the first proportion of training samples into the U-Net model for training; Inputting the test samples of the second ratio into the U-Net model, and obtaining a second medical image with a lung region divided corresponding to each of the test samples output by the U-Net model; If the overlap rate between the second medical image and the lung regions of each sample in the preset test sample set is greater than or equal to a preset overlap rate threshold, it is determined that the test of the U-Net model passes, and the U-Net model is a trained lung region segmentation model; If the overlap rate between the second medical image and the lung area of each sample in the preset test sample set is less than or equal to a preset overlap rate threshold, it is determined that the test of the U-Net model fails, the number of samples in the training sample set is increased, and the first proportion of training samples is input into the U-Net model for training.
3. The lung region shadow marking method of medical images according to claim 2, characterized in that: After inputting the test samples of the second ratio into the U-Net model to obtain the second medical image with the lung area divided corresponding to each of the test samples output by the U-Net model, the method includes: Obtain a target value of the loss function of the U-Net model, where the target value is the value of the loss function of the U-Net model when the U-Net model analyzes each of the test samples; If the rate of change of the target value is less than a preset rate of change threshold, it is determined that the test of the U-Net model passes, and the U-Net model is a trained lung region division model; If the rate of change of the target value is greater than or equal to a preset rate of change threshold, it is determined that the test of the U-Net model fails, the number of samples in the training sample set is increased, and the first proportion of training samples is input into the U-Net model for training.
4. The lung region shadow marking method of medical images according to claim 3, characterized in that: The loss function of the trained U-Net model is: in, The definition is as follows: Among them, L is the probability that the x-th pixel belongs to the preset lung area, is a preset mapping function related to the lung region to which the x-th pixel belongs. is the distance between the xth pixel and the lung area. is the second closest distance between the x-th pixel and the lung area, and is a constant term, is the probability that the x-th pixel belongs to the lung region.
5. The lung region shadow marking method of medical images according to claim 1, characterized in that: The pre-trained neural network model includes a feature layer and a detection layer; Before detecting the preset key feature points contained in the lung area according to the pre-trained lung key feature point detection model, the method includes: Inputting a second preset number of training samples into the feature layer for training, obtaining a second lung region image output by the feature layer, wherein the training samples are first lung region images pre-labeled with key lung feature points, and the second lung region image is a picture labeled with key lung feature points by the feature layer; The detection layer performs cluster analysis on the second lung region image to obtain a third lung region image containing the preset key feature points; If the similarities between all the second lung region images and the third lung region images are less than a preset similarity threshold, the neural network model is the trained lung key feature point detection model; If the similarity between the second lung area image and the third lung area image is greater than or equal to a preset similarity threshold, the number of training samples is increased, and the step of inputting the second preset number of training samples into the feature layer for training is re-executed to obtain the second lung area image output by the feature layer.
6. A lung region shadow marking device for medical images, characterized in that: include: A segmentation module, configured to perform lung region segmentation on a medical image containing the lungs according to a pre-trained lung region segmentation model to obtain a lung region image, wherein the lung region segmentation model is a U-Net model trained according to a first preset number of first medical images, wherein the first medical images include medical images with uneven shadow distribution; A detection module, configured to detect preset key feature points contained in the segmented lung region image according to a pre-trained lung key feature point detection model, wherein the lung key feature point detection model is a neural network model trained according to a second preset number of first lung region images pre-labeled with lung key feature points, wherein the first lung region image includes a shadow region; A marking module, used to partition the lung region image based on preset key feature points contained in the lung region image, and mark shadows contained in the partitioned lung regions; The preset key feature points include the first lung apex, the first diaphragm base, the second lung apex and the second diaphragm base; The marking module comprises: A first generating unit, configured to generate a first straight line based on the first pulmonary apex and the second pulmonary apex; A second generating unit, configured to generate a second straight line based on the first diaphragm bottom and the second diaphragm bottom; An acquisition generating unit is used to determine a vertical line segment between the first straight line and the second straight line, and to obtain points dividing the vertical line segment into three equal parts; A third generating unit, used for generating a horizontal line based on each equally divided point; A marking unit is used to obtain a preset number of lung areas by using the first straight line, the second straight line, the vertical line segment and each of the horizontal lines as segmentation reference lines, and mark the shadows contained in the partitioned lung areas.
7. The lung region shadow marking device of medical image according to claim 6, characterized in that: The pre-trained lung region segmentation model is a trained U-Net model, and further includes: an acquisition module, configured to acquire a first preset number of first medical images, and divide the first medical images into a training sample set and a test sample set of preset proportions, wherein the first medical images are medical images in which lung regions are pre-divided; A training module, used for inputting the first medical image in the training sample set into the U-Net model for training; An acquisition module, used for inputting the first medical image in the test sample set into the U-Net model to obtain a second medical image output by the U-Net model; A first determination module is used to determine that the test of the U-Net model passes if the overlap rate between the second medical image and the lung area of each sample in the preset test sample set is greater than or equal to a preset overlap rate threshold, and the U-Net model is a trained lung area division model; The second determination module is used to determine that the test of the U-Net model fails if the overlap rate between the second medical image and the lung area of each sample in the preset test sample set is less than or equal to a preset overlap rate threshold, increase the number of samples in the training sample set, and execute the input of the first medical image in the training sample set into the U-Net model for training.
8. A server comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method for marking lung area shadows in medical images as described in any one of claims 1 to 5 are implemented.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method for marking lung area shadows in medical images as described in any one of claims 1 to 5 are implemented.
