A thyroid ultrasound nodule segmentation and extraction method based on frequency domain enhanced Swin-UNet
Patent Information
- Application Number
- CN202611096304.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-23
- Publication Date
- 2026-10-27
AI Technical Summary
[0003]为解决现有技术无法克服甲状腺超声图像中斑点噪声强、结节边界模糊、后方回声衰减等干扰,难以对甲状腺超声结节进行自动化、高精度分割提取的技术问题,本发明的目的在于提供一种基于频域增强Swin-UNet的甲状腺超声结节分割提取方法,所采用的技术方案具体如下:一种基于频域增强Swin-UNet的甲状腺超声结节分割提取方法,所述方法包括:采集甲状腺超声图像并进行感兴趣区域裁剪与斑点抑制预处理,获得标准化超声图像;根据超声图像的回声特性对图像进行直方图均衡化数据增强;沿结节边界对增强后的图像进行人工标注,获得参考图像数据集;对参考图像数据集进行归一化处理获得数据集;设计频域增强模块,包括傅里叶变换子模块、频谱补偿子模块与逆变换子模块,用于抑制斑点噪声并增强结节边缘高频信息;基于Swin Transformer设计全局特征编码模块,将输入图像信息转换成张量以提取结节全局上下文特征;基于U-Net设计特征解码模块,用于将编码特征进行上采样并恢复原始图像分辨率;在编码模块与解码模块对应层之间加入跳跃连接,构成FE-SwinUNet融合模型;根据结节边界模糊、前景像素稀疏的特点设计边界加权结构相似性损失函数,获得结节边界区域的损失函数权重;根据损失函数权重进行多尺度监督计算,获得模型反馈;根据FE-SwinUNet融合模型进行训练获得训练好的模型;利用训练好的模型对甲状腺超声图像进行结节分割提取;对分割提取结果进行形态学后处理与连通域分析,获得结节图像结果;对结节图像结果进行纵横比、边缘光整度、回声水平量化统计及恶性风险数据分析
[0010]本发明具有如下优异效果:本发明通过采集高频甲状腺超声图像并进行感兴趣区域裁剪与各向异性扩散斑点抑制,获得标准化超声图像,图像具有丰富的结节形态与回声变化,能够为深度学习模型提供充足的样本;由于超声图像对比度低,故采用限制对比度直方图均衡化对图像进行数据增强,在提高模型泛化能力的同时丰富数据多样性;将图像沿结节边界进行像素级双医师人工标注,获得参考图像数据;对图像数据进行归一化处理以减少运算量并提升训练效率,获得标准数据集;由于超声斑点噪声与结节边缘高频信息在空域混叠,故设计频域增强模块,通过傅里叶变换将图像分解为幅度谱与相位谱,采用可学习高频补偿系数增强结节边缘高频分量,在频域实现斑点噪声抑制与边缘细节增强的解耦;由于结节与周围腺体组织存在全局上下文依赖,故采用Swin Transformer编码模块以窗口自注意力与移位窗口自注意力捕获结节全局上下文特征,避免卷积感受野受限导致的边界不连续问题;采用U-Net解码器恢复图像分辨率并通过跳跃连接融合浅层细节,融合获得FE-SwinUNet融合模型;由于结节边界模糊、前景像素稀疏,故设计边界加权结构相似性损失函数,以边界距离加权强化结构相似性约束并结合交并比损失与交叉熵损失进行多尺度监督,在不损失整体精度的前提下提升边界分割精度;利用训练好的模型对甲状腺超声图像进行分割;由于模型分割结果可能存在细小噪声和孔洞,故采用形态学开闭运算与连通域分析进行后处理,获得完整的结节图像结果;最后对结节图像进行纵横比、边缘光整度、回声水平与恶性风险的统计与数据分析。本发明充分考虑了甲状腺超声结节在频域、形态、回声上的复杂性,设计了独特的频域增强、Swin Transformer全局特征编码与U-Net解码模块,增强了深度学习分割模型的噪声抑制能力与全局上下文表达能力,提升了结节分割的完整度、边界连续性和准确度,为甲状腺结节良恶性评估与随访管理提供了可靠的技术手段。
Smart Images

