Cardiac ultrasound image segmentation method based on UCT-UNet model
By adopting a UCT-UNet model-based method in the cardiac ultrasound image segmentation task, combined with the advantages of CNN and Transformer, the problem that traditional methods are difficult to capture global context information when processing cardiac ultrasound images is solved, significantly improving segmentation accuracy and robustness.
Patent Information
- Application Number
- CN202411626338.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-03-07
AI Technical Summary
The cardiac ultrasound image segmentation task faces the problems of image noise, resolution limitations and low contrast. The traditional method has strong subjectivity and obvious limitations. CNNs are difficult to capture global context information when processing cardiac ultrasound images, resulting in errors.
Using a cardiac ultrasonic image segmentation method based on the UCT-UNet model, combining the advantages of CNN and Transformer, through the design of encoder and decoder, the Transformer module is fused to capture global characteristics, and the Transformer block (UCTBlock) is used to guide the Transformer block (UCTBlock) at the decoder stage to reduce the functional overlap of local features and global information.
It significantly improves the accuracy and robustness of cardiac ultrasound image segmentation, reduces the model's error segmentation of complex structures, improves feature fusion, and improves segmentation accuracy and output quality.
Smart Images

Figure CN119579892A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image segmentation, and in particular to a cardiac ultrasound image segmentation method based on a UCT-UNet model. Background Art
[0002] Cardiovascular disease is one of the most fatal diseases worldwide. Echocardiography, as a non-invasive, real-time imaging method, plays an important role in clinical cardiac function assessment and disease diagnosis and treatment. However, cardiac ultrasound image analysis still faces challenges, such as image noise, resolution limitations, and low contrast, making ventricular and myocardial segmentation complex and difficult.
[0003] Traditional cardiac ultrasound image processing methods rely on manual feature extraction. While this approach addresses image analysis challenges to a certain extent, it suffers from strong subjectivity and significant limitations due to its overreliance on experience. With the development of deep learning, particularly convolutional neural networks (CNNs), medical image segmentation has made significant progress. CNNs can process complex image data by automatically learning features, but when processing cardiac ultrasound images, they are still limited by their local receptive field and weight sharing, making it difficult to capture global contextual information. This can lead to errors in images with complex details and structures.
[0004] In recent years, the Transformer architecture has become a research hotspot in computer vision due to its advantages in modeling global context. Unlike CNNs, Transformers can capture long-range dependencies through a self-attention mechanism, demonstrating strong performance in medical image segmentation. Models combining CNNs and Transformers have been shown to effectively improve image segmentation accuracy, particularly in the segmentation of complex cardiac structures, preserving both local details and global information.
[0005] Therefore, it is crucial to explore cardiac ultrasound image segmentation methods that combine CNN and Transformer. By combining the advantages of both, the accuracy and robustness of cardiac ultrasound image segmentation can be significantly improved, providing more accurate and reliable diagnostic support for clinical practice. Summary of the Invention
[0006] In order to overcome the shortcomings of the above technologies, the present invention provides a cardiac ultrasound image segmentation method based on the UCT-UNet model, which significantly improves the segmentation accuracy.
[0007] The technical solution adopted by the present invention to overcome the technical problems is:
[0008] A cardiac ultrasound image segmentation method based on the UCT-UNet model, comprising:
[0009] a) Obtain N cardiac ultrasound images to obtain a cardiac ultrasound image dataset X, where X = {X1, X2, ..., X i ,...,X N}, X i is the i-th cardiac ultrasound image, i∈{1,...,N}; b) the i-th cardiac ultrasound image X i Perform preprocessing to obtain the preprocessed cardiac ultrasound image L i , all N pre-processed cardiac ultrasound images constitute a pre-processed cardiac ultrasound image dataset L, L = {L1, L2, ..., L i ,...,L N};
[0010] c) dividing the preprocessed cardiac ultrasound image dataset L into a training set, a validation set, and a test set;
[0011] d) Establish a UCT-UNet model consisting of an encoder and a decoder;
[0012] e) The i-th preprocessed cardiac ultrasound image L in the training set i Input into the encoder of the UCT-UNet model and output the feature map
[0013] f) The feature map Input into the decoder of the UCT-UNet model and output the segmented image
[0014] g) Calculate the total loss L total , through the total loss L total Train the UCT-UNet model to obtain the optimized UCT-UNet model;
[0015] h) Take the jth preprocessed cardiac ultrasound image L in the test set j Input into the optimized UCT-UNet model and output the predicted segmentation image Furthermore, in step a), N cardiac ultrasound images are obtained from the CAMUS cardiac segmentation ultrasound image dataset, where N is 500.
[0016] Furthermore, step b) comprises the following steps:
[0017] b-1) Use the center_crop() function in OpenCV to crop the i-th cardiac ultrasound image X i Perform a center detection operation of size 256×256 to obtain the i-th cardiac ultrasound image X after cropping i ';
[0018] b-2) The i-th cardiac ultrasound image X i ' Perform z-score standardization operation to obtain the preprocessed cardiac ultrasound image L i .
[0019] Furthermore, in step c), the preprocessed cardiac ultrasound image dataset L is divided into a training set, a validation set, and a test set in a ratio of 6:2:2.
[0020] Furthermore, step e) comprises the following steps:
[0021] e-1) The encoder of the UCT-UNet model consists of the first double convolution block, the first Transformer block, the first maximum pooling layer, the second double convolution block, the second Transformer block, the second maximum pooling layer, the third double convolution block, the third Transformer block, the third maximum pooling layer, the fourth double convolution block, the fourth Transformer block, and the fourth maximum pooling layer;
[0022] e-2) The first biconvolutional block of the encoder consists of the first convolutional layer, the first BN layer, the first ReLU activation function, the second convolutional layer, the second BN layer, and the second ReLU activation function. The i-th preprocessed cardiac ultrasound image L in the training set is i It is sequentially input into the first convolutional layer, the first BN layer, and the first ReLU activation function of the first double convolutional block, and the feature map is output. The feature map It is sequentially input into the second convolution layer, the second BN layer, and the second ReLU activation function of the first double convolution block, and the feature map is output. The feature map With feature map Perform splicing operation to obtain feature map e-3) The first Transformer block of the encoder consists of the patch embedding block of the transformer model, the first LN layer, the multi-head self-attention block MSA of the transformer model, the second LN layer, and the multi-layer perceptron MLP. Input into the patch embedding block of the first Transformer block and output the feature map The feature map It is sequentially input into the first LN layer of the first Transformer block and the multi-head self-attention block MSA of the first Transformer block, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map The feature map Input into the second LN layer of the first Transformer block and the multi-layer perceptron MLP in sequence, and output the feature map The feature map With feature map Perform addition operation to obtain feature map e-4) The feature map Input to the first maximum pooling layer of the encoder and output the feature map e-5) The second dual convolution block of the encoder consists of the first convolution layer, the first BN layer, the first ReLU activation function, the second convolution layer, the second BN layer, and the second ReLU activation function. It is sequentially input into the first convolutional layer, the first BN layer, and the first ReLU activation function of the second double convolutional block, and the feature map is output. The feature map The output is the second convolutional layer, the second BN layer, and the second ReLU activation function of the second double convolutional block, and the feature map is obtained. The feature map With feature map Perform splicing operation to obtain feature map e-6) The second Transformer block of the encoder consists of the patch embedding block of the transformer model, the first LN layer, the multi-head self-attention block MSA of the transformer model, the second LN layer, and the multi-layer perceptron MLP. Input to the patch embedding block of the second Transformer block, and output the feature map The feature map It is sequentially input into the first LN layer of the first Transformer block of the second Transformer block and the multi-head self-attention block MSA, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map The feature map Input into the second LN layer of the second Transformer block and the multi-layer perceptron MLP in sequence, and output the feature map The feature map With feature map Perform addition operation to obtain feature map e-7) The feature map Input to the second maximum pooling layer of the encoder and output the feature map e-8) The third double convolution block of the encoder consists of the first convolution layer, the first BN layer, the first ReLU activation function, the second convolution layer, the second BN layer, and the second ReLU activation function. It is sequentially input into the first convolution layer, the first BN layer, and the first ReLU activation function of the third double convolution block, and the feature map is output. The feature map The output is sequentially input into the second convolution layer, the second BN layer, and the second ReLU activation function of the third double convolution block, and the feature map is output. The feature map With feature map Perform splicing operation to obtain feature map e-9) The third Transformer block of the encoder consists of the patch embedding block of the transformer model, the first LN layer, the multi-head self-attention block MSA of the transformer model, the second LN layer, and the multi-layer perceptron MLP. Input to the patch embedding block of the third Transformer block, and output the feature map The feature map It is sequentially input into the first LN layer of the first Transformer block of the third Transformer block and the multi-head self-attention block MSA, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map The feature map It is input into the second LN layer and the multi-layer perceptron MLP of the third Transformer block in sequence, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map e-10) The feature map Input to the third maximum pooling layer of the encoder and output the feature map e-11) The fourth dual convolution block of the encoder consists of the first convolution layer, the first BN layer, the first ReLU activation function, the second convolution layer, the second BN layer, and the second ReLU activation function. It is sequentially input into the first convolution layer, the first BN layer, and the first ReLU activation function of the fourth double convolution block, and the output is the feature map. The feature map The output is sequentially input into the second convolutional layer, the second BN layer, and the second ReLU activation function of the fourth double convolutional block, and the feature map is output. The feature map With feature map Perform splicing operation to obtain feature map e-12) The fourth Transformer block of the encoder consists of the patch embedding block of the transformer model, the first LN layer, the multi-head self-attention block MSA of the transformer model, the second LN layer, and the multi-layer perceptron MLP. Input to the patch embedding block of the fourth Transformer block, and output the feature map The feature map It is sequentially input into the first LN layer of the first Transformer block of the fourth Transformer block and the multi-head self-attention block MSA, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map The feature map Input into the second LN layer and the multi-layer perceptron MLP of the fourth Transformer block in sequence, and output the feature map The feature map With feature map Perform addition operation to obtain feature map e-13) The feature map Input to the fourth maximum pooling layer of the encoder and output the feature map Preferably, in step e-2), the convolution kernel size of the first convolution layer and the second convolution layer of the first double convolution block are both 3×3, the padding is 1, and the step size is 1; the convolution kernel size of the first maximum pooling layer in step e-4) is 2×2; the convolution kernel size of the first convolution layer and the second convolution layer of the second double convolution block in step e-5) are both 3×3, the padding is 1, and the step size is 1; the convolution kernel size of the second maximum pooling layer in step e-7) is 2×2; the convolution kernel size of the first convolution layer and the second convolution layer of the third double convolution block in step e-8) are both 3×3, the padding is 1, and the step size is 1; the convolution kernel size of the third maximum pooling layer in step e-10) is 2×2; the convolution kernel size of the first convolution layer and the second convolution layer of the fourth double convolution block in step e-11) are both 3×3, the padding is 1, and the step size is 1; the convolution kernel size of the fourth maximum pooling layer in step e-13) is 2×2.
[0023] Further, step f) comprises the following steps:
[0024] f-1) The decoder of the UCT-UNet model consists of a first upsampling layer, a first feature extraction module FEM, a first uncertainty guided Transformer block UCTBlock, a second feature extraction module FEM, a second upsampling layer, a second uncertainty guided Transformer block UCTBlock, a third feature extraction module FEM, a third upsampling layer, a third uncertainty guided Transformer block UCTBlock, a fourth feature extraction module FEM, a fourth upsampling layer, a fourth uncertainty guided Transformer block UCTBlock, and a convolutional layer; f-2) The feature map is converted into Input to the first upsampling layer of the decoder and output the feature map f-3) The first feature extraction module FEM of the decoder consists of a convolutional layer, a first reshape function, a transpose function, a softmax function, a second reshape function, an average pooling layer, a fully connected layer, and a Sigmoid function. Input into the convolution layer of the first feature extraction module FEM, and output the feature map The feature map Input into the first reshape function and transpose function of the first feature extraction module FEM in sequence, and output the feature map The feature map Input into the first reshape function of the first feature extraction module FEM, and output the feature map The feature map With feature map After the multiplication operation, it is input into the softmax function of the first feature extraction module FEM, and the output is the feature map The feature map Input it into the second reshape function of the feature extraction module FEM, and output the feature map The feature map With feature map Perform multiplication operation to obtain feature map The feature map With feature map Perform addition operation to obtain feature map The feature map Input into the average pooling layer, fully connected layer, and Sigmoid function of the first feature extraction module FEM in sequence, and output the feature map The feature map With feature map Perform addition operation to obtain feature map f-4) The first uncertainty guided Transformer block UCTBlock of the decoder is composed of a convolution unit, a triplet of the Transformer model, a softmax function layer, and a reshape function layer. The convolution unit is composed of a convolution layer, a BatchNorm layer, and a Gelu activation function in turn. The feature map With feature map After the accumulation operation, it is input into the convolution unit of the first uncertainty guided Transformer block UCTBlock, and the output is the feature map The feature map The triplet input to the first uncertainty guided Transformer block UCTBlock is multiplied by the query vector and the key vector to obtain the feature map The feature map Input into the softmax function layer and reshape function layer of the first uncertainty guided Transformer block UCTBlock in sequence, and output the feature map The feature map With feature map Perform multiplication operation to obtain feature map The feature map The value vector and feature map are used in the triplet input to the first uncertainty guided Transformer block UCTBlock Perform multiplication operation to obtain feature map f-5) The second feature extraction module FEM of the decoder consists of a convolutional layer, a first reshape function, a transpose function, a softmax function, a second reshape function, an average pooling layer, a fully connected layer, and a Sigmoid function. Input into the convolution layer of the second feature extraction module FEM, and output the feature map The feature map Input into the first reshape function and transpose function of the second feature extraction module FEM in sequence, and output the feature map The feature map Input into the first reshape function of the second feature extraction module FEM, and output the feature map The feature map With feature map After the multiplication operation, it is input into the softmax function of the second feature extraction module FEM, and the output is the feature map The feature map Input into the second reshape function of the second feature extraction module FEM, and output the feature map The feature map With feature map Perform multiplication operation to obtain feature map The feature map With feature map Perform addition operation to obtain feature map The feature map The average pooling layer, fully connected layer, and Sigmoid function of the second feature extraction module FEM are input in sequence to output the feature map. The feature map With feature map Perform addition operation to obtain feature map f-6) The feature map With feature map After the addition operation, it is input into the second upsampling layer of the decoder and the output is the feature map f-7) The second uncertainty guided Transformer block UCTBlock of the decoder is composed of a convolution unit, a triplet of the Transformer model, a softmax function layer, and a reshape function layer. The convolution unit is composed of a convolution layer, a BatchNorm layer, and a Gelu activation function in turn. Input into the convolution unit of the second uncertainty guided Transformer block UCTBlock, and output the feature map The feature map The Query vector and the Key vector are multiplied in the triple input to the second uncertainty guided Transformer block UCTBlock to obtain the feature map The feature map Input into the softmax function layer and reshape function layer of the second uncertainty guided Transformer block UCTBlock in sequence, and output the feature map The feature map With feature map Perform multiplication operation to obtain feature map The feature map The value vector and feature map are used in the triplet input to the second uncertainty guided Transformer block UCTBlock Perform multiplication operation to obtain feature map f-8) The third feature extraction module FEM of the decoder consists of a convolutional layer, a first reshape function, a transpose function, a softmax function, a second reshape function, an average pooling layer, a fully connected layer, and a Sigmoid function. Input into the convolution layer of the third feature extraction module FEM, and output the feature map The feature map Input into the first reshape function and transpose function of the third feature extraction module FEM in sequence, and output the feature map The feature map Input into the first reshape function of the third feature extraction module FEM, and output the feature map The feature map With feature map After the multiplication operation, it is input into the softmax function of the third feature extraction module FEM, and the output is the feature map The feature map Input into the second reshape function of the third feature extraction module FEM, and output the feature map The feature map With feature map Perform multiplication operation to obtain feature map The feature map With feature map Perform addition operation to obtain feature map The feature map The average pooling layer, fully connected layer, and Sigmoid function of the third feature extraction module FEM are input in sequence to output the feature map. The feature map With feature map Perform addition operation to obtain feature map f-9) The feature map With feature map After the addition operation, it is input into the third upsampling layer of the decoder and the output is the feature map f-10) The third uncertainty guided Transformer block UCTBlock of the decoder is composed of a convolution unit, a triplet of the Transformer model, a softmax function layer, and a reshape function layer. The convolution unit is composed of a convolution layer, a BatchNorm layer, and a Gelu activation function in turn. Input into the convolution unit of the third uncertainty guided Transformer block UCTBlock, and output the feature map The feature map The Query vector and the Key vector are multiplied in the triple input to the third uncertainty guided Transformer block UCTBlock to obtain the feature map The feature map Input into the softmax function layer and reshape function layer of the third uncertainty guided Transformer block UCTBlock in sequence, and output the feature map The feature map With feature map Perform multiplication operation to obtain feature map The feature map The Value vector and feature map are used in the triplet input to the third uncertainty guided Transformer block UCTBlock Perform multiplication operation to obtain feature map f-11) The fourth feature extraction module FEM of the decoder consists of a convolutional layer, a first reshape function, a transpose function, a softmax function, a second reshape function, an average pooling layer, a fully connected layer, and a Sigmoid function. Input into the convolution layer of the fourth feature extraction module FEM, and output the feature map The feature map Input into the first reshape function and transpose function of the fourth feature extraction module FEM in sequence, and output the feature map The feature map Input into the first reshape function of the fourth feature extraction module FEM, and output the feature map The feature map With feature map After the multiplication operation, it is input into the softmax function of the fourth feature extraction module FEM, and the output is the feature map The feature map Input it into the second reshape function of the fourth feature extraction module FEM, and output the feature map The feature map With feature map Perform multiplication operation to obtain feature map The feature map With feature map Perform addition operation to obtain feature map The feature map The average pooling layer, fully connected layer, and Sigmoid function of the fourth feature extraction module FEM are input in sequence to output the feature map. The feature map With feature map Perform addition operation to obtain feature map f-12) The feature map With feature map After the addition operation, it is input into the fourth upsampling layer of the decoder and the output is the feature map f-13) The fourth uncertainty guided Transformer block UCTBlock of the decoder is composed of a convolution unit, a triplet of the Transformer model, a softmax function layer, and a reshape function layer. The convolution unit is composed of a convolution layer, a BatchNorm layer, and a Gelu activation function in turn. Input into the convolution unit of the fourth uncertainty guided Transformer block UCTBlock, and output the feature map The feature map The Query vector and the Key vector are multiplied in the triple input to the fourth uncertainty guided Transformer block UCTBlock to obtain the feature map The feature map Input into the softmax function layer and reshape function layer of the fourth uncertainty guided Transformer block UCTBlock in sequence, and output the feature map The feature map With feature map Perform multiplication operation to obtain feature map The feature map The value vector and feature map are used in the triplet input to the fourth uncertainty guided Transformer block UCTBlock Perform multiplication operation to obtain feature map f-14) The feature map Input into the convolution layer of the decoder and output the segmented image Preferably, in step f-2), the convolution kernel size of the first upsampling layer of the decoder is 2×2; in step f-3), the convolution kernel size of the convolution layer of the first feature extraction module FEM is 3×3, the step size is 1, and the padding is 1; in step f-4), the convolution kernel size of the convolution layer of the convolution unit of the first uncertainty guided Transformer block UCTBlock is 3×3, the step size is 1, and the padding is 1; in step f-5), the convolution kernel size of the convolution layer of the second feature extraction module FEM is 3×3, the step size is 1, and the padding is 1; in step f-6), the convolution kernel size of the first upsampling layer of the decoder is 2×2; in step f-7), the convolution kernel size of the convolution layer of the convolution unit of the second uncertainty guided Transformer block UCTBlock is 3×3, the step size is 1, and the padding is 1; in step f-8), the third feature extraction module FEM The convolution kernel size of the convolution layer of the decoder is 3×3, the stride is 1, and the padding is 1; the convolution kernel size of the third upsampling layer of the decoder in step f-9) is 2×2; the convolution kernel size of the convolution layer of the convolution unit of the third uncertainty guided Transformer block UCTBlock in step f-10) is 3×3, the stride is 1, and the padding is 1; the convolution kernel size of the convolution layer of the fourth feature extraction module FEM in step f-11) is 3×3, the stride is 1, and the padding is 1; the convolution kernel size of the fourth upsampling layer of the decoder in step f-12) is 2×2; the convolution kernel size of the convolution layer of the convolution unit of the fourth uncertainty guided Transformer block UCTBlock in step f-13) is 3×3, the stride is 1, and the padding is 1; the convolution kernel size of the convolution layer of the decoder in step f-14) is 1×1, the stride is 1, and the padding is 0.
[0025] Further, step g) comprises the following steps:
[0026] g-1) by formula L total =L Dice +ωL CE Calculate the total loss L total , where L Dice is the Dice loss, L CE is the cross entropy loss, ω is a hyperparameter;
[0027] g-2) Use Adam optimizer to use the total loss L total Train the UCT-UNet model to obtain the optimized UCT-UNet model.
[0028] Preferably, when training the UCT-UNet model, the initial learning rate is 0.001, the batch size is set to 32, the epoch is set to 200, the learning rate lr is 0.001, and the hyperparameter ω is set to 0.05.
[0029] The beneficial effects of the present invention are: the Transformer module is integrated on the unit layer of the encoder, and the global characteristics of the Transformer and the local feature advantages of the convolution are utilized to capture detailed information. The decoder stage uses the uncertainty-guided Transformer block (UCTBlock) to focus on guiding the model to pay attention to areas that are difficult for CNN to accurately segment through uncertainty estimation, thereby establishing global dependencies and reducing the functional overlap between local features and global information. This approach effectively avoids the model's incorrect segmentation of complex structures, improves feature fusion, and improves the accuracy of segmentation. In addition, by adding a feature extraction module FEM to each jump connection, the feature extraction capability is enhanced, the output quality of the model is further improved, and ultimately the segmentation performance of cardiac ultrasound images is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 It is a structural diagram of the UCT-UNet model of the present invention;
[0031] Figure 2 This is a structural diagram of the feature extraction module FEM of the present invention;
[0032] Figure 3 This is a structural diagram of the uncertainty guided Transformer block UCTBlock of the present invention;
[0033] Figure 4 This is a comparison diagram of the experimental visualization of the present invention. DETAILED DESCRIPTION
[0034] The following is combined with Figure 1 , Attachment Figure 2 , Attachment Figure 3 , Attachment Figure 4 The present invention is further described.
[0035] A cardiac ultrasound image segmentation method based on the UCT-UNet model, comprising:
[0036] a) Obtain N cardiac ultrasound images to obtain a cardiac ultrasound image dataset X, where X = {X1, X2, ..., X i ,...,X N}, X i is the i-th cardiac ultrasound image, i∈{1,...,N}. b) The i-th cardiac ultrasound image X i Perform preprocessing to obtain the preprocessed cardiac ultrasound image L i , all N pre-processed cardiac ultrasound images constitute a pre-processed cardiac ultrasound image dataset L, L = {L1, L2, ..., L i ,...,L N}.
[0037] c) Divide the preprocessed cardiac ultrasound image dataset L into a training set, a validation set, and a test set.
[0038] d) Establish a UCT-UNet model consisting of an encoder and a decoder.
[0039] e) The i-th preprocessed cardiac ultrasound image L in the training set i Input into the encoder of the UCT-UNet model and output the feature map
[0040] f) The feature map Input into the decoder of the UCT-UNet model and output the segmented image
[0041] g) Calculate the total loss L total , through the total loss L total Train the UCT-UNet model to obtain the optimized UCT-UNet model.
[0042] h) Take the jth preprocessed cardiac ultrasound image L in the test set j Input into the optimized UCT-UNet model and output the predicted segmentation image In order to verify the reliability of this patented method, the final predicted segmentation image A systematic evaluation is conducted and compared with existing deep learning segmentation methods, as shown in Table 1:
[0043] Table 1 Comparison of different experimental methods
[0044]
[0045] The experimental method in Table 1 compares a variety of classic segmentation methods, namely U-Net, SegNet, MedSAM, and SAMed. Each method segments the CAMUS cardiac segmentation ultrasound image dataset, and uses the Dice coefficient and Hausdorff distance as two evaluation indicators to statistically analyze the accuracy of segmenting the left atrium, left ventricle, and myocardium. The lower the Hausdorff distance score, the better the performance. It can be seen from the data in Table 1 that the average Dice evaluation index of the method of the present invention is improved by 2.9% compared with the previous optimal method, and the average Hausdorff distance evaluation index is improved by 1.98% compared with the previous optimal method. Both are better than the previous methods, indicating that the method of the present invention has certain advantages, and the segmentation effect is relatively ideal, especially in the myocardial part. More significant improvement. Appendix Figure 4The following figure shows the segmentation results of the left atrium, left ventricle, and myocardium in a CAMUS cardiac ultrasound image. (a) represents the original input image, (b) and (c) represent the expert-annotated image corresponding to the image to be segmented and the predicted segmentation result of our method, respectively. As can be seen, our method can accurately segment the ventricles, atria, and myocardium from ultrasound images, with predictions close to those obtained by expert manual segmentation, demonstrating high performance in cardiac image segmentation tasks.
[0046] In one embodiment of the present invention, in step a), N cardiac ultrasound images are acquired from the CAMUS cardiac segmentation ultrasound image dataset, where N is 500.
[0047] In one embodiment of the present invention, step b) comprises the following steps:
[0048] b-1) Use the center_crop() function in OpenCV to crop the i-th cardiac ultrasound image X i Perform a center detection operation of size 256×256 to obtain the i-th cardiac ultrasound image X after cropping i ′.
[0049] b-2) The i-th cardiac ultrasound image X i ' Perform z-score standardization operation to obtain the preprocessed cardiac ultrasound image L i .
[0050] In one embodiment of the present invention, in step c), the preprocessed cardiac ultrasound image dataset L is divided into a training set, a validation set, and a test set in a ratio of 6:2:2.
[0051] In one embodiment of the present invention, step e) comprises the following steps:
[0052] e-1) The encoder of the UCT-UNet model consists of the first double convolution block, the first Transformer block, the first maximum pooling layer, the second double convolution block, the second Transformer block, the second maximum pooling layer, the third double convolution block, the third Transformer block, the third maximum pooling layer, the fourth double convolution block, the fourth Transformer block, and the fourth maximum pooling layer.
[0053] e-2) The first biconvolutional block of the encoder consists of the first convolutional layer, the first BN layer, the first ReLU activation function, the second convolutional layer, the second BN layer, and the second ReLU activation function. The i-th preprocessed cardiac ultrasound image L in the training set is i It is sequentially input into the first convolutional layer, the first BN layer, and the first ReLU activation function of the first double convolutional block, and the feature map is output. The feature map It is sequentially input into the second convolution layer, the second BN layer, and the second ReLU activation function of the first double convolution block, and the feature map is output. The feature map With feature map Perform splicing operation to obtain feature map e-3) The first Transformer block of the encoder consists of the patch embedding block of the transformer model, the first LN layer, the multi-head self-attention block MSA of the transformer model, the second LN layer, and the multi-layer perceptron MLP. Input into the patch embedding block of the first Transformer block and output the feature map The feature map It is sequentially input into the first LN layer of the first Transformer block and the multi-head self-attention block MSA of the first Transformer block, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map The feature map Input into the second LN layer of the first Transformer block and the multi-layer perceptron MLP in sequence, and output the feature map The feature map With feature map Perform addition operation to obtain feature map e-4) The feature map Input to the first maximum pooling layer of the encoder and output the feature map e-5) The second dual convolution block of the encoder consists of the first convolution layer, the first BN layer, the first ReLU activation function, the second convolution layer, the second BN layer, and the second ReLU activation function. It is sequentially input into the first convolutional layer, the first BN layer, and the first ReLU activation function of the second double convolutional block, and the feature map is output. The feature map The output is the second convolutional layer, the second BN layer, and the second ReLU activation function of the second double convolutional block, and the feature map is obtained. The feature map With feature map Perform splicing operation to obtain feature map e-6) The second Transformer block of the encoder consists of the patch embedding block of the transformer model, the first LN layer, the multi-head self-attention block MSA of the transformer model, the second LN layer, and the multi-layer perceptron MLP. Input to the patch embedding block of the second Transformer block, and output the feature map The feature map It is sequentially input into the first LN layer of the first Transformer block of the second Transformer block and the multi-head self-attention block MSA, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map The feature map Input into the second LN layer of the second Transformer block and the multi-layer perceptron MLP in sequence, and output the feature map The feature map With feature map Perform addition operation to obtain feature map e-7) The feature map Input to the second maximum pooling layer of the encoder and output the feature map e-8) The third double convolution block of the encoder consists of the first convolution layer, the first BN layer, the first ReLU activation function, the second convolution layer, the second BN layer, and the second ReLU activation function. It is sequentially input into the first convolution layer, the first BN layer, and the first ReLU activation function of the third double convolution block, and the feature map is output. The feature map The output is sequentially input into the second convolution layer, the second BN layer, and the second ReLU activation function of the third double convolution block, and the feature map is output. The feature map With feature map Perform splicing operation to obtain feature map e-9) The third Transformer block of the encoder consists of the patch embedding block of the transformer model, the first LN layer, the multi-head self-attention block MSA of the transformer model, the second LN layer, and the multi-layer perceptron MLP. Input to the patch embedding block of the third Transformer block, and output the feature map The feature map It is sequentially input into the first LN layer of the first Transformer block of the third Transformer block and the multi-head self-attention block MSA, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map The feature map It is input into the second LN layer and the multi-layer perceptron MLP of the third Transformer block in sequence, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map e-10) The feature map Input to the third maximum pooling layer of the encoder and output the feature map e-11) The fourth dual convolution block of the encoder consists of the first convolution layer, the first BN layer, the first ReLU activation function, the second convolution layer, the second BN layer, and the second ReLU activation function. It is sequentially input into the first convolution layer, the first BN layer, and the first ReLU activation function of the fourth double convolution block, and the output is the feature map. The feature map The output is sequentially input into the second convolutional layer, the second BN layer, and the second ReLU activation function of the fourth double convolutional block, and the feature map is output. The feature map With feature map Perform splicing operation to obtain feature map e-12) The fourth Transformer block of the encoder consists of the patch embedding block of the transformer model, the first LN layer, the multi-head self-attention block MSA of the transformer model, the second LN layer, and the multi-layer perceptron MLP. Input to the patch embedding block of the fourth Transformer block, and output the feature map The feature map It is sequentially input into the first LN layer of the first Transformer block of the fourth Transformer block and the multi-head self-attention block MSA, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map The feature map Input into the second LN layer and the multi-layer perceptron MLP of the fourth Transformer block in sequence, and output the feature map The feature map With feature map Perform addition operation to obtain feature map e-13) The feature map Input to the fourth maximum pooling layer of the encoder and output the feature map In this embodiment, preferably, in step e-2), the convolution kernel size of the first convolution layer and the second convolution layer of the first double convolution block are both 3×3, the padding is 1, and the step size is 1; the convolution kernel size of the first maximum pooling layer in step e-4) is 2×2; the convolution kernel size of the first convolution layer and the second convolution layer of the second double convolution block in step e-5) are both 3×3, the padding is 1, and the step size is 1; the convolution kernel size of the second maximum pooling layer in step e-7) is 2×2; the convolution kernel size of the first convolution layer and the second convolution layer of the third double convolution block in step e-8) are both 3×3, the padding is 1, and the step size is 1; the convolution kernel size of the third maximum pooling layer in step e-10) is 2×2; the convolution kernel size of the first convolution layer and the second convolution layer of the fourth double convolution block in step e-11) are both 3×3, the padding is 1, and the step size is 1; the convolution kernel size of the fourth maximum pooling layer in step e-13) is 2×2.
[0054] In one embodiment of the present invention, step f) comprises the following steps:
[0055] f-1) The decoder of the UCT-UNet model consists of a first upsampling layer, a first feature extraction module FEM, a first uncertainty guided Transformer block UCTBlock, a second feature extraction module FEM, a second upsampling layer, a second uncertainty guided Transformer block UCTBlock, a third feature extraction module FEM, a third upsampling layer, a third uncertainty guided Transformer block UCTBlock, a fourth feature extraction module FEM, a fourth upsampling layer, a fourth uncertainty guided Transformer block UCTBlock, and a convolutional layer.
[0056] f-2) The feature map Input to the first upsampling layer of the decoder and output the feature map f-3) The first feature extraction module FEM of the decoder consists of a convolutional layer, a first reshape function, a transpose function, a softmax function, a second reshape function, an average pooling layer, a fully connected layer, and a Sigmoid function. Input into the convolution layer of the first feature extraction module FEM, and output the feature map The feature map Input into the first reshape function and transpose function of the first feature extraction module FEM in sequence, and output the feature map The feature map Input into the first reshape function of the first feature extraction module FEM, and output the feature map The feature map With feature map After the multiplication operation, it is input into the softmax function of the first feature extraction module FEM, and the output is the feature map The feature map Input it into the second reshape function of the feature extraction module FEM, and output the feature map The feature map With feature map Perform multiplication operation to obtain feature map The feature map With feature map Perform addition operation to obtain feature map The feature map Input into the average pooling layer, fully connected layer, and Sigmoid function of the first feature extraction module FEM in sequence, and output the feature map The feature map With feature map Perform addition operation to obtain feature map f-4) The first uncertainty guided Transformer block UCTBlock of the decoder is composed of a convolution unit, a triplet of the Transformer model, a softmax function layer, and a reshape function layer. The convolution unit is composed of a convolution layer, a BatchNorm layer, and a Gelu activation function in turn. The feature map With feature map After the accumulation operation, it is input into the convolution unit of the first uncertainty guided Transformer block UCTBlock, and the output is the feature map The feature map The triplet input to the first uncertainty guided Transformer block UCTBlock is multiplied by the query vector and the key vector to obtain the feature map The feature map Input into the softmax function layer and reshape function layer of the first uncertainty guided Transformer block UCTBlock in sequence, and output the feature map The feature map With feature map Perform multiplication operation to obtain feature map The feature map The value vector and feature map are used in the triplet input to the first uncertainty guided Transformer block UCTBlock Perform multiplication operation to obtain feature map f-5) The second feature extraction module FEM of the decoder consists of a convolutional layer, a first reshape function, a transpose function, a softmax function, a second reshape function, an average pooling layer, a fully connected layer, and a Sigmoid function. Input into the convolution layer of the second feature extraction module FEM, and output the feature map The feature map Input into the first reshape function and transpose function of the second feature extraction module FEM in sequence, and output the feature map The feature map Input into the first reshape function of the second feature extraction module FEM, and output the feature map The feature map With feature map After the multiplication operation, it is input into the softmax function of the second feature extraction module FEM, and the output is the feature map The feature map Input into the second reshape function of the second feature extraction module FEM, and output the feature map The feature map With feature map Perform multiplication operation to obtain feature map The feature map With feature map Perform addition operation to obtain feature map The feature map The average pooling layer, fully connected layer, and Sigmoid function of the second feature extraction module FEM are input in sequence to output the feature map. The feature map With feature map Perform addition operation to obtain feature map f-6) The feature map With feature map After the addition operation, it is input into the second upsampling layer of the decoder and the output is the feature map f-7) The second uncertainty guided Transformer block UCTBlock of the decoder is composed of a convolution unit, a triplet of the Transformer model, a softmax function layer, and a reshape function layer. The convolution unit is composed of a convolution layer, a BatchNorm layer, and a Gelu activation function in turn. Input into the convolution unit of the second uncertainty guided Transformer block UCTBlock, and output the feature map The feature map The Query vector and the Key vector are multiplied in the triple input to the second uncertainty guided Transformer block UCTBlock to obtain the feature map The feature map Input into the softmax function layer and reshape function layer of the second uncertainty guided Transformer block UCTBlock in sequence, and output the feature map The feature map With feature map Perform multiplication operation to obtain feature map The feature map The value vector and feature map are used in the triplet input to the second uncertainty guided Transformer block UCTBlock Perform multiplication operation to obtain feature map f-8) The third feature extraction module FEM of the decoder consists of a convolutional layer, a first reshape function, a transpose function, a softmax function, a second reshape function, an average pooling layer, a fully connected layer, and a Sigmoid function. Input into the convolution layer of the third feature extraction module FEM, and output the feature map The feature map Input into the first reshape function and transpose function of the third feature extraction module FEM in sequence, and output the feature map The feature map Input into the first reshape function of the third feature extraction module FEM, and output the feature map The feature map With feature map After the multiplication operation, it is input into the softmax function of the third feature extraction module FEM, and the output is the feature map The feature map Input into the second reshape function of the third feature extraction module FEM, and output the feature map The feature map With feature map Perform multiplication operation to obtain feature map The feature map With feature map Perform addition operation to obtain feature map The feature map The average pooling layer, fully connected layer, and Sigmoid function of the third feature extraction module FEM are input in sequence to output the feature map. The feature map With feature map Perform addition operation to obtain feature map f-9) The feature map With feature map After the addition operation, it is input into the third upsampling layer of the decoder and the output is the feature map f-10) The third uncertainty guided Transformer block UCTBlock of the decoder is composed of a convolution unit, a triplet of the Transformer model, a softmax function layer, and a reshape function layer. The convolution unit is composed of a convolution layer, a BatchNorm layer, and a Gelu activation function in turn. Input into the convolution unit of the third uncertainty guided Transformer block UCTBlock, and output the feature map The feature map The Query vector and the Key vector are multiplied in the triple input to the third uncertainty guided Transformer block UCTBlock to obtain the feature map The feature map Input into the softmax function layer and reshape function layer of the third uncertainty guided Transformer block UCTBlock in sequence, and output the feature map The feature map With feature map Perform multiplication operation to obtain feature map The feature map The Value vector and feature map are used in the triplet input to the third uncertainty guided Transformer block UCTBlock Perform multiplication operation to obtain feature map f-11) The fourth feature extraction module FEM of the decoder consists of a convolutional layer, a first reshape function, a transpose function, a softmax function, a second reshape function, an average pooling layer, a fully connected layer, and a Sigmoid function. Input into the convolution layer of the fourth feature extraction module FEM, and output the feature map The feature map Input into the first reshape function and transpose function of the fourth feature extraction module FEM in sequence, and output the feature map The feature map Input into the first reshape function of the fourth feature extraction module FEM, and output the feature map The feature map With feature map After the multiplication operation, it is input into the softmax function of the fourth feature extraction module FEM, and the output is the feature map The feature map Input it into the second reshape function of the fourth feature extraction module FEM, and output the feature map The feature map With feature map Perform multiplication operation to obtain feature map The feature map With feature map Perform addition operation to obtain feature map The feature map The average pooling layer, fully connected layer, and Sigmoid function of the fourth feature extraction module FEM are input in sequence to output the feature map. The feature map With feature map Perform addition operation to obtain feature map f-12) The feature map With feature map After the addition operation, it is input into the fourth upsampling layer of the decoder and the output is the feature map f-13) The fourth uncertainty guided Transformer block UCTBlock of the decoder is composed of a convolution unit, a triplet of the Transformer model, a softmax function layer, and a reshape function layer. The convolution unit is composed of a convolution layer, a BatchNorm layer, and a Gelu activation function in turn. Input into the convolution unit of the fourth uncertainty guided Transformer block UCTBlock, and output the feature map The feature map The Query vector and the Key vector are multiplied in the triple input to the fourth uncertainty guided Transformer block UCTBlock to obtain the feature map The feature map Input into the softmax function layer and reshape function layer of the fourth uncertainty guided Transformer block UCTBlock in sequence, and output the feature map The feature map With feature map Perform multiplication operation to obtain feature map The feature map The value vector and feature map are used in the triplet input to the fourth uncertainty guided Transformer block UCTBlock Perform multiplication operation to obtain feature map f-14) The feature map Input into the convolution layer of the decoder and output the segmented image In this embodiment, preferably, in step f-2), the convolution kernel size of the first upsampling layer of the decoder is 2×2; in step f-3), the convolution kernel size of the convolution layer of the first feature extraction module FEM is 3×3, the step size is 1, and the padding is 1; in step f-4), the convolution kernel size of the convolution layer of the convolution unit of the first uncertainty guided Transformer block UCTBlock is 3×3, the step size is 1, and the padding is 1; in step f-5), the convolution kernel size of the convolution layer of the second feature extraction module FEM is 3×3, the step size is 1, and the padding is 1; in step f-6), the convolution kernel size of the first upsampling layer of the decoder is 2×2; in step f-7), the convolution kernel size of the convolution layer of the convolution unit of the second uncertainty guided Transformer block UCTBlock is 3×3, the step size is 1, and the padding is 1; in step f-8), the convolution kernel size of the convolution layer of the third feature extraction module The convolution kernel size of the convolution layer of the block FEM is 3×3, with a stride of 1 and a padding of 1; the convolution kernel size of the third upsampling layer of the decoder in step f-9) is 2×2; the convolution kernel size of the convolution layer of the convolution unit of the third uncertainty guided Transformer block UCTBlock in step f-10) is 3×3, with a stride of 1 and a padding of 1; the convolution kernel size of the convolution layer of the fourth feature extraction module FEM in step f-11) is 3×3, with a stride of 1 and a padding of 1; the convolution kernel size of the fourth upsampling layer of the decoder in step f-12) is 2×2; the convolution kernel size of the convolution layer of the convolution unit of the fourth uncertainty guided Transformer block UCTBlock in step f-13) is 3×3, with a stride of 1 and a padding of 1; the convolution kernel size of the convolution layer of the decoder in step f-14) is 1×1, with a stride of 1 and a padding of 0. In one embodiment of the present invention, step g) includes the following steps:
[0057] g-1) by formula L total =L Dice +ωL CE Calculate the total loss L total , where L Dice is the Dice loss, L CE is the cross entropy loss, and ω is a hyperparameter.
[0058] g-2) Use Adam optimizer to use the total loss L total Train the UCT-UNet model to obtain the optimized UCT-UNet model.
[0059] In this embodiment, preferably, when training the UCT-UNet model, the initial learning rate is 0.001, the batch size is set to 32, the epoch is set to 200, the learning rate lr is 0.001, and the hyperparameter ω is set to 0.05. Finally, it should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or make equivalent replacements for some of the technical features therein. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A cardiac ultrasound image segmentation method based on the UCT-UNet model, characterized in that: include: a) Obtain N cardiac ultrasound images to obtain a cardiac ultrasound image dataset X, where X = {X1, X2, ..., X i ,...,X N }, X i is the i-th cardiac ultrasound image, i∈{1,...,N}; b) Take the i-th cardiac ultrasound image X i Preprocessing is performed to obtain the preprocessed cardiac ultrasound image L i , all N preprocessed cardiac ultrasound images constitute a preprocessed cardiac ultrasound image dataset L, L = {L1, L2, ..., L i ,...,L N }; c) dividing the preprocessed cardiac ultrasound image dataset L into a training set, a validation set, and a test set; d) Establish a UCT-UNet model consisting of an encoder and a decoder; e) The i-th preprocessed cardiac ultrasound image L in the training set i Input into the encoder of the UCT-UNet model and output the feature map f) The feature map Input into the decoder of the UCT-UNet model and output the segmented image g) Calculate the total loss L total , through the total loss L total Train the UCT-UNet model to obtain the optimized UCT-UNet model; h) Take the jth preprocessed cardiac ultrasound image L in the test set j Input into the optimized UCT-UNet model and output the predicted segmentation image 2. The method for segmenting cardiac ultrasound images based on the UCT-UNet model according to claim 1, characterized in that: In step a), N cardiac ultrasound images are obtained from the CAMUS cardiac segmentation ultrasound image dataset, where N is 500.
3. The cardiac ultrasound image segmentation method based on the UCT-UNet model according to claim 1, characterized in that: Step b) comprises the following steps: b-1) Use the center_crop() function in OpenCV to crop the i-th cardiac ultrasound image X i Perform a center detection operation of size 256×256 to obtain the i-th cardiac ultrasound image X after cropping i ′; b-2) The i-th cardiac ultrasound image X i ′ Perform z-score standardization operation to obtain the preprocessed cardiac ultrasound image L i .
4. The cardiac ultrasound image segmentation method based on the UCT-UNet model according to claim 1, characterized in that: In step c), the preprocessed cardiac ultrasound image dataset L is divided into a training set, a validation set, and a test set in a ratio of 6:2:
2.
5. The cardiac ultrasound image segmentation method based on the UCT-UNet model according to claim 1, characterized in that: Step e) comprises the following steps: e-1) The encoder of the UCT-UNet model consists of a first double convolution block, a first Transformer block, a first maximum pooling layer, a second double convolution block, a second Transformer block, a second maximum pooling layer, a third double convolution block, a third Transformer block, a third maximum pooling layer, a fourth double convolution block, a fourth Transformer block, and a fourth maximum pooling layer; e-2) The first dual convolutional block of the encoder consists of the first convolutional layer, the first BN layer, the first ReLU activation function, the second convolutional layer, the second BN layer, and the second ReLU activation function. The i-th preprocessed cardiac ultrasound image L in the training set is i It is sequentially input into the first convolutional layer, the first BN layer, and the first ReLU activation function of the first double convolutional block, and the feature map is output. The feature map It is sequentially input into the second convolutional layer, the second BN layer, and the second ReLU activation function of the first double convolutional block, and the feature map is output. The feature map With feature map Perform splicing operation to obtain feature map e-3) The first Transformer block of the encoder consists of the patch embedding block of the transformer model, the first LN layer, the multi-head self-attention block MSA of the transformer model, the second LN layer, and the multi-layer perceptron MLP. Input to the patch embedding block of the first Transformer block, and output the feature map The feature map It is input into the first LN layer of the first Transformer block and the multi-head self-attention block MSA in turn, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map The feature map It is input into the second LN layer of the first Transformer block and the multi-layer perceptron MLP in turn, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map e-4) The feature map Input to the first maximum pooling layer of the encoder, and output the feature map e-5) The second dual convolutional block of the encoder consists of the first convolutional layer, the first BN layer, the first ReLU activation function, the second convolutional layer, the second BN layer, and the second ReLU activation function. It is sequentially input into the first convolutional layer, the first BN layer, and the first ReLU activation function of the second double convolutional block, and the feature map is output. The feature map It is sequentially input into the second convolutional layer, the second BN layer, and the second ReLU activation function of the second double convolutional block, and the feature map is output. The feature map With feature map Perform splicing operation to obtain feature map e-6) The second Transformer block of the encoder consists of the patch embedding block of the transformer model, the first LN layer, the multi-head self-attention block MSA of the transformer model, the second LN layer, and the multi-layer perceptron MLP. Input to the patch embedding block of the second Transformer block, and output the feature map The feature map It is sequentially input into the first LN layer of the first Transformer block of the second Transformer block and the multi-head self-attention block MSA, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map The feature map It is input into the second LN layer and the multi-layer perceptron MLP of the second Transformer block in sequence, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map e-7) The feature map Input to the second maximum pooling layer of the encoder, and output the feature map e-8) The third dual convolution block of the encoder consists of the first convolution layer, the first BN layer, the first ReLU activation function, the second convolution layer, the second BN layer, and the second ReLU activation function. It is sequentially input into the first convolutional layer, the first BN layer, and the first ReLU activation function of the third double convolutional block, and the feature map is output. The feature map It is sequentially input into the second convolutional layer, the second BN layer, and the second ReLU activation function of the third double convolutional block, and the feature map is output. The feature map With feature map Perform splicing operation to obtain feature map e-9) The third Transformer block of the encoder consists of the patch embedding block of the transformer model, the first LN layer, the multi-head self-attention block MSA of the transformer model, the second LN layer, and the multi-layer perceptron MLP. Input to the patch embedding block of the third Transformer block, and output the feature map The feature map It is sequentially input into the first LN layer of the first Transformer block of the third Transformer block and the multi-head self-attention block MSA, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map The feature map It is input into the second LN layer and the multi-layer perceptron MLP of the third Transformer block in sequence, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map e-10) The feature map Input to the third maximum pooling layer of the encoder, and output the feature map e-11) The fourth dual convolution block of the encoder consists of the first convolution layer, the first BN layer, the first ReLU activation function, the second convolution layer, the second BN layer, and the second ReLU activation function. It is sequentially input into the first convolutional layer, the first BN layer, and the first ReLU activation function of the fourth double convolutional block, and the feature map is output. The feature map It is sequentially input into the second convolutional layer, the second BN layer, and the second ReLU activation function of the fourth double convolutional block, and the feature map is output. The feature map With feature map Perform splicing operation to obtain feature map e-12) The fourth Transformer block of the encoder consists of the patch embedding block of the transformer model, the first LN layer, the multi-head self-attention block MSA of the transformer model, the second LN layer, and the multi-layer perceptron MLP. Input to the patch embedding block of the fourth Transformer block, and output the feature map The feature map It is sequentially input into the first LN layer of the first Transformer block of the fourth Transformer block and the multi-head self-attention block MSA, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map The feature map It is input into the second LN layer and the multi-layer perceptron MLP of the fourth Transformer block in sequence, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map e-13) The feature map Input to the fourth maximum pooling layer of the encoder, and output the feature map 6. The cardiac ultrasound image segmentation method based on the UCT-UNet model according to claim 5, characterized in that: In step e-2), the convolution kernel size of the first convolution layer and the second convolution layer of the first double convolution block are both 3×3, the padding is 1, and the step size is 1; in step e-4), the convolution kernel size of the first maximum pooling layer is 2×2; in step e-5), the convolution kernel size of the first convolution layer and the second convolution layer of the second double convolution block are both 3×3, the padding is 1, and the step size is 1; in step e-7), the convolution kernel size of the second maximum pooling layer is 2×2; in step e-8), the convolution kernel size of the first convolution layer and the second convolution layer of the third double convolution block are both 3×3, the padding is 1, and the step size is 1; in step e-10), the convolution kernel size of the third maximum pooling layer is 2×2; in step e-11), the convolution kernel size of the first convolution layer and the second convolution layer of the fourth double convolution block are both 3×3, the padding is 1, and the step size is 1; in step e-13), the convolution kernel size of the fourth maximum pooling layer is 2×2.
7. The cardiac ultrasound image segmentation method based on the UCT-UNet model according to claim 1, characterized in that: Step f) comprises the following steps: f-1) The decoder of the UCT-UNet model consists of a first upsampling layer, a first feature extraction module FEM, a first uncertainty guided Transformer block UCTBlock, a second feature extraction module FEM, a second upsampling layer, a second uncertainty guided Transformer block UCTBlock, a third feature extraction module FEM, a third upsampling layer, a third uncertainty guided Transformer block UCTBlock, a fourth feature extraction module FEM, a fourth upsampling layer, a fourth uncertainty guided Transformer block UCTBlock, and a convolutional layer; f-2) The feature map Input to the first upsampling layer of the decoder, and output the feature map f-3) The first feature extraction module FEM of the decoder consists of a convolutional layer, a first reshape function, a transpose function, a softmax function, a second reshape function, an average pooling layer, a fully connected layer, and a Sigmoid function. Input into the convolution layer of the first feature extraction module FEM, and output the feature map The feature map Input into the first reshape function and transpose function of the first feature extraction module FEM in turn, and output the feature map The feature map Input into the first reshape function of the first feature extraction module FEM, and output the feature map The feature map With feature map After the multiplication operation, it is input into the softmax function of the first feature extraction module FEM, and the output is the feature map The feature map Input it into the second reshape function of the feature extraction module FEM, and output the feature map The feature map With feature map Perform multiplication operation to obtain the feature map The feature map With feature map Perform addition operation to obtain feature map The feature map The average pooling layer, fully connected layer, and Sigmoid function of the first feature extraction module FEM are input in sequence, and the feature map is output. The feature map With feature map Perform addition operation to obtain feature map f-4) The first uncertainty-guided Transformer block UCTBlock of the decoder consists of a convolution unit, a triplet of the Transformer model, a softmax function layer, and a reshape function layer. The convolution unit is composed of a convolution layer, a BatchNorm layer, and a Gelu activation function in turn. With feature map After the accumulation operation, it is input into the convolution unit of the first uncertainty guided Transformer block UCTBlock, and the feature map is output. The feature map The Query vector and the Key vector are multiplied in the triple input to the first uncertainty guided Transformer block UCTBlock to obtain the feature map The feature map Input into the softmax function layer and reshape function layer of the first uncertainty guided Transformer block UCTBlock in turn, and output the feature map The feature map With feature map Perform multiplication operation to obtain the feature map The feature map The Value vector and feature map are used in the triples input to the first uncertainty guided Transformer block UCTBlock Perform multiplication operation to obtain the feature map f-5) The second feature extraction module FEM of the decoder consists of a convolutional layer, a first reshape function, a transpose function, a softmax function, a second reshape function, an average pooling layer, a fully connected layer, and a Sigmoid function. Input into the convolution layer of the second feature extraction module FEM, and output the feature map The feature map Input into the first reshape function and transpose function of the second feature extraction module FEM in sequence, and output the feature map The feature map Input into the first reshape function of the second feature extraction module FEM, and output the feature map The feature map With feature map After the multiplication operation, it is input into the softmax function of the second feature extraction module FEM, and the output is the feature map The feature map Input it into the second reshape function of the second feature extraction module FEM, and output the feature map The feature map With feature map Perform multiplication operation to obtain the feature map The feature map With feature map Perform addition operation to obtain feature map The feature map The average pooling layer, fully connected layer, and Sigmoid function of the second feature extraction module FEM are input in sequence to output the feature map. The feature map With feature map Perform addition operation to obtain feature map f-6) The feature map With feature map After the addition operation, it is input into the second upsampling layer of the decoder, and the output is the feature map f-7) The second uncertainty-guided Transformer block UCTBlock of the decoder consists of a convolution unit, a triplet of the Transformer model, a softmax function layer, and a reshape function layer. The convolution unit is composed of a convolution layer, a BatchNorm layer, and a Gelu activation function in turn. Input into the convolution unit of the second uncertainty guided Transformer block UCTBlock, and output the feature map The feature map The Query vector and the Key vector are multiplied in the triple input to the second uncertainty guided Transformer block UCTBlock to obtain the feature map The feature map It is input into the softmax function layer and reshape function layer of the second uncertainty guided Transformer block UCTBlock in turn, and the feature map is output. The feature map With feature map Perform multiplication operation to obtain the feature map The feature map The Value vector and feature map are used in the triplet input to the second uncertainty guided Transformer block UCTBlock Perform multiplication operation to obtain the feature map f-8) The third feature extraction module FEM of the decoder consists of a convolutional layer, a first reshape function, a transpose function, a softmax function, a second reshape function, an average pooling layer, a fully connected layer, and a Sigmoid function. Input into the convolution layer of the third feature extraction module FEM, and output the feature map The feature map Input into the first reshape function and transpose function of the third feature extraction module FEM in sequence, and output the feature map The feature map Input it into the first reshape function of the third feature extraction module FEM, and output the feature map The feature map With feature map After the multiplication operation, it is input into the softmax function of the third feature extraction module FEM, and the output is the feature map The feature map Input it into the second reshape function of the third feature extraction module FEM, and output the feature map The feature map With feature map Perform multiplication operation to obtain the feature map The feature map With feature map Perform addition operation to obtain feature map The feature map The average pooling layer, fully connected layer, and Sigmoid function of the third feature extraction module FEM are input in sequence to output the feature map. The feature map With feature map Perform addition operation to obtain feature map f-9) The feature map With feature map After the addition operation, it is input into the third upsampling layer of the decoder, and the output is the feature map f-10) The third uncertainty-guided Transformer block UCTBlock of the decoder consists of a convolution unit, a triplet of the Transformer model, a softmax function layer, and a reshape function layer. The convolution unit is composed of a convolution layer, a BatchNorm layer, and a Gelu activation function in turn. Input into the convolution unit of the third uncertainty guided Transformer block UCTBlock, and output the feature map The feature map The Query vector and the Key vector are multiplied in the triplet input to the third uncertainty guided Transformer block UCTBlock to obtain the feature map The feature map It is input into the softmax function layer and reshape function layer of the third uncertainty guided Transformer block UCTBlock in sequence, and the feature map is output. The feature map With feature map Perform multiplication operation to obtain the feature map The feature map The Value vector and feature map are used in the triplet input to the third uncertainty guided Transformer block UCTBlock Perform multiplication operation to obtain the feature map f-11) The fourth feature extraction module FEM of the decoder consists of a convolutional layer, a first reshape function, a transpose function, a softmax function, a second reshape function, an average pooling layer, a fully connected layer, and a Sigmoid function. Input into the convolution layer of the fourth feature extraction module FEM, and output the feature map The feature map Input into the first reshape function and transpose function of the fourth feature extraction module FEM in sequence, and output the feature map The feature map Input it into the first reshape function of the fourth feature extraction module FEM, and output the feature map The feature map With feature map After the multiplication operation, it is input into the softmax function of the fourth feature extraction module FEM, and the output is the feature map The feature map Input it into the second reshape function of the fourth feature extraction module FEM, and output the feature map The feature map With feature map Perform multiplication operation to obtain the feature map The feature map With feature map Perform addition operation to obtain feature map The feature map The average pooling layer, fully connected layer, and Sigmoid function of the fourth feature extraction module FEM are input in sequence to output the feature map The feature map With feature map Perform addition operation to obtain feature map f-12) The feature map With feature map After the addition operation, it is input into the fourth upsampling layer of the decoder, and the output is the feature map f-13) The fourth uncertainty guided Transformer block UCTBlock of the decoder is composed of a convolution unit, a triplet of the Transformer model, a softmax function layer, and a reshape function layer. The convolution unit is composed of a convolution layer, a BatchNorm layer, and a Gelu activation function in turn. Input into the convolution unit of the fourth uncertainty guided Transformer block UCTBlock, and output the feature map The feature map The Query vector and the Key vector are multiplied in the triple input to the fourth uncertainty guided Transformer block UCTBlock to obtain the feature map The feature map Input into the softmax function layer and reshape function layer of the fourth uncertainty guided Transformer block UCTBlock in turn, and output the feature map The feature map With feature map Perform multiplication operation to obtain the feature map The feature map The Value vector and feature map are used in the triplet input to the fourth uncertainty guided Transformer block UCTBlock Perform multiplication operation to obtain the feature map f-14) The feature map Input into the convolutional layer of the decoder and output the segmented image 8. The cardiac ultrasound image segmentation method based on the UCT-UNet model according to claim 7, characterized in that: In step f-2), the convolution kernel size of the first upsampling layer of the decoder is 2×2; in step f-3), the convolution kernel size of the convolution layer of the first feature extraction module FEM is 3×3, the step size is 1, and the padding is 1; in step f-4), the convolution kernel size of the convolution layer of the convolution unit of the first uncertainty guided Transformer block UCTBlock is 3×3, the step size is 1, and the padding is 1; in step f-5), the convolution kernel size of the convolution layer of the second feature extraction module FEM is 3×3, the step size is 1, and the padding is 1; in step f-6), the convolution kernel size of the first upsampling layer of the decoder is 2×2; in step f-7), the convolution kernel size of the convolution layer of the convolution unit of the second uncertainty guided Transformer block UCTBlock is 3×3, the step size is 1, and the padding is 1; in step f-8), the convolution kernel size of the convolution layer of the third feature extraction module FEM The convolution kernel size of the convolution layer is 3×3, the step size is 1, and the padding is 1; the convolution kernel size of the third upsampling layer of the decoder in step f-9) is 2×2; the convolution kernel size of the convolution layer of the convolution unit of the third uncertainty guided Transformer block UCTBlock in step f-10) is 3×3, the step size is 1, and the padding is 1; the convolution kernel size of the convolution layer of the fourth feature extraction module FEM in step f-11) is 3×3, the step size is 1, and the padding is 1; the convolution kernel size of the fourth upsampling layer of the decoder in step f-12) is 2×2; the convolution kernel size of the convolution layer of the convolution unit of the fourth uncertainty guided Transformer block UCTBlock in step f-13) is 3×3, the step size is 1, and the padding is 1; the convolution kernel size of the convolution layer of the decoder in step f-14) is 1×1, the step size is 1, and the padding is 0.
9. The cardiac ultrasound image segmentation method based on the UCT-UNet model according to claim 1, characterized in that: Step g) comprises the following steps: g-1) through the formula L total =L Dice +ωL CE Calculate the total loss L total , where L Dice is the Dice loss, L CE is the cross entropy loss, ω is a hyperparameter; g-2) Use the Adam optimizer to take advantage of the total loss L total Train the UCT-UNet model to obtain the optimized UCT-UNet model.
10. The cardiac ultrasound image segmentation method based on the UCT-UNet model according to claim 9, characterized in that: When training the UCT-UNet model, the initial learning rate is 0.001, the batch size is set to 32, the epoch is set to 200, the learning rate lr is 0.001, and the hyperparameter ω is set to 0.05.
Citation Information
Cited By
Medical image segmentation method based on CNN and lightweight Transform fusion
CN120355920A
Cardiac ultrasound standard view acquisition system and method based on spatial anatomy prior
CN122199567A