Thyroid image segmentation method and system for obtaining multi-scale feature fusion based on UNet and deformable convolution
By introducing deformable convolution and dual-input channel attention mechanisms into the UNet model, the problems of deformation modeling and feature fusion in thyroid ultrasound image segmentation are solved, achieving high-precision thyroid region segmentation and improving the model's adaptability and practicality.
Patent Information
- Application Number
- CN202511083508.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-04
- Publication Date
- 2025-11-11
AI Technical Summary
Existing UNet models suffer from insufficient local deformation modeling capabilities, coarse feature fusion mechanisms, inadequate contextual information capture, and difficulty in balancing performance and efficiency in thyroid ultrasound image segmentation, affecting the accuracy and practicality of boundary prediction.
We employ a deformable convolution and dual-input channel attention mechanism based on UNet. By embedding deformable convolution modules in each layer of the encoder, we dynamically adjust the sampling position and offset of the convolution kernel. We also perform multi-scale feature fusion before the decoder and use the channel attention mechanism to assign weights to the features output by the encoder, thereby improving the adaptability to the non-rigid boundaries of the thyroid gland and the accuracy of feature fusion.
It significantly improves the accuracy and robustness of thyroid ultrasound image segmentation, with a Dice coefficient of 92.09% and an IoU of 85.35%, demonstrating excellent boundary segmentation accuracy and making it suitable for clinical thyroid disease screening and diagnosis.
Smart Images

