Parkinson's disease image automatic segmentation method based on improved TransUNet and Triplet Attention
Through the improved TransUNet algorithm and Triplet Attention mechanism, the problem of time-consuming and insufficient accuracy in Parkinson's image segmentation is solved, and efficient and accurate automatic segmentation of substantia nigra area is achieved, which is suitable for medical imaging and biomedical research.
Patent Information
- Application Number
- CN202510599125.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-10
- Publication Date
- 2025-08-19
AI Technical Summary
The prior art has a problem of time consuming and susceptible to subjective influence by doctors in Parkinson's image segmentation, and traditional deep learning methods lack accuracy when dealing with low contrast, blurred boundaries and shape changes in substantia nigra areas.
The improved TransUNet algorithm is used to combine DySample and Triplet Attention mechanisms to enhance features through dynamic sampling and multi-dimensional attention to improve the segmentation accuracy and efficiency of the substantia nigra area.
High-precision automatic segmentation of substantia nigra area in Parkinson's image is achieved, reducing subjective errors from doctors, improving the accuracy and efficiency of diagnosis, and expanding to other medical imaging and biomedical research.
Smart Images

Figure CN120510164A_ABST
Abstract
Description
Technical field:
[0001] The present invention belongs to the field of medical imaging, and in particular relates to an automatic Parkinson's disease image segmentation method based on improved TransUNet and TripletAttention. Background technology:
[0002] Parkinson's disease is a neurodegenerative disorder caused by the degeneration and death of dopaminergic neurons in the substantia nigra. Currently, the diagnosis of PD relies primarily on its typical clinical manifestations, lacking effective biological markers. The substantia nigra is rich in neuromelanin, which chelates heavy metals such as iron, thereby preventing cellular toxicity. Parkinson's disease is often accompanied by gradual atrophy of the substantia nigra, a process that can be observed in medical imaging. By analyzing brain images and measuring the area of the substantia nigra and midbrain, doctors can monitor disease progression and use this for diagnosis and follow-up of Parkinson's disease.
[0003] Existing technologies include: Manual segmentation methods: This method is time-consuming and easily influenced by the doctor's subjective experience, reducing diagnostic accuracy. Deep learning methods: These use classic image segmentation algorithms such as FCN, UNet, and UNet++. Although these networks demonstrate good segmentation performance on medical images, they still face challenges in accurately segmenting Parkinson's disease images due to shortcomings such as information loss and insufficient processing of local contextual features. Furthermore, the substantia nigra region has low contrast, blurred boundaries, and easily variable shapes.
[0004] To this end, improvements were made based on the TransUNet model, using lightweight dynamic sampling instead of the traditional bilinear interpolation method. DySample, by combining pixel rearrangement and dynamically adjusting the sampling strategy, can adaptively adjust the sampling method according to the characteristics of the input image, effectively improving the recovery of substantia nigra details and edge information. Then, a triple attention module was introduced in the decoding layer to enhance the features of the substantia nigra area from the horizontal, vertical and channel dimensions, which can capture more local details and tiny structures. This algorithm meets the strict requirements of the medical field for high-precision segmentation and provides clinicians with a more accurate auxiliary segmentation tool. Summary of the invention:
[0005] In response to the shortcomings of the existing technology, the present invention proposes an automatic segmentation method for Parkinson's disease images based on improved TransUNet and TripletAttention. The core of the method is to apply the improved TransUNet algorithm to improve the efficiency and accuracy of substantia nigra segmentation in Parkinson's disease NM images, and ultimately distinguish the degree of significant difference between the healthy group and Parkinson's disease.
[0006] To implement this method, the present invention provides the following technical solution: a method for automatic segmentation of Parkinson's disease images based on improved TransUNet and Triplet Attention, characterized by comprising the following steps 1 to 6 to complete Parkinson's disease NM image segmentation and analysis:
[0007] S1: Data preparation and preprocessing: Parkinson's neuromelanin NM images were collected and the substantia nigra was manually outlined in the Parkinson's images;
[0008] S2: Model construction: Build a deep learning model based on the improved TransUNet algorithm;
[0009] S3: Introducing the attention mechanism: Integrating the Triplet Attention mechanism after the jump connection, which enables the model to automatically identify and focus on important feature areas in the image;
[0010] S4: Replacement sampling method: replace linear double sampling with DySample to retain more detailed features of the substantia nigra and improve the performance of the model in segmenting the substantia nigra;
[0011] S5: Model application: Apply the optimized model to the recognition of Parkinson's disease image segmentation;
[0012] S6: Statistical analysis: The area distribution of the segmented substantia nigra was calculated, and statistical tests were performed on the data of the healthy group and the patient group.
[0013] As a preferred technical solution of the present invention, the specific structure of the improved TransUNet algorithm in S2 is as follows:
[0014] K1: Input: Receives pre-processed and labeled Parkinson's NM images;
[0015] K2: Feature extraction layer: A hybrid encoder composed of Transformers is responsible for basic image feature extraction;
[0016] K3: Feature fusion layer: It uses the U-Net structure to retain local detail information and uses ResNet50 to perform 3-layer feature extraction and fusion;
[0017] K4: Output network: Use skip connections to fuse the output features and obtain the segmentation results through the segmentation head;
[0018] The connection relationship between the structures is as follows: the input end is directly connected to the feature extraction layer; the feature extraction layer is directly connected to the feature fusion layer; and the feature fusion layer is directly connected to the output network.
[0019] As a preferred technical solution of the present invention, the specific operation process of the Triplet Attention mechanism in S3 is as follows:
[0020] T1: Process the input feature X through the three branches respectively;
[0021] T2: In the first branch, establish the interaction between the H dimension and the C dimension;
[0022] T3: Obtain an intermediate output of size 1×H×C through a global pooling layer, a convolutional layer, and a batch normalization layer;
[0023] T4: X generates H×C interactive attention weights through Sigmoid activation function;
[0024] T5: The final feature X is rotated 90° clockwise along the H axis to keep the same shape as the input tensor;
[0025] T6: The second branch generates W×C interaction attention weights through similar processing;
[0026] T7: Exchange the output W axis with C to keep it consistent with the input;
[0027] T8: The third branch establishes the interactive relationship between W dimension and H dimension;
[0028] T9: Aggregate the feature tensors generated by the three branches into a refined attention tensor by averaging them.
[0029] As a preferred technical solution of the present invention, the specific calculation formula of the Triplet Attention mechanism in S3 is as follows:
[0030] Attention tensor expression:
[0031] Among them, ω1, ω2 and ω3 are the three cross-dimensional attention weights calculated in triple attention, and represents a 90° clockwise rotation to maintain the original input shape of C×H×W.
[0032] As a preferred technical solution of the present invention, the specific operation process of the improved replacement sampling method DySample in S4 is as follows:
[0033] Y1: The input feature map is processed by the sampling point generator and outputs the sampling set S, including Y1-1 to Y1-2;
[0034] Y1-1: Feature X is generated by combining linear layers, dynamic range factors and pixel reordering to generate offset O;
[0035] Y1-2: The offset O is combined with the original data G to generate the sample set S;
[0036] Y2: The sampling set S is processed by the grid sampling function to resample the input feature map X;
[0037] Y3: Finally generate a feature map X of size C×H2×W2 ′ .
[0038] As a preferred technical solution of the present invention, the specific calculation formula of DySample in S4 is as follows:
[0039] Feature X ′ Expression: X′=grid sample(X,S)
[0040] Among them, X is the input feature, X ′ is the up-sampled feature, and S is the sampling set.
[0041] Dynamic sampling process: O = 0.5sigmoid(linear1(x))·linear2(x)
[0042] As a preferred technical solution of the present invention, the specific operation process of the statistical analysis in S6 is as follows:
[0043] F1: Calculate the substantia nigra area of each subject based on the segmented image of the model;
[0044] F2: Divide the ratio data into healthy group and Parkinson's group;
[0045] F3: Statistical test on grouped data;
[0046] F4: Calculate whether there is a significant difference between the two sets of data.
[0047] Compared with the related prior art, the present application proposal has the following main technical advantages: The beneficial effects of the present invention are:
[0048] Improved efficiency: Through the improved TransUNet algorithm and specially designed network structure, this model can automatically segment Parkinson's disease NM images on behalf of doctors, improving the work efficiency of medical staff.
[0049] Improved accuracy: The application of Parkinson's disease automatic segmentation algorithm can more accurately and objectively segment the substantia nigra and midbrain in Parkinson's disease images, reduce doctors' subjectivity and errors, and improve the accuracy of segmentation results.
[0050] Wide application: This model can also be extended to other fields of medical image segmentation and biomedical research. Description of the drawings:
[0051] Figure 1 This is a network structure diagram of an improved TransUNet provided by the present invention
[0052] Figure 2 This is a Dysample structure diagram provided by the present invention;
[0053] Figure 3 This is a structural diagram of a sampling point generator provided by the present invention;
[0054] Figure 4 This is a Triplet Attention structure diagram provided by the present invention;
[0055] Figure 5 This is an example diagram of substantia nigra segmentation provided by the present invention;
[0056] Figure 6 This is an example of the substantia nigra segmentation result provided by the embodiment of the present invention;
[0057] Figure 7 This is a comparative example of the substantia nigra area between the HC group and the PD group provided in the embodiment of the present invention; Specific implementation method:
[0058] The present invention is further described below with reference to the accompanying drawings and examples. However, the present invention can be implemented in many different ways and should not be construed as limited to the illustrated embodiments; rather, these embodiments provide those skilled in the art with implementation methods that meet applicable legal requirements.
[0059] Example 1: Dataset: collected from real subjects of Ningxia Medical University, the dataset contains 248 NM images from 49 healthy subjects (HC) and 49 Parkinson's disease patients (PD).
[0060] First, all data were labeled: all selected NM images were manually segmented and labeled using Labelme software, and the labeled category was substantia nigra.
[0061] Data preprocessing and partitioning: All images were center-cropped and uniformly resized to 256*256 pixels. Subsequently, the dataset was randomly shuffled and divided into a training set (80%) and a test set (20%).
[0062] After the skip connection, the Triplet Attention mechanism is introduced. Triplet Attention consists of three different branches that extract features in parallel.
[0063] Use the global perception ability of Transformer to capture long-distance dependencies and retain local detail information through the U-Net structure.
[0064] The final segmentation results were obtained by feature fusion, and the resulting data were sorted and statistically tested to obtain the final difference judgment between the healthy group and the Parkinson's group.
[0065] Optimization algorithm: Adam optimizer. Loss function: Cross-entropy loss. All models were trained and tested on a GPU server equipped with an RTX 4090D graphics card.
[0066] Evaluation indicators include Dice coefficient, precision, recall, average precision (AP) and mean average precision (MAP).
[0067] The corresponding calculation formula is as follows:
[0068]
[0069] Among them, X is the model prediction value and Y is the manually labeled value.
[0070]
[0071] TP represents the number of pixels correctly predicted by the model as being in the segmented region, TN represents the number of pixels correctly predicted by the model as being in the background region, FP represents the number of pixels that are not in the segmented region but are recognized as such, and FN represents the number of pixels that are in the segmented region but are not recognized as such. k represents the number of classes.
[0072] Example 2: To verify the effectiveness of the algorithm and explore the impact of each module on network performance, the experiment uses the same dataset, takes TransUNet as the base network, and adds TA attention modules and Dysample sampling methods one by one. The experimental results are shown in Table 1.
[0073] Table 1 - Comparative experiment of substantia nigra segmentation performance of different attention modules
[0074]
[0075] Experimental results show that the addition of the TA module achieves a Dice coefficient of 78.30% for substantia nigra segmentation, and Recall improves by 1.38 percentage points, demonstrating that the module effectively enhances substantia nigra segmentation by capturing local feature information. However, Precision decreases slightly by 1.33 percentage points, likely due to the attention mechanism focusing on more blurred regions, thereby capturing some irrelevant areas. Introducing the DySample module alone improves the model's Dice by 0.7 percentage points and Recall by 2.36 percentage points. These results demonstrate that DySample, through its adaptive dynamic sampling strategy, more accurately restores substantia nigra details and edge information, making it suitable for small object segmentation tasks. Combining the TA and DySample modules achieves optimal performance, with Dice increasing to 79.35%, an increase of 1.41 percentage points, Precision improving by 0.45 percentage points, and Recall and mIoU improving by 1.54 percentage points and 0.99 percentage points, respectively. These results show that the joint optimization of the two enables the model to perform well in detail recovery and edge segmentation, while achieving a better balance between precision and recall, and improving the segmentation effect of Parkinson's substantia nigra.
[0076] Example 3: To verify the effectiveness of our model for Parkinson's disease substantia nigra segmentation, we compared it with the mainstream image segmentation algorithms FCN, DeepLabV3, and UNet. FCN, DeepLabV3, and UNet are all classic models in the field of image segmentation. They have different network structures and design concepts, representing different segmentation methods.
[0077] Table 2 - Comparative experimental results
[0078]
[0079] Experimental results show that FCN and DeepLabV3 achieve the worst results in the substantia nigra segmentation task for PD. FCN's Dice coefficient is only 36.89%, indicating that it is almost incapable of accurately segmenting the substantia nigra region. UNet achieves better segmentation results, with a Dice coefficient of 72.45%, which accurately segments the substantia nigra. However, TransUNet achieves a Dice coefficient of 77.94%, 5.49 percentage points higher than UNet, making it more suitable for substantia nigra segmentation. The improved TD_TransUNet achieves a Dice coefficient of 79.35%, a 1.41 percentage point improvement over the original model, and a mIoU of 82.83%, a 0.99 percentage point improvement over the original model. Furthermore, TD_TransUNet achieves Precision and Recall of 88.63% and 90.94%, respectively, both of which are higher than TransUNet. In summary, the algorithm in this chapter improves upon the original model in the substantia nigra segmentation task, achieving higher segmentation accuracy.
[0080] Example 4: To further explore the medical significance of this algorithm, this study included 98 MRI images (49 in the HC group and 49 in the PD group). The improved TransUNet model was used to segment the substantia nigra to obtain the pixel area of the substantia nigra in each group. The Mann-Whitney U test was used to compare the differences between the two groups, and the effect size (Cohen's d) was calculated to assess the pathological significance of substantia nigra atrophy from both statistical and clinical perspectives.
[0081] The experimental results showed that the p-value of the Mann-Whitney U test was 0.003. This indicates that there was a significant difference in substantia nigra area between the HC and PD groups (p<0.05), that is, the substantia nigra area distribution between the two groups was significantly different. The effect size Cohen's d was 0.56, indicating that the difference in substantia nigra area between the two groups had a moderate impact. In addition, based on the comparison of segmented areas, this study calculated that the area reduction rate of the PD group was 10.7%, which is consistent with the 10-20% atrophy rate in MRI volume studies, indicating that this model can effectively identify early substantia nigra atrophy and provide an imaging basis for the early diagnosis of PD.
[0082] The above embodiments merely illustrate several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention. It should be noted that a person skilled in the art would be able to make numerous variations and improvements without departing from the spirit of the present invention, and all such variations and improvements fall within the scope of protection of the present invention.
Claims
1. An automatic Parkinson's disease image segmentation method based on improved TransUNet and Triplet Attention, characterized by: The specific steps are as follows: S1: Data preparation and preprocessing: Parkinson's neuromelanin NM images were collected and the substantia nigra was manually outlined in the Parkinson's images; S2: Model construction: Build a deep learning model based on the improved TransUNet algorithm; S3: Introducing the attention mechanism: Integrating the Triplet Attention mechanism after the jump connection, which enables the model to automatically identify and focus on important feature areas in the image; S4: Replacement sampling method: replace linear double sampling with DySample to retain more detailed features of the substantia nigra and improve the performance of the model in segmenting the substantia nigra; S5: Model application: Apply the optimized model to the recognition of Parkinson's disease image segmentation; S6: Statistical analysis: The area distribution of the segmented substantia nigra was calculated, and statistical tests were performed on the data of the healthy group and the patient group.
2. The method for automatic segmentation of Parkinson's disease images based on improved TransUNet and Triplet Attention according to claim 1, characterized in that: The specific structure of the improved TransUNet algorithm in S2 is as follows: K1: Input: Receives pre-processed and labeled Parkinson's NM images; K2: Feature extraction layer: A hybrid encoder composed of Transformers is responsible for basic image feature extraction; K3: Feature fusion layer: It uses the U-Net structure to retain local detail information and uses ResNet50 to perform 3-layer feature extraction and fusion; K4: Output network: Use skip connections to fuse the output features and obtain the segmentation results through the segmentation head; The connection relationship between the structures is as follows: the input end is directly connected to the feature extraction layer; the feature extraction layer is directly connected to the feature fusion layer; and the feature fusion layer is directly connected to the output network.
3. The method for automatic segmentation of Parkinson's disease images based on improved TransUNet and Triplet Attention according to claim 1, characterized in that: The specific operation process of the Triplet Attention mechanism in S3 is as follows: T1: Process the input feature X through the three branches respectively; T2: In the first branch, establish the interaction between the H dimension and the C dimension; T3: Obtain an intermediate output of size 1×H×C through a global pooling layer, a convolutional layer, and a batch normalization layer; T4: X generates H×C interactive attention weights through Sigmoid activation function; T5: The final feature X is rotated 90° clockwise along the H axis to keep the same shape as the input tensor; T6: The second branch generates W×C interaction attention weights through similar processing; T7: Exchange the output W axis with C to keep it consistent with the input; T8: The third branch establishes the interactive relationship between W dimension and H dimension; T9: Aggregate the feature tensors generated by the three branches into a refined attention tensor by averaging them.
4. The method for automatic segmentation of Parkinson's disease images based on improved TransUNet and Triplet Attention according to claim 1, characterized in that: The specific calculation formula of the Triplet Attention mechanism in S3 is as follows: Attention tensor expression: Among them, ω1, ω2 and ω3 are the three cross-dimensional attention weights calculated in triple attention, and represents a 90° clockwise rotation to maintain the original input shape of C×H×W.
5. The method for automatic segmentation of Parkinson's disease images based on improved TransUNet and Triplet Attention according to claim 1, characterized in that: The specific operation process of replacing the sampling method DySample in S4 is as follows: Y1: The input feature map is processed by the sampling point generator and outputs the sampling set S, including Y1-1 to Y1-2; Y1-1: Feature X is generated by combining linear layers, dynamic range factors and pixel reordering to generate offset O; Y1-2: The offset O is combined with the original data G to generate the sample set S; Y2: The sampling set S is processed by the grid sampling function to resample the input feature map X; Y3: Finally generate a feature map X of size C×H2×W2 ′ .
6. The method for automatic segmentation of Parkinson's disease images based on improved TransUNet and Triplet Attention according to claim 1, characterized in that: The specific calculation formula of the replacement sampling method DySample in S4 is as follows: Feature X ′ Expression: X′=grid sample(X,S) Among them, X is the input feature, X ′ is the up-sampled feature, and S is the sampling set. Dynamic sampling process: O = 0.5sigmoid(linear1(x))·linear2(x) 7. The method for automatic segmentation of Parkinson's disease images based on improved TransUNet and Triplet Attention according to claim 1, characterized in that: The specific operation process of the statistical analysis in S6 is as follows: F1: Calculate the substantia nigra area of each subject based on the segmented image of the model; F2: Divide the ratio data into healthy group and Parkinson's group; F3: Statistical test on grouped data; F4: Calculate whether there is a significant difference between the two sets of data.