A breast ultrasound tumor image segmentation method
Patent Information
- Application Number
- CN202611288227.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-24
- Publication Date
- 2026-10-27
AI Technical Summary
[0005]本发明目的在于提供一种乳腺超声肿瘤图像分割方法,能够在进行医学图像分割时提升分割指标,更精准分割的同时比起其他较为先进的混合双路径框架方法有更少的计算复杂度和推理时间,以解决现有技术中低对比度异形病灶分割断裂、边缘失真并引发语义鸿沟及无法适配复杂超声影像的精准分割需求的技术问题
[0034]相对于现有技术,本发明具有以下有益技术效果:本发明创新地提出了一种将注意力特征与卷积特征融合的混合双路径框架网络,能够在进行医学图像分割时提升分割指标,更精准分割的同时比起其他较为先进的混合双路径网络方法有更少的计算复杂度和推理时间。除此之外,本发明整体模型结构精简、适配性强,硬件部署门槛低,可灵活适配不同等级的终端设备,既能够在高性能服务器、云端平台实现批量快速分割处理,也可部署在嵌入式终端、医用轻量化设备等算力有限的硬件场景中,满足临床床边诊断、实时影像筛查、基层医疗设备落地等多样化应用需求。
Smart Images

Figure CN122989779A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of electronic digital data processing technology, and particularly relates to a method for segmenting breast ultrasound tumor images. Background Technology
[0002] Ultrasound imaging technology utilizes high-frequency ultrasound waves propagating inside the human body. Upon encountering different tissues or interfaces, the waves are reflected and refracted, and the echoes are received by the probe. These echoes are then processed by a computer and converted into real-time images, displaying the morphology, location, and movement of lesions. This technology is widely used in medical diagnosis due to its radiation-free nature, real-time dynamic observation capabilities, ease of operation, and relatively low cost, especially for breast cancer screening in women under 40. However, ultrasound images have relatively weak spatial resolution and contrast. In dense breast tissue, the echo difference between normal and lesion tissue is small, which may mask small lesions.
[0003] In recent years, deep learning-based medical image segmentation technology has achieved significant breakthroughs. Among them, U-shaped encoder-decoder networks (such as U-Net and its variants) have become the mainstream architecture for medical image segmentation due to their effectiveness in pixel-level localization. Existing hybrid dual-path networks attempt to extract complementary features through parallel branches. Some scholars have proposed MF-Net, which uses a Transformer-assisted dual encoder in conjunction with multiple feature extraction branches to model long-range global dependencies and robust local details respectively, thereby improving the segmentation accuracy of breast lesion boundaries. Other scholars have proposed EH-Former, which designs a dual-stream Transformer that perceives both easy and difficult regions. The two paths separately handle features from easy and difficult regions, and progressive learning is achieved through dynamic fusion, effectively dealing with noise and blurred boundaries in ultrasound images. Some scholars have proposed Syn-Net, which constructs a synchronous local-global dual-branch encoder and integrates multi-scale features with the help of a frequency-aware cross-fusion module, enhancing the ability to distinguish complex tissue structures and regions with similar intensity.
[0004] Although deep learning has made significant progress in medical image segmentation, existing methods still have limitations. Traditional skip connections only achieve fixed deep and shallow feature stitching, making it difficult to model hierarchical dependencies. This leads to fragmented segmentation of low-contrast atypical lesions, edge distortion, and semantic gaps. At the same time, most single-branch models either have excessive computational overhead due to stacked complex attention mechanisms, or they struggle to balance local detail mining with global semantic fusion, making them unsuitable for the precise segmentation requirements of complex ultrasound images. Summary of the Invention
[0005] The purpose of this invention is to provide a method for segmenting breast ultrasound tumor images, which can improve segmentation metrics and achieve more accurate segmentation when performing medical image segmentation. Compared with other more advanced hybrid dual-path framework methods, it has less computational complexity and inference time, thereby solving the technical problems of low-contrast atypical lesion segmentation fragmentation, edge distortion leading to semantic gaps, and inability to adapt to the accurate segmentation requirements of complex ultrasound images in existing technologies.
[0006] To solve the above-mentioned technical problems, the specific technical solution of the present invention is as follows:
[0007] A method for segmenting breast ultrasound tumor images, the method comprising the following steps:
[0008] Step S1: Collect breast ultrasound medical datasets and separate the breast tumor ultrasound image datasets into training set, validation set, and test set;
[0009] Step S2: Process the images in the breast ultrasound medical dataset to the same size, and enhance the images in the training set using random rotation and horizontal flipping operations;
[0010] Step S3: Construct a hybrid dual-path medical image segmentation model, which consists of a convolutional coding layer, an attention coding layer, an attention feature fusion unit, a convolutional feature fusion unit, two spatial pyramid feature enhancers, a convolutional and attention feature mixer, and a decoding layer.
[0011] Step S4: Input the images to be processed in the training set into the hybrid dual-path medical image segmentation model for segmentation to obtain segmented images;
[0012] Step S5: Construct a loss function to train the hybrid dual-path medical image segmentation model, and obtain the trained hybrid dual-path medical image segmentation model;
[0013] Step S6: Use the trained hybrid dual-path medical image segmentation model to segment the ultrasound images of breast tumors in the test set.
[0014] Further, step S3 includes the following steps:
[0015] Step S31: Construct a convolutional coding layer; the convolutional coding layer contains four convolutional encoders cascaded in sequence, each of which contains a 3×3 convolution, a normalization layer, a channel-dilated compressive convolution, a residual connection, a 3×3 convolutional downsampling layer, a normalization layer, a channel-dilated compressive convolution, a 1×1 convolutional downsampling layer, and a residual connection cascaded in sequence.
[0016] Step S32: Construct an attention encoding layer, which contains 12 cascaded attention encoders. Each attention encoder contains a normalization layer, a multi-head attention layer, a residual connection, a normalization layer, a multilayer perceptron, and a residual connection, all cascaded together.
[0017] Step S33: Construct an attention feature fusion unit; the attention feature fusion unit consists of sequentially cascaded 3×3 convolutions, normalization layers, adaptive pooling layers, shared convolutional kernels, sigmoid activations, and residual connections.
[0018] Step S34: Construct a convolutional feature fusion layer; the convolutional feature fusion layer consists of cascaded 3×3 convolutions, normalization layers, 1×1 convolutions, shared linear layers, self-attention layers, and residual connections.
[0019] Step S35: Construct a spatial pyramid feature enhancer; the spatial pyramid feature enhancer includes sequentially cascaded channel splitting, dilated convolution, depthwise separable convolution, channel concatenation, 1×1 convolution, activation layer and residual connection;
[0020] Step S36: Construct a convolutional and attention feature mixer; the convolutional and attention feature mixer includes sequentially cascaded adaptive pooling, 1×1 convolution, softmax activation, learnable convolutional kernel, depthwise convolution, channel-dilation compressive convolution, depthwise separable convolution, residual connections, and activation layers;
[0021] Step S37: Construct the decoding layer; the decoding layer contains 4 decoders cascaded in sequence, each decoder containing 3×3 convolution, normalization layer, channel dilation and compression convolution, residual connection, 3×3 convolution upsampling, normalization layer, channel dilation and compression convolution, 1×1 convolution upsampling and residual connection in sequence.
[0022] Further, step S4 includes the following steps:
[0023] Step S41: Input the same image to be processed from the training set into the convolutional coding layer and the attention coding layer to obtain convolutional features and attention features respectively;
[0024] Step S42: Input the attention features and convolutional features into the attention feature fusion processor to obtain fused convolutional features;
[0025] Step S43: Input the attention features and convolutional features into the convolutional feature fusion processor to obtain the fused attention features;
[0026] Step S44: Input the fused convolutional features into the first spatial pyramid feature enhancer to obtain enhanced convolutional features;
[0027] Step S45: Input the fused attention features into the second spatial pyramid feature enhancer to obtain enhanced attention features;
[0028] Step S46: Concatenate the enhanced convolutional features and the enhanced attention features through channels to obtain the concatenated features;
[0029] Step S47: Input the concatenated features into the convolution and attention feature mixer to obtain the mixed features;
[0030] Step S48: Input the mixed features into the decoding layer to obtain the segmented image.
[0031] Furthermore, the loss function in step S5 is:
[0032]
[0033] in, Represents the loss function. Indicates the proportionality coefficient; Represents the binary cross-entropy loss function; Represents the Dice loss function; It is a predicted value. That is the target value.
[0034] Compared to existing technologies, this invention offers the following advantages: It innovatively proposes a hybrid dual-path framework network that fuses attention features and convolutional features, improving segmentation metrics in medical image segmentation. This results in more accurate segmentation while exhibiting lower computational complexity and inference time compared to other advanced hybrid dual-path network methods. Furthermore, the overall model structure is streamlined, highly adaptable, and has a low hardware deployment threshold. It can flexibly adapt to different levels of terminal devices, enabling rapid batch segmentation processing on high-performance servers and cloud platforms, as well as deployment in hardware scenarios with limited computing power, such as embedded terminals and lightweight medical devices. This meets diverse application needs such as bedside diagnosis, real-time image screening, and the deployment of primary healthcare equipment. Attached Figure Description
[0035] To more clearly illustrate the technical 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 some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0036] Figure 1 This is a flowchart illustrating the implementation process of the present invention.
[0037] Figure 2 The components listed in the figure are, in order, the convolutional encoder, the attention encoder, and the decoder in the implementation method of this invention.
[0038] Figure 3 The components in the middle are, in order, the attention feature fusion unit and the convolution feature fusion unit in the implementation method of this invention.
[0039] Figure 4 The components in the middle are, in order, the spatial pyramid enhancer and the convolutional and attention feature mixer in the implementation method of this invention.
[0040] Figure 5 This is a visual comparison of the segmentation results obtained by the method of this invention. Detailed Implementation
[0041] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0042] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only for explaining the invention and are not intended to limit the invention; that is, the described embodiments are merely some embodiments of the invention, and not all embodiments. The components of the embodiments of the invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0043] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention. It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0044] Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0045] Example 1:
[0046] This invention proposes a method for segmenting breast ultrasound tumor images, such as... Figure 1-4 As shown, the method includes the following steps:
[0047] Step S1: Collect breast ultrasound medical datasets and separate the breast tumor ultrasound image datasets into training set, validation set, and test set.
[0048] Specifically, publicly available breast ultrasound medical datasets were collected, which included ultrasound images of breast tumors and their corresponding annotation data.
[0049] Step S2: Process the images in the breast ultrasound medical dataset to the same size, and enhance the images in the training set using random rotation and horizontal flipping operations.
[0050] Specifically, images from the breast ultrasound medical dataset are read and processed to the same size H×W; H represents the height, W represents the width, and H=W=224; images in the training set are enhanced using operations such as random rotation and horizontal flipping to ensure the model training effect.
[0051] Step S3: Construct a hybrid dual-path medical image segmentation model, which consists of a convolutional coding layer, an attention coding layer, an attention feature fuser (AFF), a convolutional feature fuser (CFF), two spatial pyramid feature enhancers (SPFE), a convolutional and attention feature mixer (CAFM), and a decoding layer.
[0052] Step S31: Construct a convolutional coding layer; the convolutional coding layer contains four convolutional encoders cascaded in sequence. Each convolutional encoder contains a 3×3 convolution, a normalization layer, a channel-dilated compressive convolution, a residual connection, a 3×3 convolutional downsampling layer, a normalization layer, a channel-dilated compressive convolution, a 1×1 convolutional downsampling layer, and a residual connection cascaded in sequence.
[0053] Step S32: Construct an attention encoding layer, which contains 12 cascaded attention encoders. Each attention encoder contains a normalization layer, multi-head attention, residual connection, normalization layer, multilayer perceptron, and residual connection, all cascaded together.
[0054] Step S33: Construct an attention feature fusion unit; the attention feature fusion unit consists of sequentially cascaded 3×3 convolutions, normalization layers, adaptive pooling layers, shared convolutional kernels, sigmoid activations, and residual connections.
[0055] Step S34: Construct a convolutional feature fusion layer; the convolutional feature fusion layer consists of cascaded 3×3 convolutions, normalization layers, 1×1 convolutions, shared linear layers, self-attention layers, and residual connections.
[0056] Step S35: Construct a spatial pyramid feature enhancer; the spatial pyramid feature enhancer includes sequentially cascaded channel splitting, dilated convolution, depthwise separable convolution, channel concatenation, 1×1 convolution, activation layer and residual connection.
[0057] Step S36: Construct a convolutional and attention feature mixer; the convolutional and attention feature mixer includes sequentially cascaded adaptive pooling, 1×1 convolution, softmax activation, learnable convolutional kernel, depthwise convolution, channel-dilated compressive convolution, depthwise separable convolution, residual connections, and activation layers.
[0058] Step S37: Construct the decoding layer; the decoding layer contains 4 decoders cascaded in sequence, each decoder containing 3×3 convolution, normalization layer, channel dilation and compression convolution, residual connection, 3×3 convolution upsampling, normalization layer, channel dilation and compression convolution, 1×1 convolution upsampling and residual connection in sequence.
[0059] Step S4: Input the images to be processed from the training set into the hybrid dual-path medical image segmentation model for segmentation to obtain segmented images.
[0060] Step S41: Input the same image to be processed from the training set into the attention coding layer and the convolutional coding layer to obtain attention features and convolutional features respectively.
[0061] Specifically, the dimensions of the image to be processed are C×H×W, where C represents the number of channels and C=3.
[0062] Step S411: The image to be processed is input into a convolutional coding layer. Four convolutional encoders are cascaded in sequence within the convolutional coding layer. In each convolutional encoder, the input features are sequentially passed through a 3×3 convolution, a normalization layer, and a channel dilation and compression convolution. The intermediate features are then concatenated with the input feature residuals to obtain intermediate features. After passing through a 3×3 convolution downsampling layer, a normalization layer, and a channel dilation and compression convolution, the output features are concatenated with the output residuals of the intermediate features after 1×1 convolution downsampling to obtain output features. The output features of the previous convolutional encoder are used as the input features of the next convolutional encoder, and the output features of the fourth convolutional encoder are used as the output convolutional features.
[0063] Step S412: The image to be processed is input into the attention coding layer. Twelve attention encoders are cascaded in sequence within the attention coding layer. In each attention encoder, the input features pass through a normalization layer and a multi-head attention layer in sequence, and are then connected with the input feature residuals to obtain intermediate features. After passing through a normalization layer and a multilayer perceptron, they are then connected with the intermediate feature residuals to obtain output features. The output features of the previous attention encoder are used as the input features of the next attention encoder, and the output features of the 12th attention encoder are used as attention features.
[0064] This invention constructs attention encoding paths and convolutional encoding paths in parallel, extracting global long-range dependencies and local detail features respectively, thereby achieving complementary feature modeling from the source.
[0065] Step S42: Input the attention features and convolutional features into the attention feature fusion processor to obtain fused convolutional features.
[0066] Specifically, the attention features, after sequentially passing through a 3×3 convolution, a normalization layer, and an adaptive pooling layer, are processed by a shared convolutional kernel and activated by a Sigmoid function to obtain the attention space weight matrix. The convolutional features are then processed by a shared convolutional kernel and activated by a Sigmoid function to obtain the convolution space weight matrix. The convolution space weight matrix is then multiplied by... Weights, attention space weight matrix multiplied by The weights are summed to obtain a fusion matrix. This fusion matrix is then multiplied by the convolutional features to obtain the attention-enhanced features. Finally, the attention-enhanced features are concatenated with the convolutional features using residuals to obtain the fused convolutional features. This allows the global spatial information of the attention features to be incorporated to enhance the convolutional features.
[0067] Step S43: Input the attention features and convolutional features into the convolutional feature fusion processor to obtain the fused attention features.
[0068] Specifically, the convolutional features, after passing through a 3×3 convolution, a normalization layer, and a 1×1 convolution, are then processed by a shared linear layer to obtain the convolutional query. Convolutional bonds Convolution value Convolutional query and convolutional bonds The self-attention matrix of convolutional features is obtained through the self-attention layer; the attention features are then passed through a shared linear layer to obtain the attention query. Attention key Attention value Attention query and attention keys The attention feature self-attention matrix is obtained through the self-attention layer; the attention feature self-attention matrix is multiplied by... Weights, convolutional features multiplied by the attention matrix The weights are then summed to obtain the fused self-attention matrix. The fused self-attention matrix is then combined with the attention values. Multiplying them yields the convolutional enhancement features, which are then residually concatenated with the attention features to obtain the fused attention features.
[0069] Step S44: Input the fused convolutional features into the first spatial pyramid feature enhancer to obtain enhanced convolutional features.
[0070] Specifically, the fused convolutional features are input into the first spatial pyramid feature enhancer. The fused convolutional features are first divided into equal channels, then dilated convolution and depthwise separable convolution are performed separately, and then the channels are concatenated. Next, they are passed through cascaded 1×1 convolution and activation layers in sequence, and finally residual connections are made with the fused convolutional features to obtain the enhanced convolutional features.
[0071] Step S45: Input the fused attention features into the second spatial pyramid feature enhancer to obtain enhanced attention features.
[0072] Specifically, the fused attention features are input into the second spatial pyramid feature enhancer. The fused attention features are first divided into equal channels, then dilated convolution and depthwise separable convolution are performed separately, and then the channels are concatenated. Next, they are passed through cascaded 1×1 convolutions and activation layers, and finally residual connections are made with the fused attention features to obtain the enhanced attention features.
[0073] Step S46: Concatenate the enhanced convolutional features and the enhanced attention features through channels to obtain the concatenated features.
[0074] Step S47: Input the concatenated features into the convolution and attention feature mixer to obtain the mixed features.
[0075] Specifically, the concatenated features are sequentially processed through adaptive pooling, 1×1 convolution, and Softmax activation to obtain a number of weights equal to the number of channels in the learnable convolutional kernel. Each channel of the learnable convolutional kernel is multiplied by its corresponding weight and then depthwise convolved with the concatenated features. The outputs are then processed through channel expansion and compression convolution and depthwise separable convolution, respectively. Finally, the two outputs are added together and passed through an activation layer to obtain the hybrid features.
[0076] Dynamic channel weights with learnable convolutional kernels are generated by splicing features. Then, the spliced features are fused by depthwise convolution using learnable convolutional kernels. The convolutions of the two branches, channel dilation compression convolution and depthwise separable convolution, are combined to improve fusion accuracy while controlling computational complexity.
[0077] Step S48: Input the mixed features into the decoding layer to obtain the segmented image.
[0078] Specifically, the mixed feature input is processed by the decoding layer, which contains four cascaded decoders. In each decoder, the input features are sequentially processed through a 3×3 convolution, a normalization layer, and a channel dilation / compression convolution. These intermediate features are then concatenated with the input feature residuals to obtain intermediate features. After further processing through a 3×3 convolution upsampling layer, a normalization layer, and a channel dilation / compression convolution, these intermediate features are concatenated with the output residuals of the intermediate features after a 1×1 convolution upsampling to obtain the output features. The output features of the previous decoder serve as the input features for the next decoder. The output of the fourth decoder yields a 2×H×W class probability matrix. The two channels of the class probability matrix are the target channel and the background channel, respectively. The target channel represents the target space probability matrix, and the background channel represents the background space probability matrix. The class probability matrix is... Used for loss calculation; the probabilities of the target space probability matrix and the background space probability matrix at the same location are gated to obtain the category of the segmented image at that location. That is, if the probability of a certain location in the target space probability matrix is greater than the probability of that location in the background space probability matrix, then the category of that location is target, and the pixel value of the segmented image at that location is 255 (white); otherwise, the category is background, and the pixel value of the segmented image at that location is 0 (black). The final output is a 1×H×W segmented image.
[0079] Step S5: Construct a loss function to train the hybrid dual-path medical image segmentation model, and obtain the trained hybrid dual-path medical image segmentation model.
[0080] Step S51: Construct a loss function by combining the Dice coefficient with the binary cross-entropy.
[0081]
[0082] in, Represents the loss function. Indicates the proportionality coefficient; Represents the binary cross-entropy loss function; Represents the Dice loss function; It is a predicted value. That is the target value.
[0083] Step S52: Train the hybrid dual-path medical image segmentation model using a loss function to obtain the trained hybrid dual-path medical image segmentation model.
[0084] Specifically, the batch size for model training was set to 4, the number of iterations was set to 300 rounds, and the Adam optimizer was used with a learning rate of 0.0001 and momentum of 0.9; the scaling factor was... The value ranges from 0 to 1; in this example, it is 0.5. Once the hybrid dual-path medical image segmentation model has been trained to the point where the loss no longer decreases (i.e., it converges), training is stopped, and the trained hybrid dual-path medical image segmentation model is saved.
[0085] Step S6: Use the trained hybrid dual-path medical image segmentation model to segment the ultrasound images of breast tumors in the test set.
[0086] Step S7: Performance evaluation.
[0087] The model's performance in segmenting samples was evaluated using relevant metrics such as Precision, Jaccard Index (IoU), and Dice coefficient. See Table 1 for specific meanings.
[0088] Table 1. Binary Classification Confusion Matrix
[0089]
[0090] Precision, Jaccard index (IoU), and Dice coefficient are defined as follows:
[0091]
[0092]
[0093]
[0094] in, This indicates the proportion of samples that were predicted to be positive but were actually true positives. Indicates intersection, union, and ratio; A measure of similarity between two samples; Indicates a true positive result; This indicates a false positive. Indicates a false negative; It indicates a true negative.
[0095] Example 2:
[0096] The method described in Example 1 was used to segment breast tumor ultrasound images on the publicly available breast ultrasound image segmentation dataset BUSI, classifying them as lesions or normal tissue. The computer environment for this experiment was Windows 11; an NVIDIA RTX 3060 GPU; and Python 3.9 and PyTorch 1.12. In this example, 70% of the publicly available dataset was randomly selected as the training set, 20% as the validation set, and the remaining 10% as the test set. Precision, IoU, and Dice were used as evaluation criteria, as shown in Table 2. The proposed method achieved Precision, IoU, and Dice coefficients of 0.8596, 0.7757, and 0.8613, respectively, demonstrating higher accuracy compared to current state-of-the-art methods. The segmentation results for the test set images are shown below. Figure 5As shown, the present invention can better locate and segment clearer and more accurate boundaries.
[0097] Table 2 Comparative Experiment Table
[0098]
[0099] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for segmenting breast ultrasound tumor images, characterized in that, The method includes the following steps: Step S1: Collect breast ultrasound medical datasets and separate the breast tumor ultrasound image datasets into training set, validation set, and test set; Step S2: Process the images in the breast ultrasound medical dataset to the same size, and enhance the images in the training set using random rotation and horizontal flipping operations; Step S3: Construct a hybrid dual-path medical image segmentation model, which consists of a convolutional coding layer, an attention coding layer, an attention feature fusion unit, a convolutional feature fusion unit, two spatial pyramid feature enhancers, a convolutional and attention feature mixer, and a decoding layer. Step S4: Input the images to be processed in the training set into the hybrid dual-path medical image segmentation model for segmentation to obtain segmented images; Step S5: Construct a loss function to train the hybrid dual-path medical image segmentation model, and obtain the trained hybrid dual-path medical image segmentation model; Step S6: Use the trained hybrid dual-path medical image segmentation model to segment the ultrasound images of breast tumors in the test set.
2. The method for segmenting breast ultrasound tumor images according to claim 1, characterized in that, Step S3 includes the following steps: Step S31: Construct a convolutional coding layer; the convolutional coding layer contains four convolutional encoders cascaded in sequence, each of which contains a 3×3 convolution, a normalization layer, a channel-dilated compressive convolution, a residual connection, a 3×3 convolutional downsampling layer, a normalization layer, a channel-dilated compressive convolution, a 1×1 convolutional downsampling layer, and a residual connection cascaded in sequence. Step S32: Construct an attention encoding layer, which contains 12 cascaded attention encoders. Each attention encoder contains a normalization layer, a multi-head attention layer, a residual connection, a normalization layer, a multilayer perceptron, and a residual connection, all cascaded together. Step S33: Construct an attention feature fusion processor; The attention feature fusion unit consists of sequentially cascaded 3×3 convolutions, normalization layers, adaptive pooling layers, shared convolutional kernels, sigmoid activation, and residual connections. Step S34: Construct a convolutional feature fusion layer; the convolutional feature fusion layer consists of cascaded 3×3 convolutions, normalization layers, 1×1 convolutions, shared linear layers, self-attention layers, and residual connections. Step S35: Construct a spatial pyramid feature enhancer; the spatial pyramid feature enhancer includes sequentially cascaded channel splitting, dilated convolution, depthwise separable convolution, channel concatenation, 1×1 convolution, activation layer and residual connection; Step S36: Construct a convolutional and attention feature mixer; the convolutional and attention feature mixer includes sequentially cascaded adaptive pooling, 1×1 convolution, softmax activation, learnable convolutional kernel, depthwise convolution, channel-dilation compressive convolution, depthwise separable convolution, residual connections, and activation layers; Step S37: Construct the decoding layer; The decoding layer contains four decoders cascaded in sequence. Each decoder contains a 3×3 convolution, a normalization layer, a channel-dilated compressive convolution, a residual connection, a 3×3 convolution upsampling layer, a normalization layer, a channel-dilated compressive convolution, a 1×1 convolution upsampling layer, and a residual connection cascaded in sequence.
3. The method for segmenting breast ultrasound tumor images according to claim 2, characterized in that, Step S4 includes the following steps: Step S41: Input the same image to be processed from the training set into the convolutional coding layer and the attention coding layer to obtain convolutional features and attention features respectively; Step S42: Input the attention features and convolutional features into the attention feature fusion processor to obtain fused convolutional features; Step S43: Input the attention features and convolutional features into the convolutional feature fusion processor to obtain the fused attention features; Step S44: Input the fused convolutional features into the first spatial pyramid feature enhancer to obtain enhanced convolutional features; Step S45: Input the fused attention features into the second spatial pyramid feature enhancer to obtain enhanced attention features; Step S46: Concatenate the enhanced convolutional features and the enhanced attention features through channels to obtain the concatenated features; Step S47: Input the concatenated features into the convolution and attention feature mixer to obtain the mixed features; Step S48: Input the mixed features into the decoding layer to obtain the segmented image.
4. The method for segmenting breast ultrasound tumor images according to claim 1, characterized in that, The loss function in step S5 is: in, Represents the loss function. Indicates the proportionality coefficient; Represents the binary cross-entropy loss function; Represents the Dice loss function; It is a predicted value. That is the target value.