Figure CN122989775A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical ultrasound image analysis technology, specifically to a method for segmenting and extracting thyroid ultrasound nodules based on frequency domain enhancement Swin-UNet. Background Technology
[0002] Thyroid nodules are among the most common lesions of the endocrine system. The morphology, borders, aspect ratio, internal echogenicity, and calcification characteristics of the nodules directly determine the TI-RADS classification and clinical management plan. Ultrasound examination is the preferred imaging method for screening and diagnosing thyroid nodules. Thyroid nodules appear as focal areas of abnormal echogenicity on ultrasound images, characterized by strong speckled noise, blurred borders, irregular shapes, and small differences in echogenicity compared to normal glandular tissue, posing a significant challenge to accurate segmentation and quantitative characterization of the nodules. Accurate segmentation and quantitative characterization of thyroid ultrasound nodules are of significant clinical importance and application value for assessing the risk of benign or malignant nodules, determining indications for fine-needle aspiration biopsy, and follow-up management. In traditional methods of thyroid nodule analysis, sonographers typically use manual recording combined with empirical measurements for nodule evaluation, which suffers from low efficiency, high subjectivity, and poor inter-physician consistency. In recent years, researchers have successively introduced traditional image processing techniques such as threshold segmentation, active contour model, and graph cut for nodule extraction. However, these methods lack robustness against interference such as ultrasound speckle noise, blurred boundaries of low-echo nodules, and posterior echo attenuation, making it difficult to achieve automated and high-precision nodule segmentation. With the development of deep learning technology, semantic segmentation networks such as U-Net, Attention U-Net, and nnU-Net have achieved significant results in the field of medical image segmentation and have been gradually introduced into thyroid ultrasound analysis. However, thyroid ultrasound nodules have significant speckle noise, weak edge spectral information, and strong global context dependence. Single-structure segmentation networks still have the following shortcomings: (1) The spatial features of ultrasound images are severely affected by speckle noise. High-frequency detail information of nodule edges is mixed with noise, and direct spatial convolution is difficult to distinguish, resulting in blurred boundary segmentation; (2) The receptive field of convolutional networks is limited, and the ability to model the global context relationship between nodules and surrounding glandular tissues is insufficient, which can easily lead to the omission of small nodules and discontinuous boundaries; (3) The loss function does not sufficiently constrain the structural similarity of nodule boundary regions, which can easily lead to undersegmentation or oversegmentation of boundaries. Therefore, there is an urgent need for an automatic segmentation and extraction method that is specific to the characteristics of thyroid ultrasound and has the ability to suppress frequency domain noise and model global context. Summary of the Invention
[0003] To address the technical challenges of automated and high-precision segmentation and extraction of thyroid ultrasound nodules due to interference from strong speckle noise, blurred nodule boundaries, and posterior echo attenuation in existing thyroid ultrasound images, this invention aims to provide a thyroid ultrasound nodule segmentation and extraction method based on frequency domain enhancement Swin-UNet. The specific technical solution is as follows: A thyroid ultrasound nodule segmentation and extraction method based on frequency domain enhancement Swin-UNet, comprising: acquiring thyroid ultrasound images and performing region-of-interest cropping and speckle suppression preprocessing to obtain standardized ultrasound images; performing histogram equalization data enhancement on the images based on the echo characteristics of the ultrasound images; manually annotating the enhanced images along the nodule boundaries to obtain a reference image dataset; normalizing the reference image dataset to obtain a dataset; designing a frequency domain enhancement module, including a Fourier transform submodule, a spectrum compensation submodule, and an inverse transform submodule, to suppress speckle noise and enhance high-frequency information at the nodule edges; based on Swin-UNet... A global feature encoding module based on Transformer is designed to convert input image information into tensors to extract global contextual features of nodules. A feature decoding module based on U-Net is designed to upsample the encoded features and restore the original image resolution. Skip connections are added between corresponding layers of the encoding and decoding modules to form the FE-SwinUNet fusion model. A boundary-weighted structural similarity loss function is designed based on the characteristics of blurred nodule boundaries and sparse foreground pixels to obtain the loss function weights for the nodule boundary region. Multi-scale supervision calculations are performed based on the loss function weights to obtain model feedback. The FE-SwinUNet fusion model is then trained to obtain a trained model. The trained model is used to segment and extract nodules from thyroid ultrasound images. Morphological post-processing and connected component analysis are performed on the segmentation and extraction results to obtain the nodule image results. The nodule image results are then subjected to quantitative statistical analysis of aspect ratio, edge smoothness, echo level, and malignancy risk data.
[0004] Furthermore, the ultrasound image acquisition and preprocessing method includes: acquiring thyroid ultrasound images using a linear array high-frequency probe with a probe center frequency of 7-12MHz, an imaging depth of 3-4cm, and an image resolution of not less than 800×600 pixels; cropping a 256×256 pixel region of interest centered on the nodule; and using anisotropic diffusion filtering to suppress speckle noise in the region of interest, with 10-20 iterations to obtain a standardized ultrasound image.
[0005] Further, the data augmentation and annotation method includes: performing data augmentation on the standardized ultrasound image according to the limited contrast histogram equalization formula, as shown in the following formula: I_out(x,y) = T_clip(I_in(x,y),clipLimit, tileGridSize), where I_out(x,y) represents the grayscale value of the augmented image; I_in(x,y) represents the pixel grayscale value of the input image at (x,y); T_clip(·) represents the contrast-limited local histogram equalization operation; clipLimit represents the contrast limit threshold, with a value range of 1.5-3.0; tileGridSize represents the local block size, with a value of 8×8; manually annotating the augmented image along the nodule boundary at the pixel level, with two ultrasound physicians independently annotating and the annotations reviewed and confirmed by a senior physician, to generate reference image data; and performing normalization processing based on the grayscale information of the reference image, linearly mapping the pixel values to the [0,1] interval to obtain the standard dataset.
[0006] Further, the method for obtaining the FE-SwinUNet fusion model includes: reshaping the input ultrasound image into a 256×256×1 tensor; the Fourier transform submodule of the frequency domain enhancement module performs a two-dimensional fast Fourier transform on the input image to obtain the amplitude spectrum and phase spectrum; the spectrum compensation submodule uses learnable high-frequency compensation coefficients to weight and compensate the high-frequency components of the amplitude spectrum and reconstructs it with the phase spectrum; the inverse transform submodule performs a two-dimensional inverse Fourier transform on the reconstructed spectrum to output the frequency domain enhanced image; the spectrum compensation formula is: A_enh(u,v) = A(u,v)·(1 + μ·H(u,v)), where A(u,v) is the amplitude spectrum; H(u,v) is the high-pass filter; μ is the learnable compensation coefficient; A_enh(u,v) is the compensated amplitude spectrum; and the FE-SwinUNet fusion model is pre-trained on ImageNet. The Transformer, as the global feature encoding module, divides the frequency domain enhanced image into 4×4 tokens and extracts the nodal global feature maps at four scales through alternating four-stage window self-attention and shift window self-attention. The U-Net decoder is used as the feature decoding module, and the deep features are gradually restored to the original image resolution through four upsampling and convolutional blocks. Skip connections are added between the corresponding layers of the encoding and decoding modules to obtain the FE-SwinUNet fusion model.
[0007] Furthermore, the method for obtaining the boundary-weighted structural similarity loss function includes: addressing the problems of blurred nodal boundaries, sparse foreground pixels, and insufficient boundary structure constraints, introducing a boundary distance weighting mechanism based on the structural similarity loss, and combining the intersection-union loss and cross-entropy loss to obtain the boundary-weighted structural similarity loss function, calculated as follows: W(x,y) = 1 + γ_b·exp(-D(x,y) / τ), L_ssim = 1 - MSSIM(P, G)·W̄, L_iou = 1- TP / (TP + FP + FN), L = λ1·L_ssim + λ2·L_iou + λ3·L_BCE, where D(x,y) is the Euclidean distance from pixel (x,y) to the nodule boundary; τ is the distance decay coefficient, with a value of 8 pixels; γ_b is the boundary enhancement coefficient, with a value of 3; P is the model-predicted nodule probability map; G is the nodule ground truth mask; MSSIM(·) is the multi-scale structural similarity measure; W̄ is the boundary distance weight normalization term; TP is the number of true positive pixels in the nodule region; FP is the number of false positive pixels where glandular tissue is misclassified as a nodule; FN is the number of false negative pixels where nodule is misclassified as glandular tissue; L_iou is the crossover union ratio loss; L_BCE is the pixel binary cross-entropy loss; λ1, λ2, and λ3 are multi-task balance coefficients; the loss function is used to perform multi-scale supervised calculations on the FE-SwinUNet fusion model to obtain model feedback.
[0008] Furthermore, the model training method includes: using pixels in the nodule region as the foreground target and pixels in the normal glandular tissue region as the background; initializing the global feature encoding module with weights pre-trained on ImageNet using Swin Transformer for transfer learning; freezing the shallow stage of the encoding module for warm-up training during training, and then unfreezing all parameters for fine-tuning; setting the initial learning rate to 1×10^-4 and dynamically adjusting it according to the cosine annealing strategy; setting the batch size to 16 and iterating for at least 150 epochs; stopping training when the Dice coefficient on the validation set no longer increases for 15 consecutive epochs and saving the optimal model weights.
[0009] Furthermore, the morphological post-processing and connected component analysis method includes: binarizing the model segmentation and extraction result image according to a preset threshold; using morphological opening operations to remove isolated noise points and small burrs, the opening operation formula is: O(A,B) = (A⊖B)⊕B; using morphological closing operations to fill small pores inside the nodules and smooth the nodule boundaries, the closing operation formula is: C(A,B) = (A⊕B)⊖B, where A is the input binary image and B is the structuring element; marking each nodule region according to connected component analysis, removing pseudo-nodule regions with an area smaller than a preset threshold, calculating the aspect ratio, edge smoothness, internal echo mean, and echo uniformity of each nodule; performing TI-RADS sign analysis based on quantitative features and assessing the malignancy risk to obtain the final nodule image results and statistical parameters.
[0010] This invention offers the following advantages: It acquires high-frequency thyroid ultrasound images and performs region-of-interest (ROI) cropping and anisotropic diffusion speckle suppression to obtain standardized ultrasound images. These images possess rich nodule morphology and echo variations, providing ample samples for deep learning models. Due to the low contrast of ultrasound images, contrast-limited histogram equalization is used for image data augmentation, improving model generalization ability while enriching data diversity. Pixel-level dual-physician manual annotation is performed along the nodule boundaries to obtain reference image data. Image data is normalized to reduce computational load and improve training efficiency, resulting in a standard dataset. Since ultrasound speckle noise and high-frequency information at the nodule edge overlap in the spatial domain, a frequency domain enhancement module is designed. Fourier transform decomposes the image into amplitude and phase spectra, and learnable high-frequency compensation coefficients are used to enhance the high-frequency components at the nodule edge, achieving decoupling of speckle noise suppression and edge detail enhancement in the frequency domain. Because of the global contextual dependency between the nodule and surrounding glandular tissue, a Swing algorithm is employed. The Transformer encoding module captures global contextual features of nodules using window self-attention and shifted window self-attention, avoiding boundary discontinuities caused by the limited receptive field of convolution. A U-Net decoder is used to restore image resolution and shallow details are fused through skip connections to obtain the FE-SwinUNet fusion model. Due to blurred nodule boundaries and sparse foreground pixels, a boundary-weighted structural similarity loss function is designed. This function uses boundary distance weighting to strengthen structural similarity constraints and combines cross-union loss and cross-entropy loss for multi-scale supervision, improving boundary segmentation accuracy without sacrificing overall precision. The trained model is then used to segment thyroid ultrasound images. Since the segmentation results may contain minor noise and holes, morphological opening and closing operations and connected component analysis are used for post-processing to obtain complete nodule image results. Finally, statistical and data analysis is performed on the nodule images regarding aspect ratio, edge smoothness, echo level, and malignancy risk. This invention fully considers the complexity of thyroid ultrasound nodules in terms of frequency domain, morphology, and echo. It designs a unique frequency domain enhancement, Swin Transformer global feature encoding, and U-Net decoding module, which enhances the noise suppression and global context expression capabilities of the deep learning segmentation model, improves the integrity, boundary continuity, and accuracy of nodule segmentation, and provides a reliable technical means for the assessment and follow-up management of benign and malignant thyroid nodules. Attached Figure Description
[0011] To more clearly illustrate the solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Figure 1This is a flowchart of a thyroid ultrasound nodule segmentation and extraction method based on frequency domain enhancement Swin-UNet, provided by an embodiment of the present invention. Figure 2 This is a network structure diagram of the FE-SwinUNet fusion model provided in one embodiment of the present invention. Detailed Implementation
[0012] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of a thyroid ultrasound nodule segmentation and extraction method based on frequency domain enhancement Swin-UNet proposed according to the present invention. In the following description, different embodiments or one embodiment do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments may be combined in any suitable form. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The specific scheme of a thyroid ultrasound nodule segmentation and extraction method based on frequency domain enhancement Swin-UNet provided by the present invention is described in detail below with reference to the accompanying drawings.
[0013] Please see Figure 1 This illustrates a method for segmenting and extracting thyroid ultrasound nodules based on frequency domain enhancement Swin-UNet, provided by an embodiment of the present invention. The method includes the following steps.
[0014] Step S1: Acquire thyroid ultrasound images and perform region of interest (ROI) cropping and speckle suppression preprocessing to obtain standardized ultrasound images. This embodiment of the invention is mainly applied to the segmentation scenario of thyroid nodule ultrasound screening. To obtain thyroid nodule ultrasound image data, high-frequency ultrasound images are first acquired, and standardized images are obtained after ROI cropping and speckle suppression. Since this embodiment uses a deep learning model to segment nodules, the model network requires a large number of ultrasound image samples containing nodule morphology to ensure sufficient generalization ability. Preferably, in one embodiment of the invention, the ultrasound image acquisition and preprocessing method includes: acquiring thyroid ultrasound images using a linear array high-frequency probe with a probe center frequency of 10MHz, an imaging depth of 3.5cm, and an image resolution of 1024×768 pixels; cropping a 256×256 pixel ROI centered on the nodule by an ultrasound physician; using anisotropic diffusion filtering to suppress speckle noise in the ROI, with 15 iterations and a time step of 0.15; collecting no less than 3000 ultrasound images containing solid and mixed cystic-solid thyroid nodules to ensure the diversity and representativeness of the dataset.
[0015] Step S2: Histogram equalization is performed on the ultrasound images to enhance data based on their echo characteristics. The enhanced images are manually labeled along the nodule boundaries to obtain a reference image dataset. The reference image dataset is then normalized to obtain the final dataset. Since the acquired ultrasound images exhibit differences in gain and dynamic range between devices, contrast-limited histogram equalization is used for data enhancement, improving model generalization ability while enriching data diversity. Because the echo distribution in the nodule region differs significantly from that in the normal glandular region, pixels are manually labeled pixel-by-pixel along the nodule boundaries. Since nodule segmentation and extraction only requires focusing on relative echo differences, image normalization is performed to reduce computational load and improve training efficiency, resulting in a standard dataset. Preferably, in one embodiment of the present invention, the data augmentation and annotation method includes: enhancing the image according to the limited contrast histogram equalization formula, with clipLimit set to 2.0 and tileGridSize set to 8×8; expanding the dataset to 8-10 times its original size by performing horizontal flipping, ±10° random rotation and random elastic deformation on each original image; having two sonographers perform pixel-level annotation along the nodule boundary, with the divergence points reviewed and confirmed by senior physicians, marking the nodule region pixels as 1 and the glandular tissue region pixels as 0, generating reference image data; linearly mapping all image grayscale values to the [0,1] interval according to I_norm = (I - I_min) / (I_max - I_min), and randomly dividing them into training set, validation set and test set in a ratio of 8:1:1.
[0016] Step S3: Design a frequency domain enhancement module; design a global feature encoding module based on Swing Transformer; design a feature decoding module based on U-Net; obtain the FE-SwinUNet fusion model through skip connections. In one embodiment of the present invention, the method for obtaining the FE-SwinUNet fusion model includes: using a frequency domain enhancement module to suppress speckle noise and enhance high-frequency information of nodule edges; using a global feature encoding module to extract global contextual features of nodules; and using a feature decoding module to restore image resolution and output segmentation results. Preferably, in one embodiment of the present invention, the frequency domain enhancement module design method includes: the input layer reshaping the input ultrasound image into a 256×256×1 tensor; the Fourier transform submodule performing a two-dimensional fast Fourier transform on the input image and shifting the zero-frequency component to the center of the spectrum to decompose and obtain the amplitude spectrum and phase spectrum; the spectrum compensation submodule performing high-frequency compensation on the amplitude spectrum according to the spectrum compensation formula A_enh(u,v) = A(u,v)·(1 + μ·H(u,v)), where H(u,v) is a Butterworth high-pass filter with a cutoff frequency of 0.1π and μ is a learnable compensation coefficient with an initial value of 0.5; the inverse transform submodule recombining the compensated amplitude spectrum with the original phase spectrum, outputting a frequency domain enhanced image through a two-dimensional inverse Fourier transform, and adding it to the residual of the original image. Preferably, in one embodiment of the present invention, the design method of the global feature encoding module and the decoding module includes: using Swin Transformer-Tiny pre-trained on ImageNet as the global feature encoding module, dividing the frequency domain enhanced image into 4×4 tokens, extracting global features alternately through 4-stage window self-attention and shift window self-attention, and outputting 4 nodal global feature maps with scales of 64×64×96, 32×32×192, 16×16×384, and 8×8×768; the U-Net decoder consists of 4 upsampling stages, each stage including 2x bilinear upsampling, 3×3 convolution, batch normalization and ReLU activation, and adding skip connections between corresponding layers of the encoding module and the decoding module; the output layer outputs a 256×256 nodal probability map after 1×1 convolution and Sigmoid activation, and the FE-SwinUNet fusion model is obtained by fusion.
[0017] Step S4: Based on the characteristics of blurred nodule boundaries and sparse foreground pixels, a boundary-weighted structural similarity loss function is designed to obtain the loss function weights for the nodule boundary region. Multi-scale supervised calculations are then performed based on these weights to obtain model feedback. The echo and structural information of the nodule region and the normal glandular region are obtained through the above process. Due to the blurred nodule boundaries, sparse foreground pixels, and insufficient boundary structural constraints, a boundary-weighted structural similarity loss function is designed and calculated based on the aforementioned feature information to obtain model feedback. Preferably, in one embodiment of the present invention, the model feedback acquisition method includes: obtaining the loss weight of the nodule boundary region according to the boundary weighted structural similarity loss function calculation formula, and calculating the model feedback. The calculation formula is as follows: W(x,y) = 1 + γ_b·exp(-D(x,y) / τ), L_ssim = 1 - MSSIM(P, G)·W̄, L_iou = 1 - TP / (TP + FP + FN), L = λ1·L_ssim + λ2·L_iou + λ3·L_BCE, where D(x,y) is generated by transforming the ground truth mask boundary through Euclidean distance; τ is 8 pixels; γ_b is 3; λ1, λ2, and λ3 are 0.4, 0.4, and 0.2, respectively; a multi-scale supervision strategy is adopted, and the outputs of the last three stages of the decoder are all connected to the auxiliary segmentation head, and the total loss is jointly calculated with the main output according to the weights of 0.3, 0.3, and 0.4 to obtain the model feedback.
[0018] Step S5: Train the FE-SwinUNet fusion model to obtain a trained model; use the trained model to segment and extract nodules from thyroid ultrasound images; perform morphological post-processing and connected component analysis on the segmentation and extraction results to obtain nodule image results; perform quantitative statistical analysis on aspect ratio, edge smoothness, echo level, and malignancy risk data on the nodule image results. Preferably, in one embodiment of the present invention, the model obtained by training based on the FE-SwinUNet fusion model includes: employing a transfer learning strategy, using the weights of the Swin Transformer pre-trained on ImageNet to initialize the global feature encoding module; during training, freezing the first two stages of the encoding module for 20 epochs of warm-up training, and then unfreezing all parameters for fine-tuning; setting the initial learning rate to 1×10^-4, and smoothly decaying it from 1×10^-4 to 1×10^-6 using a cosine annealing strategy; setting the batch size to 16, using the AdamW optimizer, and a weight decay coefficient of 1×10^-2; iteratively training for 150 epochs, stopping training when the Dice coefficient on the validation set no longer increases for 15 consecutive epochs, and saving the optimal model weights. The trained model is then used to segment thyroid ultrasound images, minimizing the problem of incomplete segmentation results and category confusion caused by the similarity of echo features between nodules and glandular tissue, thereby improving segmentation accuracy and completing the segmentation of thyroid nodules. Preferably, in one embodiment of the present invention, the morphological post-processing and connected component analysis method includes: binarizing the image obtained from model segmentation and extraction with a threshold of 0.5; performing morphological opening operations using 3×3 elliptical structuring elements to remove isolated noise points and small burrs with an area less than 20 pixels; performing morphological closing operations using 5×5 elliptical structuring elements to fill small pores inside the nodules and smooth the nodule boundaries; marking each nodule region according to connected component analysis and removing pseudo-nodule regions with an area less than a preset threshold; calculating the aspect ratio, edge smoothness, internal echo mean, and echo uniformity of each nodule; performing TI-RADS sign analysis based on quantitative features, with aspect ratio greater than 1, rough edges, and significant hypoechoic areas respectively counted as signs of malignancy risk and a malignancy risk score calculated. Thus, the segmentation and extraction of thyroid ultrasound nodules is completed.
[0019] In summary, thyroid ultrasound images were acquired and preprocessed with region-of-interest cropping and speckle suppression to obtain standardized ultrasound images. Histogram equalization was applied to enhance the images based on their echo characteristics. The enhanced images were manually annotated along nodule boundaries to obtain a reference image dataset. This reference image dataset was then normalized to obtain a new dataset. A frequency domain enhancement module was designed. A global feature encoding module based on Swin Transformer was designed. A feature decoding module based on U-Net was designed. A FE-SwinUNet fusion model was obtained through skip connection fusion. A boundary-weighted structural similarity loss function was designed based on the characteristics of blurred nodule boundaries and sparse foreground pixels. Multi-scale supervised calculations were performed based on the loss function weights to obtain model feedback. The FE-SwinUNet fusion model was trained to obtain a trained model. The trained model was used to segment and extract nodules from thyroid ultrasound images. Morphological post-processing and connected component analysis were performed on the segmentation and extraction results to obtain nodule image results. The nodule image results were then subjected to quantitative statistical analysis of aspect ratio, edge smoothness, echo level, and malignancy risk data. This invention can segment, extract, and quantitatively characterize different types of thyroid nodules, such as solid and mixed cystic-solid nodules, providing technical support for the assessment and follow-up management of benign and malignant thyroid nodules.
[0020] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous. The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments.
Claims
1. A method for segmenting and extracting thyroid ultrasound nodules based on frequency domain enhancement Swin-UNet, characterized in that, The method includes: acquiring thyroid ultrasound images and performing region-of-interest (ROI) cropping and speckle suppression preprocessing to obtain standardized ultrasound images; performing histogram equalization data enhancement on the images based on their echo characteristics; manually annotating the enhanced images along the nodule boundaries to obtain a reference image dataset; normalizing the reference image dataset to obtain a new dataset; designing a frequency domain enhancement module, including a Fourier transform submodule, a spectrum compensation submodule, and an inverse transform submodule, to suppress speckle noise and enhance high-frequency information at the nodule edges; based on Swin... A global feature encoding module based on Transformer is designed to convert input image information into tensors to extract global contextual features of nodules. A feature decoding module based on U-Net is designed to upsample the encoded features and restore the original image resolution. Skip connections are added between corresponding layers of the encoding and decoding modules to form the FE-SwinUNet fusion model. A boundary-weighted structural similarity loss function is designed based on the characteristics of blurred nodule boundaries and sparse foreground pixels to obtain the loss function weights for the nodule boundary region. Multi-scale supervision calculations are performed based on the loss function weights to obtain model feedback. The FE-SwinUNet fusion model is then trained to obtain a trained model. The trained model is used to segment and extract nodules from thyroid ultrasound images. Morphological post-processing and connected component analysis are performed on the segmentation and extraction results to obtain the nodule image results. The nodule image results are then subjected to quantitative statistical analysis of aspect ratio, edge smoothness, echo level, and malignancy risk data.
2. The method for thyroid ultrasound nodule segmentation and extraction based on frequency domain enhancement Swin-UNet according to claim 1, characterized in that, The ultrasound image acquisition and preprocessing method includes: acquiring thyroid ultrasound images using a linear array high-frequency probe with a probe center frequency of 7-12MHz, an imaging depth of 3-4cm, and an image resolution of not less than 800×600 pixels; cropping a 256×256 pixel region of interest centered on the nodule; and using anisotropic diffusion filtering to suppress speckle noise in the region of interest, with 10-20 iterations to obtain a standardized ultrasound image.
3. The method for thyroid ultrasound nodule segmentation and extraction based on frequency domain enhancement Swin-UNet according to claim 1, characterized in that, The data augmentation and annotation method includes: performing data augmentation on standardized ultrasound images according to a limited contrast histogram equalization formula, as shown in the following formula: I_out(x,y) = T_clip(I_in(x,y),clipLimit, tileGridSize), where I_out(x,y) represents the grayscale value of the augmented image; I_in(x,y) represents the pixel grayscale value at (x,y) in the input image; T_clip(·) represents the contrast-limited local histogram equalization operation; clipLimit represents the contrast limit threshold, with a value ranging from 1.5 to 3.0; tileGridSize represents the local block size, with a value of 8×8; manually annotating the augmented image along the nodule boundary at the pixel level, with two ultrasound physicians independently annotating and the annotations reviewed and confirmed by a senior physician, generating reference image data; and performing normalization processing based on the grayscale information of the reference image, linearly mapping the pixel values to the [0,1] interval to obtain the standard dataset.
4. The method for thyroid ultrasound nodule segmentation and extraction based on frequency domain enhancement Swin-UNet according to claim 1, characterized in that, The method for obtaining the FE-SwinUNet fusion model includes: reshaping the input ultrasound image into a 256×256×1 tensor; the Fourier transform submodule of the frequency domain enhancement module performs a two-dimensional fast Fourier transform on the input image to obtain the amplitude spectrum and phase spectrum; the spectrum compensation submodule uses learnable high-frequency compensation coefficients to weight and compensate the high-frequency components of the amplitude spectrum and reconstructs it with the phase spectrum; the inverse transform submodule performs a two-dimensional inverse Fourier transform on the reconstructed spectrum to output the frequency domain enhanced image; the spectrum compensation formula is: A_enh(u,v) = A(u,v)·(1 + μ·H(u,v)), where A(u,v) is the amplitude spectrum; H(u,v) is the high-pass filter; μ is the learnable compensation coefficient; A_enh(u,v) is the compensated amplitude spectrum; and the FE-SwinUNet fusion model is pre-trained on ImageNet. The Transformer, as the global feature encoding module, divides the frequency domain enhanced image into 4×4 tokens and extracts the nodal global feature maps at four scales through alternating four-stage window self-attention and shift window self-attention. The U-Net decoder is used as the feature decoding module, and the deep features are gradually restored to the original image resolution through four upsampling and convolutional blocks. Skip connections are added between the corresponding layers of the encoding and decoding modules to obtain the FE-SwinUNet fusion model.
5. The method for thyroid ultrasound nodule segmentation and extraction based on frequency domain enhancement Swin-UNet according to claim 1, characterized in that, The method for obtaining the boundary-weighted structural similarity loss function includes: addressing the problems of blurred nodal boundaries, sparse foreground pixels, and insufficient boundary structure constraints, introducing a boundary distance weighting mechanism based on structural similarity loss, and combining intersection-union loss and cross-entropy loss to obtain the boundary-weighted structural similarity loss function. The calculation formula is as follows: W(x,y) = 1 + γ_b·exp(-D(x,y) / τ), L_ssim = 1 - MSSIM(P, G)·W̄, L_iou = 1 - TP / (TP + FP + FN), L = λ1·L_ssim + λ2·L_iou + λ3·L_BCE, where D(x,y) is the Euclidean distance from pixel (x,y) to the nodule boundary; τ is the distance decay coefficient, with a value of 8 pixels; γ_b is the boundary enhancement coefficient, with a value of 3; P is the model-predicted nodule probability map; G is the nodule ground truth mask; MSSIM(·) is the multi-scale structural similarity measure; W̄ is the boundary distance weight normalization term; TP is the number of true positive pixels in the nodule region; FP is the number of false positive pixels where glandular tissue is misclassified as a nodule; FN is the number of false negative pixels where nodule is misclassified as glandular tissue; L_iou is the crossover union ratio loss; L_BCE is the pixel binary cross-entropy loss; λ1, λ2, and λ3 are multi-task balance coefficients; the loss function is used to perform multi-scale supervised calculations on the FE-SwinUNet fusion model to obtain model feedback.
6. The method for thyroid ultrasound nodule segmentation and extraction based on frequency domain enhancement Swin-UNet according to claim 1, characterized in that, The model training method includes: using pixels in the nodule region as the foreground target and pixels in the normal glandular tissue region as the background; initializing the global feature encoding module with weights pre-trained on ImageNet using Swin Transformer for transfer learning; freezing the shallow stage of the encoding module for warm-up training during training, and then unfreezing all parameters for fine-tuning; setting the initial learning rate to 1×10^-4 and dynamically adjusting it according to the cosine annealing strategy; setting the batch size to 16 and iterating for at least 150 epochs; stopping training when the Dice coefficient on the validation set no longer increases for 15 consecutive epochs and saving the optimal model weights.
7. The method for thyroid ultrasound nodule segmentation and extraction based on frequency domain enhancement Swin-UNet according to claim 1, characterized in that, The morphological post-processing and connected component analysis method includes: binarizing the model segmentation and extraction result image according to a preset threshold; using morphological opening operations to remove isolated noise points and small burrs, the opening operation formula is: O(A,B) = (A⊖B)⊕B; using morphological closing operations to fill small pores inside the nodules and smooth the nodule boundaries, the closing operation formula is: C(A,B) = (A⊕B)⊖B, where A is the input binary image and B is the structuring element; marking each nodule region according to connected component analysis, removing pseudo-nodule regions with an area smaller than a preset threshold, calculating the aspect ratio, edge smoothness, internal echo mean, and echo uniformity of each nodule; performing TI-RADS sign analysis based on quantitative features and assessing the malignancy risk to obtain the final nodule image results and statistical parameters.