Figure CN120931678A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of medical image processing and computer vision technology, specifically to a method and system for thyroid image segmentation based on UNet and deformable convolution to obtain multi-scale feature fusion. Background Technology
[0002] Ultrasound imaging, due to its non-invasive, real-time, and low-cost advantages, is widely used in the screening, diagnosis, and follow-up management of thyroid diseases. Clinically, doctors need to annotate and analyze the thyroid gland based on its shape, echogenicity, and boundaries in ultrasound images. However, due to the inherent noise, low contrast, and artifacts in ultrasound images, manual segmentation is time-consuming, relies heavily on expert experience, and lacks objectivity, thus driving research into automated segmentation methods based on deep learning.
[0003] Currently, Convolutional Neural Networks (CNNs) have demonstrated outstanding performance in medical image segmentation, with UNet and its derivative models being widely used due to their symmetrical structure and efficient feature transfer. UNet utilizes an encoder to extract features, a decoder to restore spatial resolution layer by layer, and skip connections to preserve detailed information, making it one of the mainstream solutions for medical image segmentation.
[0004] However, the traditional UNet model still has the following problems in the thyroid segmentation task:
[0005] 1. Insufficient ability to model local deformations: The thyroid gland exhibits anatomical differences among patients, and its boundaries may show significant deformation under different probe angles, pressures, or changes in patient posture. Conventional convolutional kernels have fixed receptive fields and sampling locations, making them unable to effectively adapt to such non-rigid structural deformations, thus affecting the accuracy of boundary prediction.
[0006] 2. Crude feature fusion mechanism: The original UNet simply concatenates the feature maps of the same resolution layers in the encoder and decoder without considering the actual contribution of each layer's features to the final segmentation. This can easily lead to shallow redundant information interfering with deep semantic understanding, and it is especially insensitive to small nodules or blurred edge regions.
[0007] 3. Insufficient capture of contextual information: Ordinary convolutions have difficulty capturing local details and global contextual relationships at the same time, have limited ability to integrate multi-scale features, and are not good at processing irregular thyroid structures such as long strips and rings.
[0008] 4. Difficulty in balancing performance and efficiency: To improve segmentation accuracy, many variant models introduce complex structures (such as multi-branch networks, transformer modules, etc.), which significantly increases model size and inference cost, limiting their practical application on embedded or edge devices.
[0009] Existing improvements, such as Attention-UNet which introduces an attention mechanism to filter key features, UNet++ which enhances multi-scale feature transfer through dense connections, and Swin-UNet which attempts to fuse Transformer structures to enhance long-range dependency modeling capabilities, have improved segmentation accuracy to some extent, but still cannot fully address the efficiency issues of deformation modeling and information fusion.
[0010] Therefore, there is an urgent need for a novel network structure that combines deformation perception, multi-scale feature fusion, and efficient reasoning capabilities to improve the accuracy, robustness, and practicality of thyroid ultrasound image segmentation. Summary of the Invention
[0011] To address the aforementioned issues, this invention proposes a thyroid image segmentation method and system based on UNet and deformable convolution to achieve multi-scale feature fusion. By employing deformable convolution in each layer of the UNet encoder and using channel attention to perform weighted fusion of all downsampled features before the decoder, the segmentation accuracy and robustness are effectively improved.
[0012] The present invention adopts the following technical solution:
[0013] In a first aspect, this invention proposes a thyroid image segmentation method based on UNet and deformable convolution to obtain multi-scale feature fusion, comprising the following steps:
[0014] (1) Obtain the grayscale image of thyroid ultrasound and the corresponding mask annotation, and preprocess the image and mask;
[0015] (2) Based on the UNet network architecture, several layers of encoder and decoder are constructed. Each encoder and decoder layer uses two deformable convolutions instead of traditional convolutions. In the encoder, adjacent layers are downsampled to reduce spatial resolution, and then deformable convolutions are used to generate the encoded features of the current layer resolution. In the deepest layer of the encoder, a multi-scale attention feature fusion module is used. The encoded features of different resolutions of the encoder are used as inputs, and the deepest layer encoded features are channel-weighted through a dual-input channel attention mechanism to generate fused features. The fused features are used as inputs to the decoder. In the decoder, the spatial resolution is restored by upsampling layer by layer. The encoded features of the corresponding layer resolution are concatenated with the decoded features through skip connections. After concatenation, deformable convolutions are used to fuse information to generate the decoded features of the current layer resolution. The decoded features of the top layer resolution are used to generate a segmentation probability map through 1×1 convolutions, and the predicted binary mask of the thyroid region is obtained through thresholding.
[0016] (3) Calculate the loss based on the predicted binary mask and the actual mask annotation results, and train a thyroid image segmentation model that includes an encoder, a decoder and a multi-scale attention feature fusion module;
[0017] (4) The trained thyroid image segmentation model is used to segment the input thyroid ultrasound grayscale image and output the pixel-level segmentation results of the thyroid region.
[0018] Furthermore, the preprocessing in step (1) includes:
[0019] The image and mask are resized using bicubic interpolation, and the mask is scaled using nearest neighbor interpolation.
[0020] The image is converted into a floating-point tensor of shape (1,H,W) and normalized to the interval [0,1]. The mask is discretized, mapped to a category index, and converted to a LongTensor data type.
[0021] Furthermore, the preprocessing also includes data augmentation operations on the image and mask.
[0022] Furthermore, both the encoder and decoder are five-layered.
[0023] Furthermore, the deformable convolution dynamically predicts the position offset vector of the convolution kernel sampling point by introducing a learnable spatial offset parameter, performs feature sampling using bilinear interpolation, and generates an output feature map through weighted aggregation, thereby enhancing the modeling ability of thyroid region boundary deformation and occlusion.
[0024] Furthermore, the calculation process of the multi-scale attention feature fusion module includes:
[0025] By compressing the encoded features at different resolutions into scalars through a global average pooling layer, global information for each channel at each resolution is obtained.
[0026] The channel dependencies are learned through fully connected layers, and channel weight vectors for each resolution are generated and normalized.
[0027] The channel weight vectors of each resolution are mapped to the same size as the deepest coding feature, and then multiplied with the deepest coding feature one by one by the channel to obtain the fusion result of each resolution.
[0028] The fusion results from each resolution are combined to form the final fusion result.
[0029] Furthermore, the dual-input channel attention mechanism includes the aforementioned global average pooling layer and fully connected layer, and the parameters of the dual-input channel attention mechanism corresponding to the encoded features at different resolutions are independent.
[0030] Furthermore, the process of combining the fusion results from different resolutions includes:
[0031] The fusion results of each resolution are stitched together according to the channel dimension;
[0032] The concatenated result is subjected to a 1×1 convolution to generate a final fusion result with the same dimension as the deepest encoded feature channel.
[0033] Furthermore, BCEDiceLoss was used as the loss function when training the thyroid image segmentation model.
[0034] Secondly, this invention proposes a thyroid image segmentation system based on UNet and deformable convolution to obtain multi-scale feature fusion, which is used to implement the above-mentioned thyroid image segmentation method based on UNet and deformable convolution to obtain multi-scale feature fusion.
[0035] The beneficial effects of this invention are:
[0036] This invention demonstrates significant comprehensive advantages in thyroid ultrasound image segmentation by innovatively integrating variable convolution and a dual-input channel attention mechanism. In its core architecture, it employs a deeply optimized UNet framework. By embedding variable convolution modules in each layer of the encoder, the sampling position and offset of the convolution kernel are dynamically adjusted, giving the model a strong adaptability to non-rigid boundary deformations of the thyroid gland. This effectively solves the problem of inaccurate boundary capture under changes in probe angle and patient posture caused by traditional fixed convolution kernels. Simultaneously, the introduction of a multi-scale attention feature fusion module is a core technological breakthrough. It uses a dual-input channel attention mechanism to weight the five layers of features output by the encoder. This mechanism compresses spatial information through global average pooling, learns inter-channel dependencies using fully connected layers, and generates dynamic weight vectors with Sigmoid activation. This achieves refined fusion of shallow detail features and deep semantic features, completely overcoming the redundant information interference problem caused by the simple splicing of traditional UNet, and significantly improving the model's sensitivity in recognizing small nodules and blurred-edge regions. In clinical trials, this invention achieved excellent results with a Dice coefficient of 92.09%, IoU of 85.35%, and HD95 of 1.3264 mm. It not only surpasses benchmark models such as UNet and ResUNet, but also has universality for clinical deployment while maintaining high accuracy, providing reliable technical support for thyroid disease screening and diagnosis. Attached Figure Description
[0037] Figure 1 This is a flowchart of a thyroid image segmentation method based on UNet and deformable convolution to obtain multi-scale feature fusion proposed in this invention;
[0038] Figure 2 This is a schematic diagram of the structure of the thyroid image segmentation model DAmUNet;
[0039] Figure 3 This is a schematic diagram of the structure of the multi-scale attention feature fusion module;
[0040] Figure 4 This is a schematic diagram of the dual-input channel attention mechanism. Detailed Implementation
[0041] The present invention will be further described and illustrated below with reference to specific embodiments. The embodiments described are merely examples of the content of this disclosure and do not limit the scope of the invention. The technical features of each embodiment in the present invention can be combined accordingly, provided that there is no mutual conflict.
[0042] The accompanying drawings are merely illustrative of the invention and are not necessarily drawn to scale. Some of the block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0043] The flowchart shown in the attached diagram is merely an illustrative example and does not necessarily include all steps. For example, some steps may be broken down, while others may be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0044] like Figure 1 As shown, this invention proposes a thyroid image segmentation method based on UNet and deformable convolution to achieve multi-scale feature fusion. The method introduces deformable convolution and channel attention mechanisms into the UNet network architecture to achieve multi-scale thyroid segmentation. The main steps include:
[0045] S1, Data Acquisition and Preprocessing
[0046] In this step, grayscale ultrasound images of the thyroid gland and their corresponding mask annotations need to be obtained, and the images and masks are preprocessed. The dataset used in this embodiment is a self-built private thyroid ultrasound image dataset, annotated by professionals. Each image is a grayscale ultrasound image, and the corresponding mask is manually drawn by medical experts to accurately depict the contours of the thyroid region for image segmentation tasks. Data annotation uses single-channel grayscale, with different pixel values representing different anatomical structure categories or backgrounds. Before model training, the images and masks undergo unified preprocessing and enhancement operations to ensure input data quality and model generalization ability.
[0047] Data preprocessing mainly includes image scaling, normalization, mask encoding, and optional data augmentation operations. First, the image and mask are resized according to a set scaling factor. The image uses bicubic interpolation (BICUBIC), and the mask uses nearest neighbor interpolation (NEAREST) to ensure clear label boundaries. The image is converted into a floating-point tensor of shape (C,H,W) and normalized to the [0,1] interval, where C=1. The mask is discretized based on its unique pixel value, mapped to a class index (e.g., 0 for background, 1 for the thyroid region), and converted to a LongTensor data type. Furthermore, when augment=True is enabled, synchronous data augmentation operations are performed on the image and mask, including random horizontal flipping, vertical flipping, rotation (±15°), scaling (0.9–1.1x), and center cropping, further improving the model's robustness and generalization ability. Ultimately, the returned image and mask are tensors of (1,H,W) and (1,H,W) respectively, which can be directly used to train the segmentation model.
[0048] S2, Construct a thyroid image segmentation model that incorporates a dual-input channel attention mechanism.
[0049] In this step, the thyroid image segmentation model is based on the UNet network architecture, with several layers in both the encoder and decoder. Each encoder and decoder layer uses two deformable convolutions (DeformConv2d) instead of traditional convolutions. In the encoder, adjacent layers are downsampled to reduce spatial resolution, and then deformable convolutions are used to generate encoded features at the current layer resolution. In the deepest layer of the encoder, a multi-scale attention feature fusion module is used. The encoded features at different resolutions of the encoder are used as input, and a dual-input channel attention mechanism is used to perform channel weighting on the deepest layer's encoded features to generate fused features. The fused features are used as input to the decoder, and the spatial resolution is restored by upsampling layer by layer in the decoder. The encoded features at the corresponding layer resolution are concatenated with the decoded features through skip connections. After concatenation, deformable convolutions are used to fuse information and generate decoded features at the current layer resolution. The decoded features at the top layer resolution are used to generate a segmentation probability map through 1×1 convolutions, and thresholding is used to obtain a predicted binary mask for the thyroid region.
[0050] The thyroid image segmentation model proposed in this invention is named DAMUNet, as follows: Figure 2As shown, it integrates deformable convolution, channel attention, and multi-scale fusion mechanisms. The overall structure is based on U-Net, with the encoder consisting of five layers. Each layer employs two deformable convolutions to enhance its ability to model irregular structures. Simultaneously, a multi-scale attention feature fusion module is added to the deepest layer, interacting with the deepest layer's encoded features (minimum size, maximum number of channels) through dual-input channel attention, guiding the network to focus on key information at multiple levels. In the decoder, transposed convolution or bilinear interpolation + 1×1 convolution is used for layer-by-layer upsampling to restore spatial resolution, combined with skip connections for feature concatenation, followed by deformable convolution for information fusion. Finally, a prediction map is generated through a 1×1 convolution. Compared to traditional UNet, DAmUNet has stronger deformation perception capabilities, more flexible semantic modeling capabilities, and a more accurate channel attention mechanism, making it particularly suitable for segmenting medical images with varied shapes or blurred boundaries, such as thyroid or tumor targets.
[0051] It should be noted that channel attention is an attention mechanism in deep learning, primarily used in computer vision tasks to enhance the model's dynamic perception of the importance of feature channels. Its core idea is to learn the weights of different feature channels to guide the model to focus on features more critical to the current task, while suppressing the influence of redundant or noisy channels. Unlike traditional channel attention, this invention employs a dual-input channel attention mechanism, such as... Figure 4 As shown, a global average pooling layer compresses the encoded features at different resolutions into scalars, obtaining global information for each channel at each resolution. A fully connected layer (or a lightweight multilayer perceptron) learns the dependencies between channels, generating and normalizing channel weight vectors for each resolution. These channel weight vectors are then mapped to the same size as the deepest encoded features, and multiplied one-by-one by the deepest encoded features, dynamically adjusting the response intensity of each channel to obtain the fusion results for each resolution. The fusion results for each resolution are combined as the final fusion result. When combining the fusion results for each resolution, the fusion results are first concatenated along the channel dimension, and then a 1×1 convolution is performed on the concatenated result to generate the final fusion result with the same channel dimension as the deepest encoded features. It can be seen that this invention integrates encoded feature information from different levels (x1–x5), using the encoded features of each layer as attention guides to perform channel weighting on the deepest features, highlighting important semantic information at different scales. By concatenating the fusion results at each scale along the channel dimension and then compressing and fusing them through a 1×1 convolution, a unified output representation is obtained. This approach not only preserves the details and contextual information of multi-scale features, but also enhances the high-level semantic expression capability through the attention mechanism, thereby improving the effectiveness and discriminativeness of feature fusion.
[0052] like Figure 3The diagram shows a multi-scale attention feature fusion module. The five blue boxes represent the encoded features at different resolutions generated by the five encoding layers, while the yellow boxes represent the deepest encoded features. The dual-input channel attention mechanism includes the aforementioned global average pooling layer and fully connected layer. The parameters of the dual-input channel attention mechanism are independent for encoded features at different resolutions.
[0053] Deformable convolution is an improved convolution operation. In traditional convolution operations, it introduces a learnable spatial offset parameter to dynamically predict the position offset vector of the convolution kernel sampling point, uses bilinear interpolation for feature sampling, and generates an output feature map through weighted aggregation to enhance the modeling ability of thyroid region boundary deformation and occlusion.
[0054] S3, using preprocessed data to train a thyroid image segmentation model.
[0055] This embodiment uses U-Net, implemented in PyTorch, as the base model for training. The main process includes: first, setting training hyperparameters (such as learning rate, batch size, model name, etc.) via command-line arguments; then, loading the training data path and constructing training and validation sets using custom classes; and automatically completing image and mask pairing and preprocessing. The training process employs the BCEDeciss loss function, a combined loss function widely used in medical image segmentation tasks, consisting of two core parts: BCELoss (binary cross-entropy loss) and Dice Loss (Dice similarity coefficient loss). The training process includes model saving (based on validation set scores) and early stopping strategies to effectively prevent overfitting.
[0056] S4. The trained thyroid image segmentation model is used to segment the input thyroid ultrasound grayscale image.
[0057] In this step, the model's input is a grayscale ultrasound image of the thyroid gland, which is processed to the same size as during the model training phase. The model's output is the pixel-level segmentation result of the thyroid region.
[0058] Using Dice, IoU, Accuracy, and HD95 as evaluation metrics, this invention is compared with the comparative models UNet, ResUNet, UNet++, and Att_UNet, where:
[0059] UNet is a classic image segmentation neural network, originally designed for medical image segmentation. It has a symmetrical U-shaped structure, consists of an encoder and a decoder, and fuses shallow and deep features through skip connections, thereby improving segmentation accuracy while preserving spatial information.
[0060] ResUNet is an improved image segmentation network that introduces residual connections based on UNet, combining the fine segmentation capabilities of UNet with the deep feature learning advantages of ResNet. Its core feature is the addition of residual structures to each convolutional module, which guides gradient flow through skip connections, alleviating the gradient vanishing problem in deep network training, thereby improving the network's stability and convergence speed.
[0061] UNet++ is an enhanced version of UNet, characterized by the introduction of dense skip connections and a multi-layered feature fusion structure to improve segmentation accuracy. It establishes multiple intermediate nodes (nested sub-networks) between the encoder and decoder to achieve layer-by-layer fusion of features at different depths, thereby enhancing feature propagation and reuse. Furthermore, UNet++ supports deep supervision, allowing simultaneous calculation of loss from multiple output layers during training, improving the network's training efficiency and generalization ability.
[0062] Attention UNet is an improved image segmentation network that introduces an attention mechanism on top of UNet. Its core idea is to add an attention gate to the skip connections, so that the network can automatically learn to "pay attention" to the target region and suppress irrelevant background, thereby improving the accuracy and robustness of segmentation.
[0063] The experimental parameters for this invention are set as follows:
[0064] Dataset and Environment: 1000 clinical thyroid ultrasound images were used, with a resolution of 480×384, and the training / validation / test sets were divided in an 8:1:1 ratio; PyTorch 1.11.0 and CUDA 11.5 were used.
[0065] Network configuration: 5 layers each for encoder and decoder; loss function is BCEDiceLoss; optimizer is Adam.
[0066] Training strategy: batch size 16, initial learning rate 8e-5; total training 100 epochs, using an early stopping strategy.
[0067] The performance results of each model are shown in Table 1.
[0068] Table 1 Performance results of each model
[0069] Evaluation indicators / models UNet ResUNet UNet++ Att_UNet DAmUNet Dice↑ 0.9166 0.9034 0.9154 0.9157 0.9209 IoU↑ 0.8461 0.8240 0.8441 0.8445 0.8535 Accuracy↑ 0.9884 0.9867 0.9881 0.9877 0.9889 HD95↓ 1.4984 2.1319 1.4351 1.5753 1.3264
[0070] As shown in Table 1, the DAmUNet model of this invention outperforms all other models: the DAmUNet model achieves the best performance in all four evaluation metrics. It not only leads in the core metrics of segmentation accuracy, Dice and IoU, and slightly outperforms in overall accuracy, but more importantly, it significantly outperforms other models in HD95, the metric that measures boundary segmentation accuracy.
[0071] This embodiment also provides a thyroid image segmentation system based on UNet and deformable convolution to obtain multi-scale feature fusion, including:
[0072] The thyroid ultrasound grayscale image acquisition module is used to acquire thyroid ultrasound grayscale images. During the training phase, it is also necessary to acquire the corresponding mask annotations for the image and preprocess the image and mask.
[0073] The thyroid image segmentation model module, based on the UNet network architecture, includes an encoder, a decoder, and a multi-scale attention feature fusion module. In the encoder, adjacent layers are downsampled to reduce spatial resolution, and then deformable convolutions are used to generate encoded features at the current layer resolution. In the deepest layer of the encoder, a multi-scale attention feature fusion module is used, taking encoded features at different resolutions from the encoder as input, and using a dual-input channel attention mechanism to perform channel weighting on the deepest layer's encoded features to generate fused features. The fused features are then used as input to the decoder, where layer-by-layer upsampling restores spatial resolution. Skip connections are used to concatenate the encoded features and decoded features at the corresponding layer resolutions. After concatenation, deformable convolutions are used to fuse information and generate decoded features at the current layer resolution. The decoded features at the top layer resolution are used to generate a segmentation probability map through 1×1 convolutions, and thresholding is applied to obtain a predicted binary mask for the thyroid region.
[0074] The model training module is used to calculate the loss based on the predicted binary mask and the actual mask annotation results, and to train the thyroid image segmentation model.
[0075] The thyroid image segmentation module is used to segment the input thyroid ultrasound grayscale image using a trained thyroid image segmentation model, and output the pixel-level segmentation results of the thyroid region.
[0076] For the system embodiments, since they basically correspond to the method embodiments, relevant details can be found in the descriptions of the method embodiments; the implementation methods of the remaining modules will not be repeated here. The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the present invention according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0077] The system embodiments of the present invention can be applied to any device with data processing capabilities, such as a computer or other similar device. The system embodiments can be implemented in software, hardware, or a combination of both. Taking software implementation as an example, as a logical device, it is formed by the processor of any data processing device loading the corresponding computer program instructions from non-volatile memory into memory for execution.
[0078] The above-described embodiments are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the invention. Those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention.
Claims
1. A method for thyroid image segmentation based on UNet and deformable convolution to obtain multi-scale feature fusion, characterized in that, Includes the following steps: (1) Obtain the grayscale image of thyroid ultrasound and the corresponding mask annotation, and preprocess the image and mask; (2) Based on the UNet network architecture, several layers of encoder and decoder are constructed. In the encoder, the spatial resolution of adjacent layers is reduced by downsampling, and then deformable convolution is used to generate the encoded features of the current layer resolution. In the deepest layer of the encoder, a multi-scale attention feature fusion module is used. The encoded features of different resolutions of the encoder are used as input, and the deepest layer encoded features are channel-weighted through a dual-input channel attention mechanism to generate fused features. The fused features are used as the input of the decoder. In the decoder, the spatial resolution is restored by upsampling layer by layer. The encoded features of the corresponding layer resolution are concatenated with the decoded features through skip connections. After concatenation, deformable convolution is used to fuse information to generate the decoded features of the current layer resolution. The decoded features of the top layer resolution are used to generate a segmentation probability map through 1×1 convolution, and the predicted binary mask of the thyroid region is obtained through thresholding. (3) Calculate the loss based on the predicted binary mask and the actual mask annotation results, and train a thyroid image segmentation model that includes an encoder, a decoder and a multi-scale attention feature fusion module; (4) The trained thyroid image segmentation model is used to segment the input thyroid ultrasound grayscale image and output the pixel-level segmentation results of the thyroid region.
2. The thyroid image segmentation method based on UNet and deformable convolution for multi-scale feature fusion as described in claim 1, characterized in that, The preprocessing in step (1) includes: The image and mask are resized using bicubic interpolation, and the mask is scaled using nearest neighbor interpolation. The image is converted into a floating-point tensor of shape (1,H,W) and normalized to the interval [0,1]. The mask is discretized, mapped to a category index, and converted to a LongTensor data type.
3. The thyroid image segmentation method based on UNet and deformable convolution for multi-scale feature fusion as described in claim 2, characterized in that, The preprocessing also includes data augmentation operations on the image and mask.
4. The thyroid image segmentation method based on UNet and deformable convolution for multi-scale feature fusion as described in claim 1, characterized in that, Both the encoder and decoder are five-layered.
5. The thyroid image segmentation method based on UNet and deformable convolution for multi-scale feature fusion according to claim 1, characterized in that, The deformable convolution dynamically predicts the position offset vector of the convolution kernel sampling point by introducing a learnable spatial offset parameter, performs feature sampling using bilinear interpolation, and generates an output feature map through weighted aggregation, thereby enhancing the modeling ability of thyroid region boundary deformation and occlusion.
6. The thyroid image segmentation method based on UNet and deformable convolution for multi-scale feature fusion according to claim 1, characterized in that, The calculation process of the multi-scale attention feature fusion module includes: By compressing the encoded features at different resolutions into scalars through a global average pooling layer, global information for each channel at each resolution is obtained. The channel dependencies are learned through fully connected layers, and channel weight vectors for each resolution are generated and normalized. The channel weight vectors of each resolution are mapped to the same size as the deepest coding feature, and then multiplied with the deepest coding feature one by one by the channel to obtain the fusion result of each resolution. The fusion results from each resolution are combined to form the final fusion result.
7. The thyroid image segmentation method based on UNet and deformable convolution for multi-scale feature fusion as described in claim 6, characterized in that, The dual-input channel attention mechanism includes the global average pooling layer and the fully connected layer. The parameters of the dual-input channel attention mechanism are independent for encoding features of different resolutions.
8. The thyroid image segmentation method based on UNet and deformable convolution for multi-scale feature fusion according to claim 6, characterized in that, The process of combining the fusion results from different resolutions includes: The fusion results of each resolution are stitched together according to the channel dimension; The concatenated result is subjected to a 1×1 convolution to generate a final fusion result with the same dimension as the deepest encoded feature channel.
9. The thyroid image segmentation method based on UNet and deformable convolution for multi-scale feature fusion as described in claim 1, characterized in that, When training the thyroid image segmentation model, BCEDiceLoss was used as the loss function.
10. A thyroid image segmentation system based on UNet and deformable convolution for multi-scale feature fusion, used to implement the thyroid image segmentation method based on UNet and deformable convolution for multi-scale feature fusion as described in claim 1, characterized in that the system... include: The thyroid ultrasound grayscale image acquisition module is used to acquire thyroid ultrasound grayscale images. During the training phase, it is also necessary to acquire the corresponding mask annotations for the image and preprocess the image and mask. The thyroid image segmentation model module, based on the UNet network architecture, includes an encoder, a decoder, and a multi-scale attention feature fusion module. In the encoder, adjacent layers are downsampled to reduce spatial resolution, and then deformable convolutions are used to generate encoded features at the current layer resolution. In the deepest layer of the encoder, a multi-scale attention feature fusion module is used, taking encoded features at different resolutions from the encoder as input, and using a dual-input channel attention mechanism to perform channel weighting on the deepest layer's encoded features to generate fused features. The fused features are then used as input to the decoder, where layer-by-layer upsampling restores spatial resolution. Skip connections are used to concatenate the encoded features and decoded features at the corresponding layer resolutions. After concatenation, deformable convolutions are used to fuse information and generate decoded features at the current layer resolution. The decoded features at the top layer resolution are used to generate a segmentation probability map through 1×1 convolutions, and thresholding is applied to obtain a predicted binary mask for the thyroid region. The model training module is used to calculate the loss based on the predicted binary mask and the actual mask annotation results, and to train the thyroid image segmentation model. The thyroid image segmentation module is used to segment the input thyroid ultrasound grayscale image using a trained thyroid image segmentation model, and output the pixel-level segmentation results of the thyroid region.
Citation Information
Cited By
Three-dimensional medical image segmentation method and system for thyroid-related eye diseases
CN121640056A
Retina layer segmentation method and system, medium, product and computer equipment
CN122023811A
