Breast image segmentation method based on dynamic sampling and multi-scale parallel attention
By introducing dynamic sampling and multi-scale parallel attention mechanisms into the breast tissue image segmentation algorithm, the problems of low segmentation accuracy and difficulty in capturing multi-scale context information in the existing technology are solved, and higher segmentation accuracy and optimization of computing resources are achieved.
Patent Information
- Application Number
- CN202510301622.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-14
- Publication Date
- 2025-04-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When processing small lesions, the existing breast tissue image segmentation algorithm reduces the segmentation accuracy due to the loss of spatial information, and it is difficult to effectively capture multi-scale context information, resulting in inaccurate identification of small objects or detailed areas.
The breast tissue image segmentation method based on dynamic sampling and multi-scale parallel attention was adopted. By constructing a Dy-scSE+-HRNet network model, combining the ultra-light dynamic upsampling operator module DySample and the multi-scale parallel parallel attention module scSE+, we can improve the model's detailed feature capture ability of breast cancer lesion areas.
It significantly improves the segmentation accuracy of small lesions in complex breast sections, enhances the ability to express the detailed features of breast cancer lesions, reduces the requirements for computing resources, and more accurately locates the segmentation edges in complex backgrounds.
Smart Images

Figure CN119810124A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of breast tissue image segmentation, and in particular relates to a breast image segmentation method based on dynamic sampling and multi-scale parallel attention. Background Art
[0002] With the rapid development of deep learning technology, researchers are constantly exploring more accurate and efficient segmentation algorithms for problems in medical image segmentation. In the diagnosis of breast cancer, accurate segmentation of tumor areas is of great significance for improving the accuracy of diagnosis and formulating treatment plans. It has become possible to use deep learning technology to achieve computer-assisted breast cancer pathological diagnosis. Breast pathology sections are one of the important bases for breast cancer diagnosis, and their diagnostic results are of great significance for the formulation of treatment plans. However, this diagnostic method requires pathologists to observe and annotate pathology sections one by one, and use rich experience to judge the scope and type of lesions. Due to the large area and intensive information of breast sections, the manual workload is extremely large. Pathologists are prone to visual fatigue due to long-term work, resulting in a decrease in diagnostic efficiency, and may also increase the risk of misdiagnosis and missed diagnosis. Therefore, in the task of breast pathology section segmentation, the segmentation algorithm based on deep learning can quickly segment the tumor area and provide pathologists with accurate auxiliary diagnostic tools, thereby improving diagnostic efficiency and reducing the workload of doctors.
[0003] In the task of breast tissue segmentation, convolutional neural networks (CNNs) can extract rich semantic information, but spatial information may be lost in the deep features of the network. In the traditional CNN architecture, as the feature map is downsampled layer by layer, the spatial details are compressed, resulting in a significant decrease in segmentation accuracy for small objects or areas with blurred boundaries. Especially when segmenting small lesion areas, the model tends to ignore these key details due to the loss of spatial information. In addition, when processing objects of different scales, standard convolutional neural networks have difficulty in effectively capturing contextual information at each scale, often resulting in inaccurate recognition of small objects or detailed areas. To address these problems, the High Resolution Feature Processing Network (HRNet) is an innovative network framework that extracts rich semantic information while maintaining high-resolution features through multi-resolution feature fusion, showing great application potential. On the one hand, HRNet can achieve effective information interaction and integration between different resolutions and adapt to complex image scenes; on the other hand, its high-resolution features are particularly outstanding in capturing detail information, which can well cope with the segmentation needs of small-sized targets.
[0004] Although HRNet performs well in image segmentation tasks, it still has some limitations. Although HRNet can fuse multi-scale features, it does not pay enough attention to the importance of channel features and the saliency of spatial regions of images, and lacks the ability to focus on key areas, which may lead to mis-segmentation or missed segmentation. For breast tissue images, the high resolution, complexity of multi-texture features, and blurred boundaries of the target area all put forward higher requirements for the segmentation algorithm. Summary of the invention
[0005] In order to overcome the above-mentioned shortcomings, the purpose of the present invention is to provide a breast tissue segmentation method based on dynamic sampling and multi-scale parallel attention, so that abnormal tissue can be better segmented under different scales and image backgrounds, even tumor areas with tiny textures or blurred boundaries can be segmented.
[0006] In order to achieve the above object, the present invention adopts the following technical solution: The breast tissue image segmentation method based on dynamic sampling and multi-scale parallel attention includes the following steps: Step S1: Slice the whole breast pathology slice to obtain a breast tissue image; annotate the breast tissue image to obtain a breast tissue image dataset; Step S2: Construct Dy-scSE-based + -Breast image segmentation model based on HRNet network, which includes feature extraction module HRNet, ultra-light dynamic upsampling operator module DySample, and multi-scale parallel attention module scSE + , fusion module and prediction module; wherein, the feature extraction module HRNet includes several feature extraction components; Importing the breast tissue image of the breast tissue image dataset in step S1 into the component of the HRNet feature extraction module of the breast image segmentation model to obtain a global feature map of the breast tissue image; importing the global feature map into the ultra-light dynamic upsampling operator module DySample to obtain local features of the breast tissue image; Step S3: import the local features in step S2 into the multi-scale parallel attention module scSE+ to obtain the multi-scale attention weights; Step S4: The fusion module fuses the multi-scale attention weights in step S3 to obtain fusion features; Step S5: Import the fused features in step S4 into the prediction module to obtain the predicted category of the breast tissue image.
[0007] Furthermore, step S1 is specifically as follows: Step S11: transcoding the breast pathology slices of the full field of view into a JPG format, and then segmenting the breast pathology slices in the JPG format in the form of a sliding window to obtain a breast tissue image; Step S12: Annotate the breast tissue image through the Anylabeling annotation tool, adjust it in combination with LabelImg, annotate the abnormal breast tissue in the breast tissue image at the pixel level and indicate the category, obtain the annotated breast tissue image and the annotation file in PNG format, split the breast tissue image dataset into a training set, a validation set, and a test set; then convert the annotation file format of the breast tissue image dataset into the ADE20K format, thereby obtaining the PNG mask files corresponding to the training set, the validation set, and the test set.
[0008] Further, the feature extraction module HRNet in step S2 includes a first feature extraction component, a second feature extraction component, a third feature extraction component and a fourth feature extraction component connected in series; the first feature extraction component includes one branch, the second feature extraction component includes two parallel branches, the third feature component includes three parallel branches, and the fourth feature component includes four parallel branches; Step S2 is specifically as follows: Step S21: importing the breast tissue image of the breast tissue image data set in step S1: in the first feature extraction component, obtaining a first global feature map; importing the first global feature map into the ultra-light dynamic upsampling operator module DySample to obtain a first local feature; The first local feature and the first global feature are respectively imported into the first branch and the second branch of the second feature extraction component of the breast tissue image segmentation model, and the first branch and the second branch obtain the second global feature of the breast tissue image tumor by cross-fusion; the second global feature map is imported into the ultra-light dynamic upsampling operator module DySample, and each branch outputs the second local feature; In addition, the second branch further directly outputs the second global feature; Step S22: importing the second local feature and the second global feature in step S21 into three branches of the third feature extraction component, and the three branches obtain the third global feature of the breast tissue image tumor by cross-fusion; importing the third global feature map into the ultra-light dynamic upsampling operator module DySample, and each branch outputs the third local feature; In addition, the third branch further directly outputs the third global feature; Step S23: Import the third local feature and the third global feature in step S22 into the three branches of the third feature extraction component, and the three branches obtain the fourth global feature of the breast tissue image tumor by cross-fusion; import the fourth global feature map into the ultra-light dynamic upsampling operator module DySample, and each branch outputs the fourth local feature.
[0009] Furthermore, each branch in step S2 includes two serially connected convolution blocks; wherein each serially connected sub-block structure is a serially connected 3×3 convolution layer and a ReLU activation layer.
[0010] Furthermore, the processing of the ultra-lightweight dynamic upsampling operator module DySample is expressed as follows: ; in, Represents the input of the ultra-lightweight dynamic upsampling operator module DySample, Represents the output of the ultra-lightweight dynamic upsampling operator module DySample, represents the sampling set, represents the sampling function.
[0011] Furthermore, a sampling point generator is provided in the ultra-lightweight dynamic upsampling operator module DySample, and the processing process of the sampling point generator is expressed as follows: ; ; in, represents a linear layer, Indicates the offset, Represents the original mesh.
[0012] Furthermore, multi-scale parallel attention scSE + The module includes a parallel multi-scale channel attention module cSE + , multi-scale spatial attention module sSE + and the cross-attention module; Import local features in step S3 to the multi-scale parallel attention module scSE + In , we obtain multi-scale attention features; specifically: Step S3A: Multi-scale channel attention module cSE +The local features of the input are processed by parallel global average pooling, global maximum pooling and pyramid pooling to generate three channel weight vectors of dimension [C, 1, 1], where C represents the number of channels. Then, a 1×1 convolutional layer is used to reduce and increase the dimension of each channel weight vector to obtain three C-dimensional vectors. After the three C-dimensional vectors are normalized using the Sigmoid function, the three are then fused into a multi-scale channel weight. ; Step S3B: Multi-scale spatial attention module sSE + The local features are respectively generated into three spatial weight matrices with dimensions [1, H, W] through 1×1 convolution, 3×3 convolution and 5×5 convolution, where H represents the height of the local feature and W represents the width of the local feature. The weight matrix is normalized by the Sigmoid activation function, and then the three are fused into a multi-scale spatial weight matrix. ; Step S3C: The cross-attention module converts the multi-scale channel weights and multi-scale spatial weights Splicing is performed to generate cross attention weights through 1×1 convolution and Sigmoid activation ; Multi-scale channel weights , multi-scale spatial weights and cross attention weights Construct multi-scale attention weights.
[0013] Furthermore, step S3A is specifically as follows: Step S3A1: Multi-scale channel attention module cSE + Perform global average pooling, global maximum pooling and pyramid pooling on the local features of the input respectively; expressed as: ; ; ; in, Indicates The global pooling feature of each channel, Indicates The local pooling features of channels, Indicates The pyramid pooling features of channels, No. Channels at position The value of Represents the local features of the input; Step S3A2: Dynamically assign weight parameters, expressed as: in, Indicates the preset fixed parameters, , and Both represent preset dynamic weight parameters; Step S3A3: After normalizing the three C-dimensional vectors using the Sigmoid function, the three are then fused into multi-scale channel weights , expressed as: ; ; ; ; in, represents the Sigmoid activation function, represents the global pooling feature weight, Local pooling features, represents the pyramid pooling feature weight, Represents channel attention features; Step S3B is specifically as follows: Step S3B1: Multi-scale spatial attention module sSE + The input local features are respectively generated into three spatial weight matrices with dimensions [1, H, W] through 1×1 convolution, 3×3 convolution and 5×5 convolution, and the weight matrices are normalized through the Sigmoid activation function; expressed as: ; ; ; in, is the 1×1 convolution kernel weight, is the 3×3 convolution kernel weight, is the 5×5 convolution kernel weight, , They are the spatial weight matrices after Sigmoid normalization; Step S3B2: Then fuse the three into multi-scale spatial weights ; expressed as: ; ; in, Represents the spatial weight matrix after splicing; Step S3C is specifically as follows: The cross-attention module combines the multi-scale channel weights and multi-scale spatial weights Splicing is performed to generate cross attention weights through 1×1 convolution and Sigmoid activation ; ; ; in, express The splicing output, Represents the concatenation function.
[0014] Furthermore, step S4 is specifically as follows: Feature fusion module generates dynamic weights , , ,Will , , Dynamic weighted fusion along three channels as the final attention weight , the calculation formula is: ; The final attention weight After 1×1 convolution, it is processed through RELU activation function to obtain fusion features.
[0015] Compared with the prior art, the present invention has the following beneficial effects:
[0016] 1) In order to solve the problems of diverse textures, blurred boundaries, and different sizes of targets in breast cancer lesion areas, as well as the lack of multi-scale feature capture capability of existing models, the present invention improves the HRNet model. On the basis of maintaining the extracted high-resolution features, the features of different resolutions are effectively interacted, thereby improving the model's ability to capture detailed features of breast cancer lesion areas, and making the segmentation edge positioning of breast cancer lesion areas under complex backgrounds more accurate.
[0017] 2) In order to address the problems of poor sensitivity of existing methods to small lesion areas and high computing resource overhead, the present invention introduces an ultra-light dynamic upsampling operator module DySample and a multi-scale parallel attention module scSE+ into the model backbone network, allocates more sampling points to small target areas, suppresses background interference, and enhances the feature expression capability of small lesion areas, significantly improving the segmentation accuracy of small lesion areas in complex breast slices while reducing the requirements for computing resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 Flowchart of the breast tissue segmentation method based on dynamic sampling and multi-scale parallel attention provided by the present invention. DETAILED DESCRIPTION
[0019] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0020] Reference Figure 1 , a breast tissue image segmentation method based on dynamic sampling and multi-scale parallel attention, comprising the following steps: Step S1: Slice the whole breast pathology slice to obtain a breast tissue image; annotate the breast tissue image to obtain a breast tissue image dataset; Step S2: Construct Dy-scSE-based + -Breast image segmentation model based on HRNet network, which includes feature extraction module HRNet, ultra-light dynamic upsampling operator module DySample, and multi-scale parallel attention module scSE + , fusion module and prediction module; wherein, the feature extraction module HRNet includes several feature extraction components; Importing the breast tissue image of the breast tissue image dataset in step S1 into the component of the HRNet feature extraction module of the breast image segmentation model to obtain a global feature map of the breast tissue image; importing the global feature map into the ultra-light dynamic upsampling operator module DySample to obtain local features of the breast tissue image; Step S3: import the local features in step S2 into the multi-scale parallel attention module scSE+ to obtain the multi-scale attention weights; Step S4: The fusion module fuses the multi-scale attention weights in step S3 to obtain fusion features; Step S5: Import the fused features in step S4 into the prediction module to obtain the predicted category of the breast tissue image.
[0021] Furthermore, step S1 is specifically as follows: Step S11: transcoding the breast pathology slices of the full field of view into a JPG format, and then segmenting the breast pathology slices in the JPG format in the form of a sliding window to obtain a breast tissue image; Step S12: Annotate the breast tissue image through the Anylabeling annotation tool, adjust it in combination with LabelImg, annotate the abnormal breast tissue in the breast tissue image at the pixel level and indicate the category, obtain the annotated breast tissue image and the annotation file in PNG format, split the breast tissue image dataset into a training set, a validation set, and a test set; then convert the annotation file format of the breast tissue image dataset into the ADE20K format, thereby obtaining the PNG mask files corresponding to the training set, the validation set, and the test set.
[0022] Further, the feature extraction module HRNet in step S2 includes a first feature extraction component, a second feature extraction component, a third feature extraction component and a fourth feature extraction component connected in series; the first feature extraction component includes one branch, the second feature extraction component includes two parallel branches, the third feature component includes three parallel branches, and the fourth feature component includes four parallel branches; Step S2 is specifically as follows: Step S21: importing the breast tissue image of the breast tissue image data set in step S1: in the first feature extraction component, obtaining a first global feature map; importing the first global feature map into the ultra-light dynamic upsampling operator module DySample to obtain a first local feature; The first local feature and the first global feature are respectively imported into the first branch and the second branch of the second feature extraction component of the breast tissue image segmentation model, and the first branch and the second branch obtain the second global feature of the breast tissue image tumor by cross-fusion; the second global feature map is imported into the ultra-light dynamic upsampling operator module DySample, and each branch outputs the second local feature; In addition, the second branch further directly outputs the second global feature; Step S22: importing the second local feature and the second global feature in step S21 into three branches of the third feature extraction component, and the three branches obtain the third global feature of the breast tissue image tumor by cross-fusion; importing the third global feature map into the ultra-light dynamic upsampling operator module DySample, and each branch outputs the third local feature; In addition, the third branch further directly outputs the third global feature; Step S23: Import the third local feature and the third global feature in step S22 into the three branches of the third feature extraction component, and the three branches obtain the fourth global feature of the breast tissue image tumor by cross-fusion; import the fourth global feature map into the ultra-light dynamic upsampling operator module DySample, and each branch outputs the fourth local feature.
[0023] Furthermore, each branch in step S2 includes two serially connected convolution blocks; wherein each serially connected sub-block structure is a serially connected 3×3 convolution layer and a ReLU activation layer.
[0024] Furthermore, the processing of the ultra-lightweight dynamic upsampling operator module DySample is expressed as follows: ; in, Represents the input of the ultra-lightweight dynamic upsampling operator module DySample, Represents the output of the ultra-lightweight dynamic upsampling operator module DySample, represents the sampling set, represents the sampling function.
[0025] Furthermore, a sampling point generator is provided in the ultra-lightweight dynamic upsampling operator module DySample, and the processing process of the sampling point generator is expressed as follows: ; ; in, represents a linear layer, Indicates the offset, Represents the original mesh.
[0026] Furthermore, multi-scale parallel attention scSE + The module includes a parallel multi-scale channel attention module cSE + , multi-scale spatial attention module sSE + and the cross-attention module; Import local features in step S3 to the multi-scale parallel attention module scSE + In , we obtain multi-scale attention features; specifically: Step S3A: Multi-scale channel attention module cSE + The local features of the input are processed by parallel global average pooling, global maximum pooling and pyramid pooling to generate three channel weight vectors of dimension [C, 1, 1], where C represents the number of channels. Then, a 1×1 convolutional layer is used to reduce and increase the dimension of each channel weight vector to obtain three C-dimensional vectors. After the three C-dimensional vectors are normalized using the Sigmoid function, the three are then fused into a multi-scale channel weight. ; Step S3B: Multi-scale spatial attention module sSE + The local features are respectively generated into three spatial weight matrices with dimensions [1, H, W] through 1×1 convolution, 3×3 convolution and 5×5 convolution, where H represents the height of the local feature and W represents the width of the local feature. The weight matrix is normalized by the Sigmoid activation function, and then the three are fused into a multi-scale spatial weight matrix. ; Step S3C: The cross-attention module converts the multi-scale channel weights and multi-scale spatial weights Splicing is performed to generate cross attention weights through 1×1 convolution and Sigmoid activation ; Multi-scale channel weights , multi-scale spatial weights and cross attention weights Construct multi-scale attention weights.
[0027] Furthermore, step S3A is specifically as follows: Step S3A1: Multi-scale channel attention module cSE + Perform global average pooling, global maximum pooling and pyramid pooling on the local features of the input respectively; expressed as: ; ; ; in, Indicates The global pooling feature of each channel, Indicates The local pooling features of channels, Indicates The pyramid pooling features of channels, No. Channels at position The value of Represents the local features of the input; Step S3A2: Dynamically assign weight parameters, expressed as: in, Indicates the preset fixed parameters, , and Both represent preset dynamic weight parameters; Step S3A3: After normalizing the three C-dimensional vectors using the Sigmoid function, the three are then fused into multi-scale channel weights , expressed as: ; ; ; ; in, represents the Sigmoid activation function, represents the global pooling feature weight, Local pooling features, represents the pyramid pooling feature weight, Represents channel attention features; Step S3B is specifically as follows: Step S3B1: Multi-scale spatial attention module sSE +The input local features are respectively generated into three spatial weight matrices with dimensions [1, H, W] through 1×1 convolution, 3×3 convolution and 5×5 convolution, and the weight matrices are normalized through the Sigmoid activation function; expressed as: ; ; ; in, is the 1×1 convolution kernel weight, is the 3×3 convolution kernel weight, is the 5×5 convolution kernel weight, , They are the spatial weight matrices after Sigmoid normalization; Step S3B2: Then fuse the three into multi-scale spatial weights ; expressed as: ; ; in, Represents the spatial weight matrix after splicing; Step S3C is specifically as follows: The cross-attention module combines the multi-scale channel weights and multi-scale spatial weights Splicing is performed to generate cross attention weights through 1×1 convolution and Sigmoid activation ; ; ; in, express The splicing output, Represents the concatenation function.
[0028] Furthermore, step S4 is specifically as follows: Feature fusion module generates dynamic weights , , ,Will , , Dynamic weighted fusion along three channels as the final attention weight , the calculation formula is: ; The final attention weight After 1×1 convolution, it is processed through RELU activation function to obtain fusion features.
[0029] Specifically, in one example, in the above step S1, since the effective feature information of a single sample image is limited, appropriate data expansion operations can be performed on the determined data set, and horizontal flip and vertical flip operations are used to expand the data of the breast tissue image data set. Horizontal flipping generates a new image with all pixel arrangement orders swapped left and right compared to the original image by flipping the image left and right. Vertical flipping swaps the upper and lower structures, maintaining the original structure and texture features while changing the spatial layout. Both methods can significantly expand the breast tissue image data set without introducing noise or changing the target structure, providing the model with more samples of deformation and different perspectives, which helps to improve the accuracy of segmentation and recognition tasks. The present invention mainly uses horizontal flip and vertical flip operations to expand the breast tissue image data set.
[0030] In one example, when constructing a breast tissue image dataset, the annotation types include four abnormal tissue categories: small nest-like, nest-like, sheet-like, and strip-like.
[0031] In one example, the first feature extraction component performs high-resolution convolution to obtain a high-resolution feature map to capture basic texture and edge information of the lesion area;
[0032] The ultra-lightweight dynamic upsampling operator module DySample is introduced to dynamically downsample the initial high-resolution features, optimizing the ability to express small targets or complex areas in the subsequent low-resolution path;
[0033] The second feature extraction component introduces medium and high resolution paths. The feature map is half of the high-resolution path. The features interact with the downsampled high-resolution path. The features of both are transmitted downward at the same time and continuously updated. Features are extracted and fused at different scales to ensure that the features of small lesions and large lesion areas can be effectively expressed. The ultra-lightweight dynamic upsampling operator module DySample is also inserted to dynamically adjust the intermediate-level features to further refine the feature expressions at different scales.
[0034] The third feature extraction component further introduces a new medium-resolution path (here adjusted to 1 / 16 of the original image size). Three feature maps of different scales are transmitted simultaneously, and independent convolution operations are performed under each resolution path. Through the interaction of resolutions, the features of each stage complement each other, and multi-scale information is gradually integrated, thereby improving the model's ability to capture long-distance dependencies and capturing deeper tumor areas.
[0035] The third feature extraction component further introduces a low-resolution path (1 / 32 the size of the original image) to form a complete four-scale feature flow. High, medium, low and ultra-low resolution features are simultaneously passed down and fused. Each path feature complements each other through convolution and upsampling to ultimately generate local features.
[0036] After the introduction of the ultra-lightweight dynamic upsampling operator module DySample, compared with the previous kernel-based dynamic upsampler, the ultra-lightweight dynamic upsampling operator module DySample automatically adjusts the sampling position for different targets and shapes, improves the adaptability to complex deformed targets, and has good segmentation performance for irregular breast tissue.
[0037] Due to the complex background, high noise and different scales of tissue structure, breast cancer tissue is very easy to lose the detailed information of lesions during model training and testing. This paper integrates the proposed attention mechanism and dynamic sampling mechanism into the HRNet network to obtain Dy-scSE based on dynamic sampling and multi-scale parallel attention. + -HRNet network model, while capturing global context information, enhances the feature expression ability of channel and spatial dimensions, highlights the lesion area, and suppresses background interference. At the same time, the sampling position of the convolution kernel is dynamically adjusted, so that the model can achieve more refined feature extraction in the local area and avoid the loss of details caused by the fixed convolution window.
[0038] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A breast image segmentation method based on dynamic sampling and multi-scale parallel attention, characterized in that: The following steps are involved: Step S1: Slice the whole breast pathology slice to obtain a breast tissue image; annotate the breast tissue image to obtain a breast tissue image dataset; Step S2: Construct Dy-scSE-based + -Breast image segmentation model based on HRNet network, which includes feature extraction module HRNet, ultra-light dynamic upsampling operator module DySample, and multi-scale parallel attention module scSE + , fusion module and prediction module; wherein, the feature extraction module HRNet includes several feature extraction components; Importing the breast tissue image of the breast tissue image dataset in step S1 into the component of the HRNet feature extraction module of the breast image segmentation model to obtain a global feature map of the breast tissue image; importing the global feature map into the ultra-light dynamic upsampling operator module DySample to obtain local features of the breast tissue image; Step S3: import the local features in step S2 into the multi-scale parallel attention module scSE+ to obtain the multi-scale attention weights; Step S4: The fusion module fuses the multi-scale attention weights in step S3 to obtain fusion features; Step S5: Import the fused features in step S4 into the prediction module to obtain the predicted category of the breast tissue image.
2. The method for breast image segmentation based on dynamic sampling and multi-scale parallel attention according to claim 1, characterized in that: Step S1 is specifically as follows: Step S11: transcoding the breast pathology slices of the full field of view into a JPG format, and then segmenting the breast pathology slices in the JPG format in the form of a sliding window to obtain a breast tissue image; Step S12: label the breast tissue image by using the Anylabeling labeling tool, adjust it in combination with LabelImg, label the abnormal breast tissue in the breast tissue image at the pixel level and indicate the category, obtain the labeled breast tissue image and the labeling file in PNG format, and split the breast tissue image data set into a training set, a validation set, and a test set; The annotation file format of the breast tissue image dataset is then converted into the ADE20K format to obtain the PNG mask files corresponding to the training set, validation set, and test set.
3. The breast image segmentation method based on dynamic sampling and multi-scale parallel attention according to claim 1, characterized in that: The feature extraction module HRNet in step S2 includes a first feature extraction component, a second feature extraction component, a third feature extraction component and a fourth feature extraction component connected in series; The first feature extraction component includes one branch, the second feature extraction component includes two parallel branches, the third feature component includes three parallel branches, and the fourth feature component includes four parallel branches; Step S2 is specifically as follows: Step S21: importing the breast tissue image of the breast tissue image data set in step S1: in the first feature extraction component, obtaining a first global feature map; importing the first global feature map into the ultra-light dynamic upsampling operator module DySample to obtain a first local feature; Importing the first local feature and the first global feature into the first branch and the second branch of the second feature extraction component of the breast image segmentation model respectively, and obtaining the second global feature of the breast image tumor by cross-fusion of the first branch and the second branch; Import the second global feature map into the ultra-light dynamic upsampling operator module DySample, and each branch outputs the second local feature; In addition, the second branch further directly outputs the second global feature; Step S22: importing the second local feature and the second global feature in step S21 into three branches of the third feature extraction component, and the three branches obtain the third global feature of the breast image tumor by cross-fusion; importing the third global feature map into the ultra-light dynamic upsampling operator module DySample, and each branch outputs the third local feature; In addition, the third branch further directly outputs the third global feature; Step S23: Import the third local feature and the third global feature in step S22 into the three branches of the third feature extraction component, and the three branches obtain the fourth global feature of the breast image tumor by cross-fusion; import the fourth global feature map into the ultra-light dynamic upsampling operator module DySample, and each branch outputs the fourth local feature.
4. The method for breast image segmentation based on dynamic sampling and multi-scale parallel attention according to claim 1, characterized in that: Each branch in step S2 includes two serially connected convolution blocks; wherein each serially connected sub-block structure is a serially connected 3×3 convolution layer and a ReLU activation layer.
5. The breast image segmentation method based on dynamic sampling and multi-scale parallel attention according to claim 1, characterized in that: The processing of the ultra-lightweight dynamic upsampling operator module DySample is expressed as follows: ; in, Represents the input of the ultra-lightweight dynamic upsampling operator module DySample, Represents the output of the ultra-lightweight dynamic upsampling operator module DySample, represents the sampling set, represents the sampling function.
6. The method for breast image segmentation based on dynamic sampling and multi-scale parallel attention according to claim 5, characterized in that: The ultra-lightweight dynamic upsampling operator module DySample is provided with a sampling point generator, and the processing process of the sampling point generator is expressed as follows: ; ; in, represents a linear layer, Indicates the offset, Represents the original mesh.
7. The method for breast image segmentation based on dynamic sampling and multi-scale parallel attention according to claim 1, characterized in that: Multi-scale parallel attention scSE + The module includes a parallel multi-scale channel attention module cSE + , multi-scale spatial attention module sSE + and the cross-attention module; Import local features in step S3 to the multi-scale parallel attention module scSE + , obtain multi-scale attention features; Specifically: Step S3A: Multi-scale channel attention module cSE + The local features of the input are processed by parallel global average pooling, global maximum pooling and pyramid pooling to generate three channel weight vectors of dimension [C, 1, 1], where C represents the number of channels. Then, a 1×1 convolutional layer is used to reduce and increase the dimension of each channel weight vector to obtain three C-dimensional vectors. After the three C-dimensional vectors are normalized using the Sigmoid function, the three are then fused into a multi-scale channel weight. ; Step S3B: Multi-scale spatial attention module sSE + The local features are respectively generated into three spatial weight matrices with dimensions [1, H, W] through 1×1 convolution, 3×3 convolution and 5×5 convolution, where H represents the height of the local feature and W represents the width of the local feature. The weight matrix is normalized by the Sigmoid activation function, and then the three are fused into a multi-scale spatial weight matrix. ; Step S3C: The cross-attention module converts the multi-scale channel weights and multi-scale spatial weights Splicing is performed to generate cross attention weights through 1×1 convolution and Sigmoid activation ; Multi-scale channel weights , multi-scale spatial weights and cross attention weights Construct multi-scale attention weights.
8. The method for breast image segmentation based on dynamic sampling and multi-scale parallel attention according to claim 7, characterized in that: Step S3A is specifically as follows: Step S3A1: Multi-scale channel attention module cSE + Perform global average pooling, global maximum pooling and pyramid pooling on the local features of the input respectively; expressed as: ; ; ; in, Indicates The channel weight vector of the global pooling feature of channels, Indicates The channel weight vector of the local pooling feature of each channel, Indicates The channel weight vector of the pyramid pooling feature of channels, Indicates Channels at position The value of Represents the local features of the input; Step S3A2: Dynamically assign weight parameters, expressed as: in, Indicates the preset fixed parameters, , and Both represent preset dynamic weight parameters; Step S3A3: After normalizing the three C-dimensional vectors using the Sigmoid function, the three are then fused into multi-scale channel weights , expressed as: ; ; ; ; in, represents the Sigmoid activation function, represents the global pooling feature weight, Local pooling features, represents the pyramid pooling feature weight, Represents channel attention features; Step S3B is specifically as follows: Step S3B1: Multi-scale spatial attention module sSE + The input local features are respectively generated into three spatial weight matrices with dimensions [1, H, W] through 1×1 convolution, 3×3 convolution and 5×5 convolution, and the weight matrices are normalized through the Sigmoid activation function; expressed as: ; ; ; in, is the 1×1 convolution kernel weight, is the 3×3 convolution kernel weight, is the 5×5 convolution kernel weight, , They are the spatial weight matrices after Sigmoid normalization; Step S3B2: Then fuse the three into multi-scale spatial weights ; expressed as: ; ; in, Represents the spatial weight matrix after splicing; Step S3C is specifically as follows: The cross-attention module combines multi-scale channel weights and multi-scale spatial weights Splicing is performed to generate cross attention weights through 1×1 convolution and Sigmoid activation ; ; ; in, express The splicing output, Represents the concatenation function.
9. The method for breast image segmentation based on dynamic sampling and multi-scale parallel attention according to claim 8, characterized in that: Step S4 is specifically as follows: Feature fusion module generates dynamic weights , , ,Will , , Dynamic weighted fusion along three channels as the final attention weight , the calculation formula is: ; The final attention weight After 1×1 convolution, it is processed through RELU activation function to obtain fusion features.
Citation Information
Patent Citations
Improved HRnet based on attention mechanism
CN112270213A
Remote sensing image ground object extraction multi-scale strong fusion semantic segmentation method based on HRNet
CN116486075A
Mammary gland ultrasonic medical image segmentation algorithm based on global multi-scale residual U-HRNet network
CN117392093A
Remote sensing image semantic segmentation method based on multi-scale features and global information modeling
CN117635941A
Crowd counting method based on scale attention
CN119274125A
Cited By
Improved YOLOv9 lightweight steel surface defect detection model
CN120747622A
Improved lightweight steel surface defect detection model for YOLOv9
CN120747622B
Breast cancer ultrasonic image segmentation method and system
CN121725249A