Breast ultrasonic tumor identification method fusing channel attention and dynamic channel routing
By embedding SE channel attention units and dynamic feature reconstruction modules into the ResNet101 backbone network, and combining SAM optimizer and Focal Loss, the problems of insufficient feature representation and poor generalization performance of breast ultrasound image recognition models are solved, achieving efficient recognition and improved stability of breast tumors.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-10
- Publication Date
- 2026-04-21
AI Technical Summary
In existing technologies, breast ultrasound image recognition models have insufficient feature representation capabilities, are prone to overfitting, and have a disconnect between optimization strategies and feature extraction mechanisms, resulting in poor generalization performance and difficulty in accurately identifying breast tumors in small sample and high-noise scenarios.
An improved ResNet101 backbone network is adopted, which combines SE channel attention units and dynamic feature reconstruction modules with SAM optimizer and Focal Loss loss function. Through adaptive weighted feature channels and global context modeling, the feature extraction capability is enhanced, and data augmentation and sample diversity expansion are performed during training.
It significantly improves the model's accuracy and stability in identifying breast tumors, enabling it to accurately distinguish between normal tissue, benign tumors, and malignant tumors in complex scenarios, providing a precise auxiliary screening method in clinical practice.
Smart Images

Figure CN121904549A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition technology, specifically to a method for breast ultrasound tumor identification that integrates channel attention and dynamic channel routing. Background Technology
[0002] Breast cancer is one of the most common malignant tumors that seriously threaten women's health. Breast ultrasound examination has become an important means of early screening because it is radiation-free and effective on dense breast tissue. With the development of deep learning, convolutional neural networks (CNNs) have made significant progress in medical image analysis. In particular, residual networks (ResNet) have optimized training convergence and accuracy on datasets such as ImageNet and have been applied to breast ultrasound image classification. However, ultrasound images have problems such as low signal-to-noise ratio, blurred edges, and speckle noise. In addition, the number of publicly available datasets is limited (such as the BUSI dataset with only 780 images), which makes deep models prone to overfitting and have insufficient generalization performance.
[0003] To enhance feature extraction capabilities, researchers have proposed attention mechanisms such as compression and activation (SE) modules, which strengthen effective features by modeling channel dependencies and can be combined with ResNet to form SE-ResNet. However, the standard SE module does not explicitly model spatial location correlations, making it difficult to capture the global context of ultrasound tumors. Furthermore, existing methods mostly use static convolutions, which have poor robustness. If the network structure is further complicated to compensate for the defects, the risk of overfitting will be exacerbated under the constraint of small samples.
[0004] Training strategies are equally crucial for generalization. Traditional stochastic gradient descent (SGD) or Adam optimizers tend to converge to sharp minima in small-sample, high-noise ultrasound image scenarios, resulting in poor generalization performance. Sharpness-aware minimization (SAM) improves generalization performance by guiding the model to a "flat" minima region of the loss surface. However, in existing technologies, structural improvements in feature extraction and the application of optimization strategies such as SAM are disconnected: simple structural enhancement can exacerbate overfitting, while simple optimization strategy replacement cannot fully extract key information about lesions, failing to systematically break through the generalization bottleneck.
[0005] In summary, the existing technologies have the following shortcomings: (1) Basic CNN models (such as ResNet) and their improved versions (such as SE-ResNet) are not good at representing ultrasound image features, and structural complexity can easily exacerbate overfitting; (2) Traditional optimization methods (such as Adam) have poor generalization performance, and advanced strategies such as SAM are not effectively coordinated with feature extraction mechanisms; (3) Structural improvement and optimization strategy optimization are separated from each other, and there is a lack of systematic solutions. Summary of the Invention
[0006] The purpose of this invention is to provide a breast ultrasound tumor identification method that integrates channel attention and dynamic channel routing, so as to solve the problems mentioned in the background art.
[0007] To achieve the above objectives, a method for breast ultrasound tumor identification that integrates channel attention and dynamic channel routing is provided, comprising the following steps: S1. Acquire breast ultrasound images and perform preprocessing and data augmentation on the images; wherein, preprocessing includes scaling the images to a preset size and grayscale normalization; data augmentation includes performing random cropping, random horizontal flipping, and random small-angle rotation on the training set images; S2. Construct a deep convolutional neural network, and based on the deep convolutional neural network, process the image according to the feature processing flow, including: An improved ResNet101 backbone network was used to extract basic features from breast ultrasound images; SE channel attention units are embedded in each residual bottleneck block of the ResNet101 backbone network. The SE channel attention units generate channel weights by performing global average pooling, two fully connected layers + ReLU feature transformation, and Sigmoid activation on the feature map, and then weight the original feature map by channel to achieve adaptive weighting of feature channels and obtain high-level features of the image. A dynamic feature reconstruction module is connected after the high-level features output by ResNet101. The dynamic feature reconstruction module is based on the Mamba sequence modeling structure. It sequentially performs 1×1 convolution dimensionality reduction, flattening into spatial location sequence, Mamba global dependency modeling, average extraction of context vector from sequence dimension, two fully connected layers + Sigmoid to generate dynamic channel weights, and expands the dynamic channel weights and multiplies them with the original high-level features channel by channel to complete the feature reconstruction. S3. The deep convolutional neural network is trained using Focal Loss with class weights as the loss function and combined with the SAM optimizer. The SAM optimizer minimizes the maximum loss in the neighborhood of the parameters by performing a two-step gradient calculation method of perturbing the weights, recalculating the gradient, and updating the parameters. S4. Input the preprocessed breast ultrasound image to be identified into the trained deep convolutional neural network, and output the probability of the image belonging to the category of benign tumor, malignant tumor or normal tissue.
[0008] Furthermore, the preprocessed ultrasound image scaling in step S1 can be performed using bilinear interpolation to scale the ultrasound image to a×b pixels, where, Where a and b are both greater than 1, and N is a natural number, the interpolation formula is: ; in , For bilinear interpolation weights, The coordinates of the target in the original image The corresponding pixel coordinates in the field; Gray-level normalization can be achieved using Z-Score normalization, calculated based on global statistical features from training. The formula is as follows: ; in, For the original image in coordinates grayscale value at that location Let c be the average grayscale value of the training set images, where c is a real number greater than zero. Let d be the standard deviation of gray levels of the training set images, where d is a real number greater than zero. This is the normalized grayscale value.
[0009] Furthermore, the specific data augmentation strategies described in step S1 include: Randomly crop the image, with the cropped area having a height and width that are [0.7, 1.0] times that of the original image; Randomly flip horizontally, with a flip probability of 0.2-0.8; Random small-angle rotation, with a rotation angle range of [-15°, 15°], is performed. Areas exceeding the boundary are filled with reflection. Low-quality images appearing in the preprocessing step, including severely blurred images or images that are determined not to contain clear lesion areas, are discarded and not included in training.
[0010] Furthermore, the step of adaptively weighting the feature channels by the SE channel attention unit is as follows: First, the feature image output by the ResNet101 residual bottleneck block is processed. Perform global average pooling along the channel dimension to obtain the channel-wide feature vectors. The formula for calculating the Cth dimension is: ; Where H=a and W=b are the height and width of the ResNet101 high-level feature map, respectively, and a and b are both real numbers greater than zero; Let be the feature value of the feature map at coordinates (i,j) in the c-th channel; Secondly Given a two-layer fully connected network, the first fully connected layer reduces the dimension from C to [dimensionality]. ,in r is a preset dimensionality reduction ratio, resulting in an intermediate vector. The calculation formula is: ; Where ReLU is the linear rectified activation function; Then the intermediate vector q is input into the second fully connected layer, reducing the dimension from... Restore to C to obtain the channel weights. The calculation formula is: ; in Use the Sigmoid activation function; Finally, the weight p is multiplied channel by channel of the original feature map X to obtain the weighted feature map. The calculation formula is: ; in, This represents the eigenvalue of the C-th channel in the weighted feature map at coordinates (i,j). Let be the attention coefficient for the c-th channel.
[0011] Furthermore, the dynamic feature reconstruction described in step S2 specifically includes: First, the high-level feature maps output by ResNet101 are... By projecting it onto a low-dimensional space through a convolutional layer, we obtain... ,in The preset projection dimension; the calculation formula is: ; in, The weights are 1×1 convolution kernel weights. For bias, Indicates the convolution operation; Secondly Spatial dimensions are flattened into a sequence in row-major order. ,in To maintain the total number of spatial locations, retain the spatial location index associations; Then, the sequence S is input into a Mamba structure based on a state-space model for sequence modeling. This structure models the long-range dependencies of elements in the sequence with approximately linear complexity, and outputs the modeled sequence. The calculation formula is: ; in, This is the selective scanning mechanism in the Mamba core. For state transition weights, For projection weights; Then the sequence Perform average pooling on sequence dimension N to obtain the global context vector. Calculation formula: ; in, To model the feature vector at position n of the sequence, then the global context vector is... The input is fed into a two-layer fully connected network, where the first fully connected layer maps the m dimensions to... Dimension, to obtain the intermediate vector The calculation formula is: ; Here, ReLU is a linear rectified activation function, and then the intermediate vector h is input into the second fully connected layer, reducing the dimension from... Restore to C to obtain the channel weights. The calculation formula is: ; in, Use the Sigmoid activation function; , This is the weight matrix of the fully connected layer. , It is the bias vector; Finally, the channel weight w is expanded to the dimension. The reconstructed feature map is then multiplied channel-by-channel with the original high-level feature map X. The calculation formula is: ; in, This represents the feature value of the reconstructed feature map at coordinates (i,j) in the c-th channel. For dynamic channel weights.
[0012] Furthermore, the parameters of each component of the deep convolutional neural network described in step S2 are initialized in the following manner: First, the ResNet101 backbone network is loaded with weights obtained from pre-training on the ImageNet-1k dataset, and its convolutional layer and batch normalization layer parameters are latently transferred to this task and kept updatable during training. Then, in the SE channel attention unit, its weight matrix is initialized using a He normal distribution, following... in, This is the input feature dimension for this layer, and the bias vector is initialized to 0. Secondly, within the dynamic feature reconstruction module, the convolutional kernels are initialized using a uniform distribution of Xavier, and the pre-trained initialization parameters are loaded into the structure. The weights of the fully connected layers in the dynamic feature reconstruction module also use the same He normal distribution initialization method as the attention unit of the SE channel. Finally, the weights of the fully connected classification layer at the end of the model are initialized using a Xavier normal distribution, and the initial bias is set to zero to ensure the stability of gradient flow in the early stages of training.
[0013] Furthermore, the expression for the Focal Loss function in step S3 is: ; Where N is the batch sample size. Let i be the true class of the i-th sample. The i-th sample belongs to the true class after Softmax activation. The probability, As a focusing factor, For the real category The weighting coefficients are set to alleviate the imbalance in the number of good, bad, and normal samples in the data.
[0014] Furthermore, the specific implementation process of the SAM optimizer in step S3 includes: First, define the dual optimization objective function: ; in, For model parameters, Let be the parameter perturbation vector. To preset the disturbance radius, Focal Loss is the loss function. Then based on the current parameters Calculate the loss gradient Normalization yields the parameter perturbation: ; in, To avoid the minimum value where the denominator is 0; Then based on the new model parameters Recalculate the loss gradient ; Secondly, SGD is used as the basic optimizer to obtain updated parameters based on the new loss gradient. : ; in, This refers to the initial learning efficiency.
[0015] Furthermore, the model training in step S3 employs a multi-fold hierarchical cross-validation strategy, specifically including: The training set is stratified into multiple non-overlapping subsets according to the proportion of samples from each class. The proportion of samples from each class in each subset is consistent with the overall distribution. During each training fold, the model is trained in multiple preset epochs, employing an adaptive adjustment strategy with a cosine annealing learning rate and a decay coefficient of 0.8-0.95, along with an early stopping mechanism. After each training fold, the model weights with the best performance on the validation set are saved. After all training folds are completed, the model with the best overall performance on the validation set is selected as the final recognition model based on multiple performance metrics of each model. These performance metrics include sensitivity to malignant tumors, calculated using the following formula: ; Where TP represents the number of true positive samples and FN represents the number of false negative samples.
[0016] Furthermore, the category probability output and performance evaluation in step S4 specifically include: The category probabilities are calculated using a fully connected layer and a Softmax function, corresponding to three categories: normal tissue, benign tumor, and malignant tumor, respectively; then the logit value output by the fully connected layer is... , where k represents the three categories of normal tissue, benign tumor, and malignant tumor, and the probability of a sample belonging to the k-th category is . for: ; Where k=0,1,2, corresponding to normal tissue, benign tumor and malignant tumor respectively; Along with the output category probabilities, the following evaluation metrics are provided: First, for specificity, the calculation formula is: ; TN represents a true negative result, while FP represents a false positive result. Secondly, there is the macro average F1, calculated using the following formula: ; in, Indicates accuracy. This indicates the recall rate.
[0017] The present invention has the following advantages over the prior art: This invention embeds SE channel attention units into the ResNet101 backbone network to achieve adaptive weighting of feature channels, enabling the model to accurately focus on tumor-related features, effectively suppressing irrelevant noise interference, and significantly enhancing feature discrimination capabilities. Building upon this, a dynamic feature reconstruction module based on the Mamba structure is introduced. By modeling the global dependencies of feature sequences, dynamic calibration of global context information is achieved, significantly enhancing the model's adaptability to complex scenarios such as variable tumor morphology and blurred boundaries. Combined with class-weighted Focal Loss, the training bias caused by sample class imbalance is cleverly mitigated. Furthermore, the SAM optimizer guides the model to converge to a flat minimum region, successfully suppressing overfitting tendencies in small sample scenarios and simultaneously improving the model's stability and generalization performance under noise interference. Meanwhile, image preprocessing and data augmentation strategies further expand the diversity of training samples, reducing the negative impact of inherent characteristics of ultrasound images such as low signal-to-noise ratio and blurred edges. Ultimately, this achieves more accurate and reliable identification of breast ultrasound tumors, assisting in precise clinical screening and demonstrating promising clinical application prospects. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of the breast ultrasound tumor identification model of the present invention; Figure 2 This is a schematic diagram of the breast ultrasound tumor identification method of the present invention; Figure 3 This is a multi-class ROC curve of the model of this invention on the BUSI breast ultrasound dataset; Figure 4 This is a graph showing the changes in loss, validation accuracy, and validation AUC during the training process of the model of this invention. Figure 5 This is a box plot showing the cross-validation classification performance of the model of this invention on the BUSI dataset. Detailed Implementation
[0019] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0020] This invention provides a method for breast ultrasound tumor identification that integrates channel attention and dynamic channel routing, such as... Figure 1 The diagram shown is a schematic of the breast ultrasound tumor recognition model of this application. Figure 2 This is a schematic diagram of the breast ultrasound tumor identification method of this application, for reference. Figure 1 and 2 The implementation process of this application includes the following steps: Step 1: Acquisition of breast ultrasound images and division of dataset.
[0021] In this embodiment, the publicly available breast ultrasound dataset (BUSI) is selected. This dataset includes 780 breast ultrasound images, of which 133 are normal tissue images, 437 are benign tumor images, and 210 are malignant tumor images. All images have been verified by clinical pathology diagnosis to ensure accuracy. Then, the dataset (BUSI) is cleaned up, invalid data is removed, and finally 776 valid images are retained for subsequent processes. The effective dataset is then divided into two independent parts: the training set and the test set. The effective dataset is then divided into the training set and the test set according to a certain ratio. Preferably, the ratio of the training set to the test set is 8:2. The test set remains unchanged throughout the entire model development and evaluation cycle and is only used for independent validation of the final model performance. Stratified sampling is used during training to ensure that the proportion of the three types of samples in the test set is basically consistent with the proportion of the overall dataset, so as to maintain the representativeness of the data distribution. Subsequently, to improve the stability and reliability of the evaluation results and avoid the randomness of a single data partitioning, a hierarchical K-fold cross-validation strategy was adopted for the training set, with K=5 being the preferred value. This means that the training set is evenly divided into K non-overlapping subsets according to the category ratio (normal, benign, malignant). Each subset is called a fold. In each round of validation, one fold is used as the validation subset, and the remaining K-1 folds are used as the training subset.
[0022] Step 2: Image preprocessing and data augmentation.
[0023] After the dataset is divided, the images are preprocessed to meet the input requirements of deep convolutional neural networks, and data augmentation is used to increase the diversity of training data and improve the robustness of the model.
[0024] Preprocessing mainly includes image scaling and grayscale normalization. Image scaling uses bilinear interpolation, which calculates the grayscale value of the target pixel by weighted averaging the grayscale values of the four neighboring pixels surrounding the projection point of the target pixel in the original image. Since the backbone network ResNet101 of this application typically receives input of a fixed size (e.g., 224×224), it is necessary to scale the breast ultrasound image to this preset size. The specific calculation process is as follows: For a coordinate (x, y) in a target image, first determine the coordinates of the neighboring pixels in the original image that correspond to that coordinate. (i=0,1; j=0,1), then calculate the grayscale value of the target pixel according to the bilinear interpolation formula, which is: ; in The weights are for bilinear interpolation, and the calculation method is as follows: , , For the original image in The grayscale value at that location can be used to uniformly scale all input images to 224 pixels high and 224 pixels wide. After resizing, grayscale normalization is performed. Normalization aims to give the image data zero mean and unit variance, which helps accelerate model training convergence and improve stability. Grayscale normalization uses the Z-Score normalization method, calculated based on the global statistical features of the training set. First, the average grayscale value of all images in the training set is calculated. and grayscale standard deviation According to calculations, the average grayscale value of the training set images in this embodiment is... grayscale standard deviation Then, for each pixel (x, y) in each image, its original grayscale value I(x, y) is normalized to the following value: ; Normalization eliminates brightness differences between different images, accelerating model training convergence.
[0025] Data augmentation strategies include random cropping, random horizontal flipping, and random small-angle rotation. Random cropping refers to randomly cropping a rectangular area from the preprocessed image. In this embodiment, the height and width of the cropped area are random values between [0.7, 1.0] times the height and width of the original image. The cropped image is then scaled back to 224×224 pixels. Random horizontal flipping refers to flipping the image horizontally along the vertical central axis with a certain probability. In this embodiment, the flipping probability is 0.5. Random small-angle rotation refers to rotating the image around its center point by randomly selecting an angle within the range of [-15°, 15°]. For areas outside the image boundaries after rotation, reflection filling is used. The formula for reflection filling is: , This is a reflection mapping function that uses reflection filling to avoid black pixel blocks in the boundary areas, thus maintaining the continuity of image features.
[0026] For low-quality ultrasound images that are severely blurry, have excessive artifacts, or, based on professional assessment, do not contain clearly defined breast tissue or lesion areas, a discard logic is implemented. The criterion for judging low-quality images is to calculate the blurriness of the image using the Laplacian operator. For low-quality ultrasound images that do not contain clearly defined breast tissue or lesion areas, a lesion area detection algorithm based on threshold segmentation is used. For the above two types of low-quality images, they are directly discarded from the training set and do not participate in model training to ensure the quality of training data.
[0027] Step 3: Construct a deep convolutional neural network that integrates channel attention and dynamic feature reconstruction.
[0028] Appendix Figure 1 This is a schematic diagram of the breast ultrasound tumor recognition model structure of this application. The overall architecture of the model is based on the deep convolutional neural network ResNet101, and integrates a channel attention mechanism and a dynamic feature reconstruction module on it to fully extract the features of breast ultrasound images; and combines the Sharpness-AwareMinimization (SAM) optimization algorithm during training to obtain stronger generalization ability. First, the weights of the ResNet101 model (which consists of one 7×7 convolutional layer, three 3×3 max pooling layers, eight residual block groups, and one global average pooling layer) pre-trained on a large natural image dataset (e.g., ImageNet-1k) are loaded. In this implementation, the pre-trained parameters of all convolutional layers and batch normalization layers are directly used as initial values and fine-tuned in subsequent training on breast ultrasound images. Secondly, each residual bottleneck block of ResNet101 is modified by embedding a Squeeze-and-Excitation (SE) channel attention unit. The embedding position is after the activation function of the residual bottleneck block and before the shortcut connections are added. The specific calculation process is as follows: for an input feature map... (Where C is the number of high-level feature channels in ResNet101, C=2048 in this embodiment; H and W are the height and width of the feature map, respectively, H=224 and W=224 in this embodiment.) Perform global average pooling along the channel dimension to obtain a channel statistics vector z of dimension C. The c-th dimension of vector z... The calculation formula is: ; Then, the global feature vector z is input into a two-layer fully connected network. The dimensionality reduction ratio r of the first fully connected layer is set to 16, which is the intermediate dimension. The weight matrix of this layer Initialization is performed using a He normal distribution, which follows the... in, The input feature dimension of this layer is used to obtain the intermediate vector through the ReLU activation function. The calculation formula is: ; The second fully connected layer restores the dimension to the original number of channels C, followed by a sigmoid activation function to obtain the weight vector for each channel. Finally, the weight p is multiplied channel by channel with the original feature map X to generate the weighted feature map. The specific calculation formula is as follows: ; This operation enhances important feature channels and suppresses secondary feature channels, thereby improving the model's sensitivity to tumor features.
[0029] Finally, after the high-level features extracted by the ResNet101 backbone network, a Dynamic Feature Reconstruction (DCR) module is connected. The processing flow is as follows: First, the high-level feature map X is projected onto a lower dimension m through a 1×1 convolutional layer. In this implementation, m=256, and the weights of the 1×1 convolutional kernel are... Initialization is performed using a uniform Xavier distribution, with bias applied. Initialize to 0 to obtain the feature map The calculation formula is: ; Then, the spatial dimensions are unfolded and reshaped into a two-dimensional sequence. ,in Given the total number of spatial locations, a hidden layer dimension of 256, a state dimension of 512, an expansion factor of 2, a sequence processing step size of 1, and an attention window size of 64, S is input into a Mamba structure for global sequence modeling, and the updated sequence is output. The calculation formula is as follows: ; For sequence Perform average pooling on sequence dimension N to obtain the global context vector. Calculation formula: ; in, To model the feature vector at position n of the sequence, the global context vector is used. The input is given to a two-layer fully connected network, with the intermediate dimension of the first fully connected layer being... Weight matrix Initialized using a He normal distribution, with bias... Initialize to 0, and obtain the intermediate vector through the ReLU activation function. The specific calculation is as follows: The second fully connected layer restores the dimension from 64 to 2048, and the weight matrix... Similarly, the He normal distribution is used for initialization, with bias... Initialize to 0, and obtain dynamic channel weights through the Sigmoid activation function. The specific calculation is as follows: ; Weight vector After expansion, the feature map is multiplied channel-by-channel with the original high-level feature map X to obtain the final reconstructed feature map. The specific calculation is as follows: ; To enhance the representation of global contextual information such as blurred tumor boundaries and variable shapes, after processing by the dynamic feature reconstruction module, a global average pooling layer and a fully connected classification layer are connected. The global average pooling layer then converts the reconstructed feature map... The output dimension of the classification layer is 3 (corresponding to three categories: normal tissue, benign tumor, and malignant tumor). It is then converted into the predicted probability of each category by the Softmax function. In particular, the weight matrix of the fully connected classification layer is initialized with Xavier normal distribution, and the bias vector is initialized to 0 to ensure the stability of gradient flow in the early stage of training and avoid gradient vanishing or exploding problems.
[0030] Step 4: Training and optimization of deep convolutional neural networks.
[0031] After constructing the network model, the next step is training. This application uses Focal Loss with class weights as the loss function, combined with the SAM optimizer for training the deep convolutional neural network and a 5-fold hierarchical crossover validation strategy. The specific training process is as follows: First, the Focal Loss loss function is improved, with the following formula: ; Where N is the batch sample size. Let i be the true class of the i-th sample. The i-th sample belongs to the true class after Softmax activation. The probability, As a focusing factor, For the real category The weighting coefficients are set (0 corresponds to normal tissue, 1 corresponds to benign tumors, and 2 corresponds to malignant tumors). Specifically, in this embodiment, The value is 32. , , , By increasing the weight of malignant tumor samples, the model's ability to identify malignant tumors can be improved, and the rate of missed diagnoses can be reduced. Then, the optimizer is used with the Sharpness-Aware Minimization (SAM) algorithm, first defining a dual optimization objective function: ; in, For model parameters, Let be the parameter perturbation vector. In this embodiment, to preset the disturbance radius, , The Focal Loss function is used; then, based on the current model parameters... Calculate the loss gradient The loss gradient is normalized to obtain the parameter perturbation. The specific calculation is as follows: ; in, To avoid the minimum value where the denominator is 0; Then based on the new model parameters Recalculate the loss gradient ; Secondly, SGD is used as the basic optimizer to obtain updated parameters based on the new loss gradient. : ; in, For initial learning efficiency, in this embodiment, the initial learning rate is... Then, a cosine annealing scheduling strategy is used to adjust the learning rate, and the gradients are clipped using the L2 norm with a clipping threshold of 1.0 to prevent gradient explosion. Then, training is performed using a hierarchical K-fold cross-validation strategy. For each fold, the model is trained using the training subset data, and the performance metrics on the validation subset are monitored. In this implementation, K=5. Specifically, the total number of training rounds is 30 epochs. The number of iterations in each epoch is the number of training subset samples divided by the number of batch samples, i.e., 497÷32≈16 iterations. During training, an adaptive adjustment strategy for the cosine annealing learning rate is adopted. The period of cosine annealing is set to 10 epochs, and the decay coefficient is set to 0.9 to avoid model oscillation. Then, an early stopping mechanism is adopted. If the performance index of the validation set does not improve for several consecutive epochs, the training is terminated early. In this implementation, when the AUC value of the validation set does not improve for 5 consecutive epochs (for example, the improvement of the AUC value of the validation set is less than one ten-thousandth), the training of the current epoch is stopped to prevent the model from overfitting. After each epoch, the classification accuracy, AUC value and other performance indexes of the model on the validation subset are calculated, and the weights of the model with the best performance on the validation set are saved.
[0032] In this embodiment, following the above training parameters and procedures, five training subsets and validation subsets are trained sequentially: During the first training epoch, the first training subset is used for model training, and the first validation subset is used for performance monitoring. After training for 30 epochs or triggering the early stopping mechanism, the optimal model weights for that epoch are saved. Subsequently, the second to fifth epochs are trained sequentially, and the optimal model weights for each epoch are saved. At the same time, during the training process, the training loss, validation set classification accuracy, and validation set AUC value for each epoch are recorded for subsequent model performance analysis.
[0033] Step 5: Model testing selection and performance evaluation.
[0034] After completing the 5-fold cross-validation training, the optimal model weights saved in 5 folds are collected, and multiple performance indicators of each model on the corresponding validation subset are calculated, including classification accuracy, sensitivity to malignant tumors, specificity, macro-average F1-score, and AUC value of each category. Then, based on the comprehensive performance of each indicator, the model with the highest comprehensive score is selected as the final recognition model. In this embodiment, the model trained in the third fold achieved a classification accuracy of 0.927 on the validation subset, a sensitivity of 0.939 for malignant tumors, a specificity of 0.912, a macro-average F1-score of 0.923, and an average AUC of 0.968. It exhibited the best overall performance and was therefore selected as the final identification model.
[0035] The selected final model is then used for inference and evaluation on a completely independent test set. For each image in the test set, the trained model is input, and the final output is the probability values for three categories. The probability calculation is implemented through a fully connected layer and the Softmax function. The specific calculation formula is as follows: ; Where k=0,1,2, corresponding to normal tissue, benign tumor, and malignant tumor, respectively. The logit value is the output of the fully connected layer. Based on the class probabilities output by the model, a threshold method is used to determine the predicted class of the image. When the probability of a certain class is greater than 0.5, the image is determined to belong to that class; if the probability of all classes is less than 0.5, it is determined to be an unknown class. To comprehensively evaluate the model's performance, overall classification accuracy, macro-average AUC, and key medical indicators for malignant tumor identification, including sensitivity, were calculated. ; In this embodiment, the sensitivity for malignant tumors is 0.9268; Specificity: ; In this embodiment, the specificity is 0.9091; Macro average F1 score: ; In this embodiment, the macro average F1-score is 0.9183; the AUC values of each category are calculated by plotting ROC curves and finding the area under the curve (AUC). The AUC value of normal tissue is 0.9628, the AUC value of benign tumor is 0.9531, the AUC value of malignant tumor is 0.9422, and the average AUC value is 0.9527. The following description, in conjunction with the accompanying drawings, further illustrates the points, such as... Figure 3 As shown, Figure 3 The figure shows the multi-class ROC curve of the model of this invention on the BUSI breast ultrasound dataset. As can be seen from the figure, the ROC curves of normal tissue, benign tumor and malignant tumor are far away from the random guess line (AUC=0.5) and the area under the curve is greater than 0.94, indicating that the model has a strong ability to distinguish between the three categories. like Figure 4 As shown, Figure 4 The graph shows the changes in loss, validation accuracy, and validation AUC during the training process of the model of this invention. As can be seen from the graph, the training loss gradually decreases and tends to stabilize with the increase of epochs, while the validation accuracy and validation AUC gradually increase with the increase of epochs and basically stabilize after 20 epochs. This indicates that the model training process converges stably and no obvious overfitting phenomenon occurs. like Figure 5 As shown, Figure 5 The box plot shows the cross-validation classification performance of the model of this invention on the BUSI dataset. As can be seen from the figure, the mean AUC value of 5-fold cross-validation is 0.9828, the mean classification accuracy is 0.8973, and the performance indicators of each fold are concentrated with small dispersion, indicating that the model has good stability and generalization ability.
[0036] In summary, the breast ultrasound tumor identification method based on the fusion of channel attention and dynamic channel routing described in this application expands sample diversity through image preprocessing and data augmentation, enhances feature extraction capabilities through the fusion of ResNet101 backbone network, SE channel attention unit, and dynamic feature reconstruction module, and improves model training performance through the combination of FocalLoss loss function and SAM optimizer. Finally, it achieves excellent recognition performance on the BUSI breast ultrasound dataset, accurately distinguishing between normal tissue, benign tumors, and malignant tumors, providing an effective auxiliary means for clinical breast ultrasound tumor identification.
[0037] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A method for breast ultrasound tumor identification that integrates channel attention and dynamic channel routing, characterized in that: S1. Acquire breast ultrasound images and perform preprocessing and data augmentation on the images; wherein, preprocessing includes scaling the images to a preset size and grayscale normalization; data augmentation includes performing random cropping, random horizontal flipping, and random small-angle rotation on the training set images; S2. Construct a deep convolutional neural network, and based on the deep convolutional neural network, process the image according to the feature processing flow, including: An improved ResNet101 backbone network was used to extract basic features from breast ultrasound images; SE channel attention units are embedded in each residual bottleneck block of the ResNet101 backbone network. The SE channel attention units generate channel weights by performing global average pooling, two fully connected layers + ReLU feature transformation, and Sigmoid activation on the feature map, and then weight the original feature map by channel to achieve adaptive weighting of feature channels and obtain high-level features of the image. A dynamic feature reconstruction module is connected after the high-level features output by ResNet101. The dynamic feature reconstruction module is based on the Mamba sequence modeling structure. It sequentially performs 1×1 convolution dimensionality reduction, flattening into spatial location sequence, Mamba global dependency modeling, average extraction of context vector from sequence dimension, two fully connected layers + Sigmoid to generate dynamic channel weights, and expands the dynamic channel weights and multiplies them with the original high-level features channel by channel to complete the feature reconstruction. S3. The deep convolutional neural network is trained using Focal Loss with class weights as the loss function and combined with the SAM optimizer. The SAM optimizer minimizes the maximum loss in the neighborhood of the parameters by performing a two-step gradient calculation method of perturbing the weights, recalculating the gradient, and updating the parameters. S4. Input the preprocessed breast ultrasound image to be identified into the trained deep convolutional neural network, and output the probability of the image belonging to the category of benign tumor, malignant tumor or normal tissue.
2. The breast ultrasound tumor identification method based on fusion of channel attention and dynamic channel routing according to claim 1, characterized in that: The ultrasound image scaling in step S1 can be achieved using bilinear interpolation to scale the ultrasound image to a×b pixels, where... Where a and b are both greater than 1, and N is a natural number, the interpolation formula is: ; in , For bilinear interpolation weights, The coordinates of the target in the original image The corresponding pixel coordinates in the field; Gray-level normalization can be achieved using Z-Score normalization, calculated based on global statistical features from training. The formula is as follows: ; in, For the original image in coordinates grayscale value at that location Let c be the average grayscale value of the training set images, where c is a real number greater than zero. Let d be the standard deviation of gray levels of the training set images, where d is a real number greater than zero. This is the normalized grayscale value.
3. The breast ultrasound tumor identification method based on fusion of channel attention and dynamic channel routing according to claim 1, characterized in that: The specific data augmentation strategies described in step S1 include: Randomly crop the image, with the cropped area having a height and width that are [0.7, 1.0] times that of the original image; Randomly flip horizontally, with a flip probability of 0.2-0.8; Random small-angle rotation, with a rotation angle range of [-15°, 15°], is performed. Areas exceeding the boundary are filled with reflection. Low-quality images appearing in the preprocessing step, including severely blurred images or images that are determined not to contain clear lesion areas, are discarded and not included in training.
4. The breast ultrasound tumor identification method based on fusion of channel attention and dynamic channel routing according to claim 1, characterized in that: The steps for adaptive weighting of feature channels by the SE channel attention unit are as follows: First, the feature image output by the ResNet101 residual bottleneck block is processed. Perform global average pooling along the channel dimension to obtain the channel global feature vector. The formula for calculating the Cth dimension is: ; Where H=a and W=b are the height and width of the ResNet101 high-level feature map, respectively, and a and b are both real numbers greater than zero; Let be the feature value of the feature map at coordinates (i,j) in the c-th channel; Secondly Given a two-layer fully connected network, the first fully connected layer reduces the dimension from C to [dimensionality]. ,in r is a preset dimensionality reduction ratio, resulting in an intermediate vector. The calculation formula is: ; Where ReLU is the linear rectified activation function; Then the intermediate vector q is input into the second fully connected layer, reducing the dimension from... Restore to C to obtain the channel weights. The calculation formula is: ; in Use the Sigmoid activation function; Finally, the weight p is multiplied channel by channel of the original feature map X to obtain the weighted feature map. The calculation formula is: ; in, This represents the eigenvalue of the C-th channel in the weighted feature map at coordinates (i,j). Let be the attention coefficient for the c-th channel.
5. The breast ultrasound tumor identification method based on fusion of channel attention and dynamic channel routing according to claim 1, characterized in that: The dynamic feature reconstruction described in step S2 specifically includes: First, the high-level feature maps output by ResNet101 are... By projecting it onto a low-dimensional space through a convolutional layer, we obtain... ,in The preset projection dimension; the calculation formula is: ; in, The weights are 1×1 convolution kernel weights. For bias, Indicates the convolution operation; Secondly Spatial dimensions are flattened into a sequence in row-major order. ,in To maintain the total number of spatial locations, retain the spatial location index associations; Then, the sequence S is input into a Mamba structure based on a state-space model for sequence modeling. This structure models the long-range dependencies of elements in the sequence with approximately linear complexity, and outputs the modeled sequence. The calculation formula is: ; in, This is the selective scanning mechanism in the Mamba core. For state transition weights, For projection weights; Then the sequence Perform average pooling on sequence dimension N to obtain the global context vector. Calculation formula: ; in, To model the feature vector at position n of the sequence, then the global context vector is... The input is fed into a two-layer fully connected network, where the first fully connected layer maps the m dimensions to... Dimension, to obtain the intermediate vector The calculation formula is: ; Here, ReLU is a linear rectified activation function, and then the intermediate vector h is input into the second fully connected layer, reducing the dimension from... Restore to C to obtain the channel weights. The calculation formula is: ; in, Use the Sigmoid activation function; , This is the weight matrix of the fully connected layer. , It is the bias vector; Finally, the channel weight w is expanded to the dimension. The reconstructed feature map is then multiplied channel-by-channel with the original high-level feature map X. The calculation formula is: ; in, This represents the feature value of the reconstructed feature map at coordinates (i,j) in the c-th channel. For dynamic channel weights.
6. The breast ultrasound tumor identification method based on fusion of channel attention and dynamic channel routing according to claim 5, characterized in that: The components of the deep convolutional neural network described in step S2 are initialized with parameters in the following manner: First, the ResNet101 backbone network is loaded with weights obtained from pre-training on the ImageNet-1k dataset, and its convolutional layer and batch normalization layer parameters are latently transferred to this task and kept updatable during training. Then, in the SE channel attention unit, its weight matrix is initialized using a He normal distribution, following... in, This is the input feature dimension for this layer, and the bias vector is initialized to 0. Secondly, within the dynamic feature reconstruction module, the convolutional kernels are initialized using a uniform distribution of Xavier, and the pre-trained initialization parameters are loaded into the structure. The weights of the fully connected layers in the dynamic feature reconstruction module also use the same He normal distribution initialization method as the attention unit of the SE channel. Finally, the weights of the fully connected classification layer at the end of the model are initialized using a Xavier normal distribution, and the initial bias is set to zero to ensure the stability of gradient flow in the early stages of training.
7. The breast ultrasound tumor identification method based on fusion of channel attention and dynamic channel routing according to claim 1, characterized in that: The expression for the Focal Loss function in step S3 is: ; Where N is the batch sample size. Let i be the true class of the i-th sample. The i-th sample belongs to the true class after Softmax activation. The probability, As a focusing factor, For the real category The weighting coefficients are set to alleviate the imbalance in the number of good, bad, and normal samples in the data.
8. The breast ultrasound tumor identification method based on fusion of channel attention and dynamic channel routing according to claim 1, characterized in that: The specific implementation process of the SAM optimizer in step S3 includes: First, define the dual optimization objective function: ; in, For model parameters, Let the parameter perturbation vector be... To preset the disturbance radius, Focal Loss is the loss function. Then based on the current parameters Calculate the loss gradient Normalization yields the parameter perturbation: ; in, To avoid the minimum value where the denominator is 0; Then based on the new model parameters Recalculate the loss gradient ; Secondly, SGD is used as the basic optimizer to obtain updated parameters based on the new loss gradient. : ; in, This is for initial learning efficiency.
9. The breast ultrasound tumor identification method based on fusion of channel attention and dynamic channel routing according to claim 8, characterized in that: The model training in step S3 employs a multi-fold hierarchical cross-validation strategy, specifically including: The training set is stratified into multiple non-overlapping subsets according to the proportion of samples from each class. The proportion of samples from each class in each subset is consistent with the overall distribution. During each training fold, the model is trained in multiple preset epochs, employing an adaptive adjustment strategy with a cosine annealing learning rate and a decay coefficient of 0.8-0.95, along with an early stopping mechanism. After each training fold, the model weights with the best performance on the validation set are saved. After all training folds are completed, the model with the best overall performance on the validation set is selected as the final recognition model based on multiple performance metrics of each model. These performance metrics include sensitivity to malignant tumors, calculated using the following formula: ; Where TP represents the number of true positive samples and FN represents the number of false negative samples.
10. The breast ultrasound tumor identification method based on fusion of channel attention and dynamic channel routing according to claim 1, characterized in that: The category probability output and performance evaluation in step S4 specifically include: The category probabilities are calculated using a fully connected layer and a Softmax function, corresponding to three categories: normal tissue, benign tumor, and malignant tumor, respectively; then the logit value output by the fully connected layer is... , where k represents the three categories of normal tissue, benign tumor, and malignant tumor, and the probability of a sample belonging to the k-th category is . for: ; Where k=0,1,2, corresponding to normal tissue, benign tumor and malignant tumor respectively; Along with the output category probabilities, the following evaluation metrics are provided: First, for specificity, the calculation formula is: ; TN represents a true negative result, while FP represents a false positive result. Secondly, the macro average F1 is calculated using the following formula: ; in, Indicates accuracy. This indicates the recall rate.