Pulmonary nodule segmentation method based on M-N-CDFTransUNet network model
By adopting the M-N-CDFTransUNet network model in lung nodule segmentation, combining multi-scale feature fusion, nonlinear feature extraction and improved loss function, the problem of low degree of automation of lung nodule segmentation in the existing technology is solved, and efficient and accurate are achieved Improvement of lung nodule segmentation and model generalization ability.
Patent Information
- Application Number
- CN202411461209.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-02-07
AI Technical Summary
The prior art has problems such as low degree of automation, long time-consuming and easy to lead to misdiagnosis and misdiagnosis in lung nodule segmentation, especially when processing a large number of CT images.
The lung nodule segmentation method based on the M-N-CDFTransUNet network model is adopted, and the segmentation performance and generalization ability of the model are improved through multi-scale feature fusion, nonlinear feature extraction module NAFB and improved loss function CDF loss function strategy.
It realizes efficient and automated segmentation of lung nodules, improves the comprehensive understanding and identification of lung nodules, reduces the risk of misdiagnosis and misdiagnosis, and improves the generalization ability of the model.
Smart Images

Figure CN119399224A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of medical image processing, and in particular to a lung nodule segmentation method based on an MN-CDFTransUNet network model. Background Art
[0002] Lung cancer is one of the most threatening malignant tumors to human life and health. Its early asymptomatic appearance makes the disease difficult to detect. By the time the disease is discovered, the cancer has already metastasized and worsened, making it difficult to treat. Lung cancer often has symptoms of lung nodules in its early stages, which provides clues for early detection. Currently, lung CT scanning technology has become an important means of detecting lung nodules. It can provide detailed and clear images of the lungs. However, faced with dozens or even hundreds of CT images for each patient, doctors need to spend a lot of energy to screen them one by one, which not only increases the workload, but also may increase the risk of missed diagnosis and misdiagnosis due to long-term repetitive work. Therefore, it is necessary to develop a method that can fully automate the segmentation of lung nodules. Summary of the invention
[0003] In order to solve the deficiencies in the above-mentioned prior art, the purpose of the present invention is to provide a lung nodule segmentation method based on the MN-CDFTransUNet network model. Through multi-scale feature fusion, the model can integrate feature information at different levels, thereby enhancing the comprehensive understanding and recognition ability of lung nodules; and use the nonlinear feature extraction module NAFB to introduce an attention mechanism to focus on more important areas or channels in the feature map; in view of the problem of insufficient model generalization ability caused by the selection of the loss function of TransUNet, a CDF loss function strategy is proposed to further optimize the model segmentation performance and improve the model generalization ability.
[0004] The technical solution adopted by the present invention to solve the technical problem is:
[0005] A pulmonary nodule segmentation method based on the MN-CDFTransUNet network model is provided, comprising the following steps:
[0006] S1: Convert the image format of the LIDC-IDRI lung dataset;
[0007] S2: Extract the lung parenchyma based on K-means and image processing;
[0008] S3: establishing a pulmonary nodule segmentation dataset based on the lung parenchyma image segmented by S2, and dividing the pulmonary nodule dataset into a training set and a validation set;
[0009] S4: Establishing a lung nodule segmentation model of an improved TransUNet algorithm; the improved TransUNet lung nodule segmentation model, also known as the MN-CDFTransUNet network lung nodule segmentation model, is obtained by performing multi-scale feature fusion, introducing a new module for nonlinear feature extraction, and improving the loss function for optimization on the basis of the original TransUNet algorithm;
[0010] S5: Use the training set described in S3 to train the MN-CDFTransUNet network lung nodule segmentation model obtained in S4, and obtain an optimized model after training;
[0011] S6: Use the validation set described in S3 to validate the MN-CDFTransUNet network lung nodule segmentation model obtained in S4;
[0012] S7: Use S6 to verify the optimized model to identify lung images.
[0013] Furthermore, the steps of S1 are as follows:
[0014] More than 7,000 lung images were selected from the LIDC-IDRI dataset and converted from .dom format to visible .png format.
[0015] Furthermore, the steps of S2 are as follows:
[0016] S21: min-max normalization and standardization of the data converted from S1 to facilitate the identification of lung tissue;
[0017] Traversing each pixel in the image matrix, the specific normalization operation formula is:
[0018]
[0019] Among them, x represents each pixel value traversed in the image, max(x) is the maximum value of the input pixel, min(x) is the minimum value of the input pixel, and x norm is the pixel value obtained after conversion.
[0020] Traversing each pixel in the image matrix, the specific operation formula for standardization is:
[0021]
[0022] Among them, x represents each pixel value traversed in the image, mean(x) is the pixel mean of the input pixel, std(x) is the standard deviation of the input pixel, and x norm is the pixel value obtained after conversion;
[0023] S22: using the K-means clustering algorithm to perform cluster analysis on the image obtained in step S21, and dividing the image into two categories: foreground (lung tissue) and background (non-lung tissue);
[0024] The specific implementation steps of K-means are:
[0025] S221: Select k initial cluster centers;
[0026] S222: assign each data point to the nearest cluster center;
[0027] Based on the Euclidean distance as the distance metric, it is expressed as:
[0028]
[0029] Where x is the data point, c i is the i-th cluster center, d is the data dimension, x j and c ij Represented by x and c i The value in the jth dimension;
[0030] S223: re-update each cluster center;
[0031] For each cluster, its cluster center is recalculated, and the new cluster center is the mean of all data points in the cluster, which is expressed as:
[0032]
[0033] Among them, S i is the set of i-th data points, |S i | is the number of data points in the set;
[0034] S224: Iterative update;
[0035] Until the distance between the new cluster center and the old cluster center is less than the set threshold or the maximum number of iterations is reached;
[0036] S23: Morphological processing is used to perform erosion and dilation operations on the result after rough segmentation to remove small particle noise and fill the cavity inside the lung area, which is used as a new lung mask;
[0037] S231: Morphological corrosion;
[0038] When structure B corrodes structure A, it is expressed as follows:
[0039]
[0040] Among them, (B) xy Indicates that structure B is at (x,y), It is indicated as being completely contained in the overlapping region of structure A;
[0041] S232: morphological expansion;
[0042] When structure B expands structure A, it is expressed as follows:
[0043]
[0044] Among them, (B) xy Indicates that structure B is at (x,y), It means that the intersection with structure A is not empty;
[0045] S24: The new lung mask is further processed using connected domain analysis technology. By setting appropriate connected domain parameters, irrelevant isolated areas in the image are removed while retaining the main lung connected domains.
[0046] Furthermore, in step S3, the segmented lung parenchyma parts obtained in S2 are integrated, and the lung nodule dataset includes 7521 images, which are divided into a training set, a validation set, and a test set at a ratio of 0.8, 0.15, and 0.05.
[0047] Furthermore, in step S4, the pulmonary nodule segmentation model of the improved TransUNet algorithm is established to optimize the original TransUNet algorithm. The specific steps are as follows:
[0048] S4.1: Adjust the Skip Connections part in the original TransUNet algorithm, change it to multi-scale fusion to enhance the feature extraction capability, capture feature information of different scales and abstract levels through different network layers, and effectively integrate this information to enrich the model's ability to represent lung nodules, thereby improving recognition accuracy and detection performance, and completing the optimization of the original algorithm;
[0049] S4.2: A module dedicated to feature enhancement is added to each stage of the decoder of the original TransUNet, which enables the model to focus on more critical spatial information and channel features, not only retaining the richness of the original features, but also promoting the effective propagation of information between different layers;
[0050] S4.3: Based on the original TransUNet, the loss function is carefully optimized and Focal loss is added to the original loss function.
[0051] Furthermore, in step S4.1, the direct jump connection of x1, x2, and x3 output by block1, block2, and block3 is changed to multi-scale fusion, and newx1, newx2, and newx3 are fused to obtain the final output.
[0052] Furthermore, in step S4.2, the added module for feature enhancement replaces the traditional ReLU (Rectified Linear Unit) activation function with SCA (Spatial Channel Attention) and SimpeGate gating mechanism. The SCA mechanism adaptively weights features in two dimensions: space and channel.
[0053] Furthermore, in step S4.3, the Focal loss is weighted together with the original cross entropy loss CE (CrossEntropy Loss) and Dice loss as a new loss function.
[0054] Compared with the prior art, the present invention has the following beneficial effects:
[0055] Compared with other pulmonary nodule segmentation techniques based on convolutional neural networks in the prior art, the present invention first segments the lung parenchyma to remove irrelevant parts, and then through multi-scale feature fusion, the model can integrate feature information at different levels, thereby enhancing the comprehensive understanding and recognition ability of pulmonary nodules; then a nonlinear feature extraction module NAFB is designed, and an attention mechanism is introduced to focus on more important areas or channels in the feature map. The attention mechanism NAFB of nonlinear feature extraction can help the model focus more on key features, thereby improving the overall feature extraction performance of the model; finally, in response to the problem of insufficient model generalization ability caused by the selection of the loss function of TransUNet, a CDF loss function strategy is proposed to further optimize the model segmentation performance and improve the model generalization ability. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
[0057] Figure 1 The figure shows a flow chart of a lung nodule segmentation method based on the MN-CDFTransUNet network model according to an embodiment of the present invention.
[0058] Figure 2 The diagram shows a network model based on MN-CDFTransUNet according to an embodiment of the present invention.
[0059] Figure 3 Shown is a schematic diagram of multi-scale feature fusion of the present invention.
[0060] Figure 4 Shown is the NAFB module diagram.
[0061] Figure 5Shown is the SimpleGate module diagram.
[0062] Figure 6 Shown is the Simplified Channel Attention (SCA) module diagram. DETAILED DESCRIPTION
[0063] The technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments.
[0064] The components of the embodiments of the present invention generally described and shown in the drawings herein may be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention.
[0065] Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without making any creative work shall fall within the scope of protection of the present invention.
[0066] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0067] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0068] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings.
[0069] Embodiment 1:
[0070] like Figure 1-Figure 6As shown, an embodiment of the present invention provides a pulmonary nodule segmentation method based on the MN-CDFTransUNet network model, comprising the following steps:
[0071] S1: Convert the LIDC-IDRI lung dataset images to different formats.
[0072] The steps of S1 are as follows:
[0073] More than 7,000 lung images were selected from the LIDC-IDRI dataset and converted from .dom format to visible .png format.
[0074] S2: Extract the lung parenchyma based on K-means and image processing.
[0075] The steps of S2 are as follows:
[0076] S21: min-max normalization and standardization of the data converted from S1 to facilitate the identification of lung tissue;
[0077] Traversing each pixel in the image matrix, the specific normalization operation formula is:
[0078]
[0079] Among them, x represents each pixel value traversed in the image, max(x) is the maximum value of the input pixel, min(x) is the minimum value of the input pixel, and x norm is the pixel value obtained after conversion.
[0080] Traversing each pixel in the image matrix, the specific operation formula for standardization is:
[0081]
[0082] Among them, x represents each pixel value traversed in the image, mean(x) is the pixel mean of the input pixel, std(x) is the standard deviation of the input pixel, and x norm is the pixel value obtained after conversion;
[0083] S22: using the K-means clustering algorithm to perform cluster analysis on the image obtained in step S21, and dividing the image into two categories: foreground (lung tissue) and background (non-lung tissue);
[0084] The specific implementation steps of K-means are:
[0085] S221: Select k initial cluster centers;
[0086] S222: assign each data point to the nearest cluster center;
[0087] Based on the Euclidean distance as the distance metric, it is expressed as:
[0088]
[0089] Where x is the data point, c i is the i-th cluster center, d is the data dimension, x j and c ij Represented by x and c i The value in the jth dimension;
[0090] S223: re-update each cluster center;
[0091] For each cluster, its cluster center is recalculated, and the new cluster center is the mean of all data points in the cluster, which is expressed as:
[0092]
[0093] Among them, S i is the set of i-th data points, |S i | is the number of data points in the set;
[0094] S224: Iterative update;
[0095] Until the distance between the new cluster center and the old cluster center is less than the set threshold or the maximum number of iterations is reached;
[0096] S23: Morphological processing is used to perform erosion and dilation operations on the result after rough segmentation to remove small particle noise and fill the cavity inside the lung area, which is used as a new lung mask;
[0097] S231: Morphological corrosion;
[0098] When structure B corrodes structure A, it is expressed as follows:
[0099]
[0100] Among them, (B) xy Indicates that structure B is at (x,y), It is indicated as being completely contained in the overlapping region of structure A;
[0101] S232: morphological expansion;
[0102] When structure B expands structure A, it is expressed as follows:
[0103]
[0104] Among them, (B) xy Indicates that structure B is at (x,y), It means that the intersection with structure A is not empty;
[0105] S24: The new lung mask is further processed using connected domain analysis technology. By setting appropriate connected domain parameters, irrelevant isolated areas in the image are removed while retaining the main lung connected domains.
[0106] S3: A pulmonary nodule segmentation dataset is established based on the lung parenchyma image segmented by S2, and the pulmonary nodule dataset is divided into a training set and a validation set.
[0107] Specifically, in step S3, the segmented lung parenchyma parts obtained in S2 are integrated. The lung nodule dataset includes 7521 images, and the images are divided into a training set, a validation set, and a test set at a ratio of 0.8, 0.15, and 0.05.
[0108] S4: Establish a lung nodule segmentation model of the improved TransUNet algorithm; the improved TransUNet lung nodule segmentation model, also known as the MN-CDFTransUNet network lung nodule segmentation model, is obtained by performing multi-scale feature fusion, introducing a new module for nonlinear feature extraction, and improving the loss function for optimization on the basis of the original TransUNet algorithm.
[0109] Specifically, in step S4, the pulmonary nodule segmentation model of the improved TransUNet algorithm is established to optimize the original TransUNet algorithm. The specific steps are as follows:
[0110] S4.1: Adjust the Skip Connections part in the original TransUNet algorithm, change it to multi-scale fusion to enhance the feature extraction capability, capture feature information of different scales and abstract levels through different network layers, and effectively integrate this information to enrich the model's ability to represent lung nodules, thereby improving recognition accuracy and detection performance, and completing the optimization of the original algorithm;
[0111] S4.2: A module dedicated to feature enhancement is added to each stage of the decoder of the original TransUNet, which enables the model to focus on more critical spatial information and channel features, not only retaining the richness of the original features, but also promoting the effective propagation of information between different layers;
[0112] S4.3: Based on the original TransUNet, the loss function is carefully optimized and Focal loss is added to the original loss function.
[0113] Furthermore, in step S4.1, the direct jump connection of x1, x2, and x3 output by block1, block2, and block3 is changed to multi-scale fusion, and newx1, newx2, and newx3 are fused to obtain the final output.
[0114] Furthermore, in step S4.2, the added module for feature enhancement replaces the traditional ReLU (Rectified Linear Unit) activation function with SCA (Spatial Channel Attention) and SimpeGate gating mechanism. The SCA mechanism adaptively weights features in two dimensions: space and channel.
[0115] Furthermore, in step S4.3, the Focal loss is weighted together with the original cross entropy loss CE (CrossEntropy Loss) and Dice loss as a new loss function.
[0116] S5: Use the training set described in S3 to train the MN-CDFTransUNet network lung nodule segmentation model obtained in S4, and obtain an optimized model after training;
[0117] S6: Use the validation set described in S3 to validate the MN-CDFTransUNet network lung nodule segmentation model obtained in S4;
[0118] S7: Use S6 to verify the optimized model to identify lung images.
[0119] Embodiment 2:
[0120] like Figure 1-Figure 4 As shown, an embodiment of the present invention provides a lung nodule segmentation method based on the MN-CDFTransUNet network model. For the LIDC-IDRI dataset, the data format is first converted, and the lung parenchyma segmentation is performed on the CT image through image processing to obtain a lung parenchyma dataset; the lung parenchyma dataset is divided into a training set and a validation set, and then a lung parenchyma segmentation algorithm based on the improved TransUNet algorithm is used for training, and the test set is input into the trained network model to obtain the recognition result of the test sample set.
[0121] The pulmonary nodule segmentation method based on the MN-CDFTransUNet network model in the embodiment of the present invention specifically includes:
[0122] Step S1: In the preprocessing part, the lung parenchyma part is first extracted through the k-means clustering method to construct a lung parenchyma dataset and reduce interference from other factors.
[0123] Step S2: Implement skip connection through multi-scale feature fusion to represent features more comprehensively.
[0124] Multi-scale feature fusion is designed to process lung nodule information at different scales in an image. Due to the diversity of lung nodules in size, shape, and location, it is often difficult to fully capture all relevant information with a single-scale feature extraction. Through multi-scale feature fusion, the model can integrate feature information at different levels, thereby enhancing the comprehensive understanding and recognition of lung nodules.
[0125] The ResNetV2 jump connection is x1 output by Block1, which is the result of the first feature transformation, with 64 channels and an image size of 256*256; x2 output by block2 is a downsample of x1, with 256 channels and an image size of 128*128; x3 output by block3 is a downsample of x2, with 1024 channels and an image size of 64*64.
[0126] The improved ResNetV2 part uses the process shown in the figure to perform multi-scale feature fusion. The x1 layer output by block1 has 64 channels and an image size of 256*256. First, the x1 layer is directly maxpooled to obtain newx1 with 64 channels and an image size of 128*128; x2 is the downsampling of x1, with 256 channels and an image size of 128*128. After the x2 layer is concatenated with the newx1 layer, a conv1 operation is performed to output is newx2, with 256 channels and an image size of 128*128; x3 is the downsampling of x2, with 1024 channels and an image size of 64*64. First, a maxpool operation is performed on newx2, and then conv2 is performed to obtain newx3', with 512 channels and an image size of 64*64. It is concatenated with the initial x3, and then a conv3 operation is performed to obtain newx3, with 512 channels and an image size of 64*64.
[0127] Step S3: Newly add SCA and SimpleGate modules to replace the original ReLU activation function in TransUNet:
[0128] TransUNet's own DecoderBlock consists of two convolutional layers and a bilinear upsampling layer, and each convolution is followed by a ReLU activation function. Although the jump connection helps to retain details, the original module directly performs convolution operations after feature fusion, and does not provide a further dynamic adjustment mechanism for the fused features. This means that features of different scales and sources may not be optimally combined and utilized. Only two simple convolutional layers may not be enough to fully extract and express high-level features in complex scenes. This simple structure may limit the performance of the model in tasks that require processing finer details or higher-level semantic information. No attention mechanism is explicitly introduced to focus on more important areas or channels in the feature map. The attention mechanism for nonlinear feature extraction can help the model focus more on key features, thereby improving overall performance.
[0129] Therefore, in the feature extraction part, a new module called NAFBlock was constructed. This module first performs a normalization operation and then performs two convolution operations, 1x1 and 3x3 convolutions. After the 3x3 convolution, it is processed through the SimpleGate gating mechanism to enhance the interaction and dynamic adjustment capabilities between features. Next, instead of using the original ReLU activation function, the feature map is recalibrated at the channel level through the simplified channel attention SCA module, so that the model can pay more attention to important channel features. Finally, another 1x1 convolution is performed to adjust the number of channels of the feature map to facilitate subsequent matching.
[0130] ①SimpleGate module:
[0131] The SimpleGate module is a very simple nonlinear gating mechanism that produces an output by splitting the input feature map x into two parts x1 and x2 along a certain dimension (in this case, the second half of the channel dimension) and then multiplying the two parts. This mechanism can be seen as a way of feature interaction that allows the network to dynamically adjust the interdependencies between features. Specifically, the result of multiplying x1 and x2 will amplify those features that are significant in both parts, while suppressing those features that are significant in one part but not in the other. The SimpleGate module is as follows Figure 5 shown.
[0132] ②Simplified Channel Attention (SCA) module:
[0133] The simplified channel attention module (SCA) generates channel attention weights through global average pooling (GAP) and subsequent 1x1 convolutional layers. GAP compresses the spatial dimensions of the input feature map so that each channel corresponds to a global feature value. Then, the 1x1 convolutional layer transforms these global feature values to generate the same number of attention weights as the number of input channels. These weights reflect the importance of different channels and can be used for subsequent feature weighting. The Simplified Channel Attention (SCA) module is as follows: Figure 6 shown.
[0134] Step S4: Addition of loss function FocalLoss:
[0135] An improved loss function combination strategy CDF-Loss is proposed, which not only retains the advantages of cross entropy loss and Dice loss, but also introduces the Focal Loss function to more finely adjust the model's learning weights for samples of different difficulty levels. Specifically, the three loss functions are weighted and fused at a weight ratio of 0.4, 0.4, and 0.2. This design aims to balance the contribution of different loss functions to model training, while highlighting the unique advantages of Focal Loss in focusing on difficult sample learning.
[0136] ①Cross entropy loss function:
[0137] The cross entropy loss function is one of the most commonly used losses for classification problems. The cross entropy loss function is calculated in the binary classification problem and its formula is expressed as:
[0138]
[0139] Among them, represents the true label of the data (Ground Truth), Represents the prediction result. For multi-classification problems, the cross entropy loss function is calculated as:
[0140]
[0141] Where N is the number of categories, y n It represents the probability that the sample belongs to the nth category.
[0142] ②Dice loss function:
[0143] The Dice loss function was first introduced in V-Net for medical image segmentation tasks to solve the serious imbalance between the number of foreground voxels and background voxels in medical images. It is the most commonly used loss function for medical image segmentation, and its value is 1 minus the Dice similarity coefficient. Assuming that A and B are two different samples, the Dice loss function formula is:
[0144]
[0145] ③Focal loss function:
[0146] The formula of Focal Loss combines the cross entropy loss and an adjustment factor that is inversely proportional to the negative logarithm of the predicted probability (i.e., the confidence of the model in the sample classification), thereby reducing the loss of easy-to-classify samples. Specifically, the formula of Focal Loss is:
[0147] testFL(p t )=-α t (1-p t ) γ log (p t );
[0148] Among them, p t is the model's predicted probability for the sample category. For a binary classification problem, if the true label of the sample is 1, then p t That is, the probability that the model predicts a positive class; if the true label of the sample is 0, then p t is 1 minus the probability that the model predicts the positive class. αt is the weight that balances the importance of each class, and (1-p t )γ is the adjustment factor, where γ≥0 is an adjustable hyperparameter used to control the degree of reduction in the weight of easy-to-classify samples. As γ increases, the effect of the adjustment factor will become more obvious, and the model's attention to easy-to-classify samples will be further reduced, thereby focusing more on the learning of difficult-to-classify samples.
[0149] The pulmonary nodule segmentation method based on the MN-CDFTransUNet network model of the embodiment of the present invention comprises: acquiring a LIDC-IDRI data set, establishing a lung parenchyma data set by K-means processing, and dividing the data set into a training set and a validation set;
[0150] The lung nodule segmentation model building unit of the improved TransUNet algorithm is designed to optimize the jump connection, feature extraction and loss function of the original TransUNet, so as to obtain an improved TransUNet lung nodule segmentation model with better performance. The present invention adopts a multi-scale feature fusion method, which not only enhances the model's sensitivity and recognition accuracy to lung nodules of different sizes, but also effectively improves the robustness of the model in dealing with complex backgrounds and nodules of diverse morphologies. The present invention also introduces a nonlinear feature extraction method, which significantly improves the model's ability to express lung nodule features and capture details by utilizing advanced nonlinear transformations in deep learning. In addition, the present invention innovatively adopts a multi-loss function fusion strategy, combining the advantages of different loss functions, to better balance the accuracy and generalization ability of the model in the lung nodule segmentation task, and ensure the accuracy and completeness of the segmentation results.
[0151] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with (but not limited to) technical features with similar functions disclosed in the present application.
[0152] Except for the technical features described in the specification, the remaining technical features are known technologies to those skilled in the art. In order to highlight the innovative features of the present invention, the remaining technical features will not be described here in detail.
Claims
1. A pulmonary nodule segmentation method based on the MN-CDFTransUNet network model, characterized in that: The following steps are involved: S1: Convert the image format of the LIDC-IDRI lung dataset; S2: Extract the lung parenchyma based on K-means and image processing; S3: establishing a pulmonary nodule segmentation dataset based on the lung parenchyma image segmented by S2, and dividing the pulmonary nodule dataset into a training set and a validation set; S4: Establishing a lung nodule segmentation model of an improved TransUNet algorithm; the improved TransUNet lung nodule segmentation model, also known as the MN-CDFTransUNet network lung nodule segmentation model, is obtained by performing multi-scale feature fusion, introducing a new module for nonlinear feature extraction, and improving the loss function for optimization on the basis of the original TransUNet algorithm; S5: Use the training set described in S3 to train the MN-CDFTransUNet network lung nodule segmentation model obtained in S4, and obtain an optimized model after training; S6: Use the validation set described in S3 to validate the MN-CDFTransUNet network lung nodule segmentation model obtained in S4; S7: Use S6 to verify the optimized model to identify lung images.
2. The pulmonary nodule segmentation method based on the MN-CDFTransUNet network model according to claim 1, characterized in that: The steps of S1 are as follows: More than 7,000 lung images were selected from the LIDC-IDRI dataset and converted from .dom format to visible .png format.
3. The pulmonary nodule segmentation method based on the MN-CDFTransUNet network model according to claim 1, characterized in that: The steps of S2 are as follows: S21: min-max normalization and standardization of the data converted from S1 to facilitate the identification of lung tissue; Traversing each pixel in the image matrix, the specific normalization operation formula is: Among them, x represents each pixel value traversed in the image, max(x) is the maximum value of the input pixel, min(x) is the minimum value of the input pixel, and x norm is the pixel value obtained after conversion. Traversing each pixel in the image matrix, the specific operation formula for standardization is: Among them, x represents each pixel value traversed in the image, mean(x) is the pixel mean of the input pixel, std(x) is the standard deviation of the input pixel, and x norm is the pixel value obtained after conversion; S22: using the K-means clustering algorithm to perform cluster analysis on the image obtained in step S21, and dividing the image into two categories: foreground and background, where the foreground is lung tissue and the background is non-lung tissue; The specific implementation steps of K-means are: S221: Select k initial cluster centers; S222: assign each data point to the nearest cluster center; Based on the Euclidean distance as the distance metric, it is expressed as: Where x is the data point, c i is the i-th cluster center, d is the data dimension, x j and c ij Represented by x and c i The value in the jth dimension; S223: re-update each cluster center; For each cluster, its cluster center is recalculated, and the new cluster center is the mean of all data points in the cluster, which is expressed as: Among them, S i is the set of i-th data points, |S i | is the number of data points in the set; S224: Iterative update; Until the distance between the new cluster center and the old cluster center is less than the set threshold or the maximum number of iterations is reached; S23: Morphological processing is used to perform erosion and dilation operations on the result after rough segmentation to remove small particle noise and fill the cavity inside the lung area, which is used as a new lung mask; S231: Morphological corrosion; When structure B corrodes structure A, it is expressed as follows: Among them, (B) xy Indicates that structure B is at (x,y), It is indicated as being completely contained in the overlapping region of structure A; S232: morphological expansion; When structure B expands structure A, it is expressed as follows: Among them, (B) xy Indicates that structure B is at (x,y), It means that the intersection with structure A is not empty; S24: The new lung mask is further processed using connected domain analysis technology. By setting appropriate connected domain parameters, irrelevant isolated areas in the image are removed while retaining the main lung connected domains.
4. The pulmonary nodule segmentation method based on the MN-CDFTransUNet network model according to claim 3, characterized in that: In step S3, the segmented lung parenchyma parts obtained in S2 are integrated. The lung nodule dataset includes 7521 images, and the images are divided into a training set, a validation set, and a test set at a ratio of 0.8, 0.15, and 0.
05.
5. The pulmonary nodule segmentation method based on the MN-CDFTransUNet network model according to claim 1, characterized in that: In step S4, the pulmonary nodule segmentation model of the improved TransUNet algorithm is established to optimize the original TransUNet algorithm. The specific steps are as follows: S4.1: Adjust the Skip Connections part in the original TransUNet algorithm, change it to multi-scale fusion to enhance the feature extraction capability, capture feature information of different scales and abstract levels through different network layers, and effectively integrate this information to enrich the model's ability to represent lung nodules, thereby improving recognition accuracy and detection performance, and completing the optimization of the original algorithm; S4.2: A module dedicated to feature enhancement is added to each stage of the decoder of the original TransUNet, which enables the model to focus on more critical spatial information and channel features, not only retaining the richness of the original features, but also promoting the effective propagation of information between different layers; S4.3: Based on the original TransUNet, the loss function is carefully optimized and Focal loss is added to the original loss function.
6. The pulmonary nodule segmentation method based on the MN-CDFTransUNet network model according to claim 5, characterized in that: In step S4.1, the direct jump connection of x1, x2, x3 output by block1, block2, block3 is changed to multi-scale fusion, and newx1, newx2, newx3 are fused to obtain the final output.
7. The pulmonary nodule segmentation method based on the MN-CDFTransUNet network model according to claim 5, characterized in that: In step S4.2, the added module for feature enhancement replaces the traditional RectifiedLinear Unit activation function with Spatial Channel Attention and SimpeGate gating mechanism. The SCA mechanism adaptively weights the features in two dimensions: space and channel.
8. The pulmonary nodule segmentation method based on the MN-CDFTransUNet network model according to claim 5, characterized in that: In step S4.3, Focal loss is weighted together with the original cross entropy loss and Dice loss as a new loss function.