Breast tumor lesion part ultrasonic image segmentation method and device based on SAM-VMama model

By constructing the SAM-VMamba model and combining local and global feature extraction with interactive prompts, the problem of low segmentation accuracy in ultrasound images of breast tumors was solved, achieving efficient segmentation of breast tumor boundaries and supporting precise clinical localization and diagnosis.

CN121458744APending Publication Date: 2026-02-03ANHUI UNIVERSITY OF TRADITIONAL CHINESE MEDICINE
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511636066.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-10
Publication Date
2026-02-03

AI Technical Summary

Technical Problem

Existing methods for segmenting ultrasound images of breast tumors are unable to capture the long-sequence spatial association between the tumor and surrounding tissues, resulting in low segmentation accuracy for small lesions. Furthermore, existing SAM models are not well adapted to ultrasound images, have long training times, high memory complexity, and are difficult to handle the long-sequence features of ultrasound images.

Method used

A SAM-VMamba model is constructed, including a first encoder, a second encoder, a cue encoder, and a mask decoder. Local and global features are extracted through a multi-layer ViT encoder and VMamba architecture. Interactive cue information is combined, and a hybrid loss function is used to optimize the model. A staged cue interaction strategy is adopted for training.

Benefits of technology

It achieves a balance between high precision and high efficiency, adapts to the grayscale unevenness and artifact characteristics of ultrasound images, improves the accuracy and processing efficiency of breast tumor boundary segmentation, and supports precise clinical localization and diagnosis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121458744A_ABST
    Figure CN121458744A_ABST
Patent Text Reader

Abstract

The invention relates to a breast tumor lesion part ultrasonic image segmentation method based on an SAM-VMama model. The method comprises the steps of obtaining a breast ultrasonic image set and performing preprocessing; the method comprises the following steps: constructing an SAM-VMama model, wherein the SAM-VMama model comprises a first encoder, a second encoder, a prompt encoder and a mask decoder; obtaining a trained model; obtaining a preprocessed breast ultrasound image to be segmented; and obtaining a segmentation result of the breast lesion tumor. According to the method, the local features are extracted through the first extraction, the global features are extracted through the second encoder, the interactive prompt information processed by the prompt encoder is combined, and the precise segmentation mask is generated through the mask decoder; the method not only retains the flexibility of SAM interactive segmentation, but also improves the long-sequence data processing capability and calculation efficiency through a Mamba structure, effectively adapts to the characteristics of uneven gray scale, multiple artifacts and the like of the ultrasonic image, and achieves the balance of high precision and high efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of medical image processing technology, and in particular to a method and device for segmenting ultrasound images of breast tumor lesions based on the SAM-VMamba model. Background Technology

[0002] Breast cancer, the most commonly diagnosed malignant tumor in women, is one of the leading causes of cancer death among women. Early-stage treatment involves surgical removal of the tumor, aiming to preserve as much healthy tissue as possible while completely removing the tumor. Therefore, the precision of tumor resection is a major challenge in this surgery. Patients with unclear margins are highly likely to require a second resection, potentially causing them to miss the optimal treatment window and increasing their psychological burden. Given the high incidence of positive margins after breast tumor resection, precise tumor localization is key to overcoming this challenge.

[0003] Medical image segmentation, a key technology in medical image processing, is crucial for accurately defining the boundaries between lesions and normal tissues, providing precise anatomical and pathological information for clinical decision-making. Deep convolutional neural networks (DCNNs) have revolutionized this field by automatically extracting key visual features from massive medical image datasets. However, existing segmentation methods struggle to capture the long-term spatial relationships between tumors and surrounding tissues, resulting in low segmentation accuracy for small lesions. While the SAM (Segment Anything Model) supports interactive segmentation, its pre-training data primarily consists of natural images, which are insufficient for adapting to artifacts and low contrast in ultrasound images, requiring additional fine-tuning with fewer samples. Furthermore, the ViT module used has a large number of parameters, resulting in long training times and high memory complexity. It is difficult to process the long sequence features of ultrasound images. Summary of the Invention

[0004] To address the problem of accurate and efficient image segmentation of existing breast tumor regions, the primary objective of this invention is to provide a method for segmenting ultrasound images of breast tumor lesions based on the SAM-VMamba model.

[0005] To achieve the above objectives, the present invention employs the following technical solution: a method for segmenting ultrasound images of breast tumor lesions based on the SAM-VMamba model, the method comprising the following sequential steps:

[0006] (1) Obtain a breast ultrasound image set and preprocess it to obtain a preprocessed breast ultrasound image set. Divide the preprocessed breast ultrasound image set into a training set and a validation set in a ratio of 8:2.

[0007] (2) Construct a SAM-VMamba model, which includes a first encoder, a second encoder, a cue encoder, and a mask decoder;

[0008] (3) Input the training set into the SAM-VMamba model for training to obtain the trained model;

[0009] (4) Obtain the breast ultrasound image to be segmented and preprocess it to obtain the preprocessed breast ultrasound image to be segmented;

[0010] (5) Input the preprocessed breast ultrasound image to be segmented into the trained model to obtain the segmentation results of breast lesions and tumors.

[0011] Step (1) specifically includes the following steps:

[0012] (1a) Artifact removal: Smooth the image using a 3×3 convolution kernel Gaussian filter;

[0013] (1b) Noise removal: Adaptive threshold segmentation is used to separate the breast parenchyma from the background and remove interfering regions;

[0014] (1c) Normalization: Normalize the pixel values ​​to [0,1] to eliminate the grayscale differences between different ultrasound devices;

[0015] (1d) Size adjustment: The image is uniformly scaled to 512×512 resolution using bilinear interpolation to ensure consistent model input size;

[0016] (1e) Expand: Perform random flipping, rotation and contrast adjustment to expand the data volume.

[0017] In step (2), the first encoder includes an image embedding layer, a multi-layer ViT encoder, and a feature downsampling layer. Each ViT encoder adopts a dual-branch structure of MSA multi-head self-attention and MLP multilayer perceptron. The image embedding layer receives a pre-processed 512×512 resolution breast ultrasound image and outputs features of shape (B, 1025, 768) to the MSA multi-head self-attention of the multi-layer ViT encoder, where B is the batch size. First, the input features are normalized by layer normalization, then the local correlation between image blocks is captured by MSA multi-head self-attention, and then the original features and attention output are fused by residual connection. Then, the input features are normalized by layer again and input into the MLP multilayer perceptron for nonlinear feature transformation. Finally, the processed features are output by residual connection. After the multi-layer ViT encoder is stacked, the feature map is downsampled by a 1×1 convolution kernel and a stride of 2 to reduce the feature dimension and increase the receptive field, preparing for the feature fusion with the second encoder. The first encoder outputs a local feature map.

[0018] In step (2), the second encoder adopts the VMamba architecture, specifically including layer normalization, a first linear layer, depthwise convolution, SiLU activation function, selective scanning 2D module, second linear layer and residual connection module. The layer normalization standardizes the input features, the first linear layer adjusts the dimensions of the normalized features, the depthwise convolution captures the local details of the features through grouped convolution, the SiLU activation function enhances the non-linear expressive ability of the features, the selective scanning 2D module flattens the 2D features into a 1D sequence, and the features output by the selective scanning 2D module are linearly mapped through the second linear layer and then fused through the residual connection module to finally output a global feature map.

[0019] In step (2), the prompt encoder includes a coordinate normalization and encoding layer and a sparse prompt embedding layer; the coordinate normalization layer and the encoding layer receive interactive prompts input by the user, perform coordinate normalization, and align them with the scale of the image features. The interactive prompts include point prompts and bounding box prompts; the sparse prompt embedding layer converts the outputs of the coordinate normalization layer and the encoding layer into low-dimensional sparse feature vectors to filter redundant information.

[0020] In step (2), the mask decoder includes a feature fusion and Transformer encoding module, a mask token generation module, an upsampling and mask prediction module, and a candidate mask and IoU prediction module. The feature fusion and Transformer encoding module concatenates and fuses the local feature map output by the first encoder, the global feature map output by the second encoder, and the cue features output by the cue encoder to obtain fused features, thereby enhancing the semantic interaction between image features and cue features. The mask token generation module generates command information to control mask generation based on the fused features, defining the target region logic for segmentation. The upsampling and mask prediction module restores the feature map from low resolution to the resolution of the original ultrasound image, and generates a preliminary segmentation mask in combination with the mask prediction logic. The candidate mask and IoU prediction module generates multiple candidate segmentation masks with different confidence levels, calculates the intersection-union ratio (IoU) between each candidate mask and the real tumor region, selects the mask with the highest IoU as the final output, and filters out small noise areas to ensure the accuracy of the segmentation results.

[0021] Step (3) specifically includes the following steps:

[0022] (3a) Set the batch size to 24, the number of iterations to 50, the image input resolution to 256×256, use the Adam optimizer to optimize the model, set the initial learning rate to 1e-4, and decrease the learning rate by gamma=0.5 in the 5th and 10th epochs.

[0023] (3b) After obtaining the output of the model, calculate the loss. The loss function is a hybrid loss function. The formula is as follows:

[0024] ;

[0025] in, , , These are all weighting coefficients, with values ​​of 20, 1, and 1 respectively; It is a focal loss. It is a banded coefficient loss. It is a comparison of losses;

[0026] The output of the model refers to the 512×512 resolution candidate segmentation mask generated by the model through the mask decoder for the input breast ultrasound image. The pixel value of each mask is the probability value in the range [0,1], which represents the confidence that the pixel belongs to the breast tumor region.

[0027] The formula used to solve the class imbalance problem is:

[0028] ;

[0029] In the formula, For the first The real label of each pixel The model predicts the probability that this pixel is a tumor region, where γ is the focusing parameter and N is the number of samples.

[0030] The formula used to optimize boundary segmentation accuracy is:

[0031]

[0032] in, Represents pixels The predicted value;

[0033] The formula used to improve regional matching accuracy is:

[0034]

[0035] (3c) Calculate the gradient based on the hybrid loss function and update the model parameters through backpropagation, wherein the underlying parameters of the first encoder are frozen and only the parameters in the second encoder are trained;

[0036] (3d) A phased prompting interaction strategy is adopted during the training process: in the initial stage, bounding boxes or point prompts are randomly selected for training. In the iterative stage, new point prompts are generated for multiple rounds of interactive learning, with the number of iterations per round set to 4. The new point prompts refer to the correction guide points automatically generated by the model in the iterative training process after comparing the tumor segmentation mask predicted in the previous round with the real tumor mask and finding the region with the greatest difference between the two.

[0037] (3e) Repeat steps (3a) to (3d), saving the model weights every 200 batches until the loss converges, and then save the final model weights.

[0038] Another object of the present invention is to provide an electronic device comprising:

[0039] Processor; and

[0040] The memory stores computer program instructions that, when executed by the processor, cause the processor to perform the ultrasound image segmentation method for breast tumor lesions based on the SAM-VMamba model as described above.

[0041] The present invention also provides a computer-readable storage medium having stored thereon computer program instructions, which, when executed by a processor, cause the processor to perform the ultrasound image segmentation method for breast tumor lesions based on the SAM-VMamba model as described above.

[0042] As can be seen from the above technical solution, the beneficial effects of the present invention are as follows: First, the present invention constructs a SAM-VMamba model, utilizes a first encoder to extract local features, extracts global features through a second encoder, combines interactive prompt information processed by the prompt encoder, and generates an accurate segmentation mask through a mask decoder; Second, the present invention retains the flexibility of SAM interactive segmentation while improving the processing capability and computational efficiency of long sequence data through the Mamba structure, effectively adapting to the characteristics of uneven grayscale and numerous artifacts in ultrasound images, solving the problems of low accuracy and insufficient processing efficiency of traditional methods for breast tumor boundary segmentation, achieving a balance between high precision and high efficiency, and providing strong support for the accurate localization and diagnosis of clinical breast tumors. Attached Figure Description

[0043] Figure 1 This is a flowchart of the method of the present invention;

[0044] Figure 2 This is a schematic diagram of the overall architecture of the SAM-Mamba model. Detailed Implementation

[0045] like Figure 1As shown, a method for segmenting ultrasound images of breast tumor lesions based on the SAM-VMamba model is presented. This method includes the following sequential steps:

[0046] (1) Obtain a breast ultrasound image set and preprocess it to obtain a preprocessed breast ultrasound image set. Divide the preprocessed breast ultrasound image set into a training set and a validation set in a ratio of 8:2.

[0047] (2) Construct the SAM-VMamba model, such as Figure 2 As shown, the SAM-VMamba model includes a first encoder, a second encoder, a cue encoder, and a mask decoder;

[0048] (3) Input the training set into the SAM-VMamba model for training to obtain the trained model;

[0049] (4) Obtain the breast ultrasound image to be segmented and preprocess it to obtain the preprocessed breast ultrasound image to be segmented;

[0050] (5) Input the preprocessed breast ultrasound image to be segmented into the trained model to obtain the segmentation results of breast lesions and tumors.

[0051] Step (1) specifically includes the following steps:

[0052] (1a) Artifact removal: Smooth the image using a 3×3 convolution kernel Gaussian filter;

[0053] (1b) Noise removal: Adaptive threshold segmentation is used to separate the breast parenchyma from the background and remove interfering regions;

[0054] (1c) Normalization: Normalize the pixel values ​​to [0,1] to eliminate the grayscale differences between different ultrasound devices;

[0055] (1d) Size adjustment: The image is uniformly scaled to 512×512 resolution using bilinear interpolation to ensure consistent model input size;

[0056] (1e) Expand: Perform random flipping, rotation and contrast adjustment to expand the data volume.

[0057] In step (2), the first encoder includes an image embedding layer, a multi-layer ViT encoder, and a feature downsampling layer. Each ViT encoder adopts a dual-branch structure of MSA multi-head self-attention and MLP multilayer perceptron. The image embedding layer receives a pre-processed 512×512 resolution breast ultrasound image and outputs features of shape (B, 1025, 768) to the MSA multi-head self-attention of the multi-layer ViT encoder, where B is the batch size. First, the input features are normalized by layer normalization, then the local correlation between image blocks is captured by MSA multi-head self-attention, and then the original features and attention output are fused by residual connection. Then, the input features are normalized by layer again and input into the MLP multilayer perceptron for nonlinear feature transformation. Finally, the processed features are output by residual connection. After the multi-layer ViT encoder is stacked, the feature map is downsampled by a 1×1 convolution kernel and a stride of 2 to reduce the feature dimension and increase the receptive field, preparing for the feature fusion with the second encoder. The first encoder outputs a local feature map.

[0058] In MSA multi-head self-attention, layer normalization LN standardizes the input features (B, 1025, 768) to avoid the influence of feature distribution differences on attention calculation; multi-head self-attention calculation: the feature vector is split into multiple heads, and attention weights are calculated through query, key, and value matrices to focus on the association between adjacent image patches, such as the feature interaction between the tumor region and the surrounding glandular tissue, and the attention-weighted features (B, 1025, 768) are output; residual connections add the attention output to the original features before layer normalization LN processing element by element to retain the initial feature information and avoid gradient vanishing; the Adapter layer specifically includes four key operations: feature format conversion, channel attention calculation, spatial attention calculation, and skip connection fusion.

[0059] In step (2), the second encoder adopts the VMamba architecture, specifically including layer normalization, a first linear layer, depthwise convolution, SiLU activation function, selective scanning 2D module (SS2D module), a second linear layer, and a residual connection module. The layer normalization standardizes the input features, eliminates distribution differences, and provides stable input for subsequent processing. The first linear layer adjusts the dimensions of the normalized features. Depthwise convolution captures local details of features, such as the texture of tumor edges, through grouped convolution. The SiLU activation function enhances the nonlinear expression of features and improves the model's adaptability to ultrasound images with "low contrast and speckle artifacts". The selective scanning 2D module flattens the 2D features into a 1D sequence and models cross-regional feature associations through the SS2D module. The process includes four steps: scan unfolding, selective scanning, scan merging, and feature reshaping, ultimately focusing on the long-distance association between the tumor and distant tissues, such as the global spatial relationship between the tumor and breast structures. After the features output by the selective scanning 2D module are linearly mapped through the second linear layer, the original features are fused through the residual connection module to finally output a global feature map.

[0060] In step (2), the prompt encoder includes a coordinate normalization and encoding layer and a sparse prompt embedding layer; the coordinate normalization layer and the encoding layer receive interactive prompts input by the user, perform coordinate normalization, and align them with the scale of the image features. The interactive prompts include point prompts and bounding box prompts; the sparse prompt embedding layer converts the outputs of the coordinate normalization layer and the encoding layer into low-dimensional sparse feature vectors to filter redundant information.

[0061] The point hints refer to: user-annotated "tumor points" (foreground) or "background points" (non-tumor areas);

[0062] The bounding box prompt indicates the approximate area of ​​the tumor selected by the user.

[0063] The cue encoder converts user-interacted point cues and bounding box cues into semantic vectors compatible with image features. This preserves the spatial location information of the cues and enhances the semantic guidance of the tumor region through fusion, providing key interactive signals for the mask decoder to accurately segment the tumor.

[0064] In step (2), the mask decoder includes a feature fusion and Transformer encoding module, a mask token generation module, an upsampling and mask prediction module, and a candidate mask and IoU prediction module. The feature fusion and Transformer encoding module concatenates and fuses the local feature map output by the first encoder, the global feature map output by the second encoder, and the cue features output by the cue encoder to obtain fused features, thereby enhancing the semantic interaction between image features and cue features. The mask token generation module generates command information to control mask generation based on the fused features, defining the target region logic for segmentation. The upsampling and mask prediction module restores the feature map from low resolution to the resolution of the original ultrasound image, and generates a preliminary segmentation mask in combination with the mask prediction logic. The candidate mask and IoU prediction module generates multiple candidate segmentation masks with different confidence levels, calculates the intersection-union ratio (IoU) between each candidate mask and the real tumor region, selects the mask with the highest IoU as the final output, and filters out small noise areas to ensure the accuracy of the segmentation results. When multi-mask output is enabled, the mask corresponding to the highest IoU quality score is selected as the final result; for single-mask output, a unique predicted mask is directly used. Finally, the results are visualized and output: a binarized mask is overlaid on the original image, along with user-input prompts.

[0065] Step (3) specifically includes the following steps:

[0066] (3a) Set the batch size to 24, the number of iterations to 50, the image input resolution to 256×256, use the Adam optimizer to optimize the model, set the initial learning rate to 1e-4, and decrease the learning rate by gamma=0.5 in the 5th and 10th epochs.

[0067] (3b) After obtaining the output of the model, calculate the loss. The loss function is a hybrid loss function. The formula is as follows:

[0068] ;

[0069] in, , , These are all weighting coefficients, with values ​​of 20, 1, and 1 respectively; It is a focal loss. It is a banded coefficient loss. It is a comparison of losses;

[0070] The output of the model refers to the 512×512 resolution candidate segmentation mask generated by the model through the mask decoder for the input breast ultrasound image. The pixel value of each mask is the probability value in the range [0,1], which represents the confidence that the pixel belongs to the breast tumor region.

[0071] The formula used to solve the class imbalance problem is:

[0072] ;

[0073] In the formula, For the first The real label of each pixel The model predicts the probability that this pixel is a tumor region, where γ is the focusing parameter and N is the number of samples.

[0074] The formula used to optimize boundary segmentation accuracy is:

[0075]

[0076] in, Represents pixels The predicted value;

[0077] The formula used to improve regional matching accuracy is:

[0078]

[0079] (3c) Calculate the gradient based on the hybrid loss function and update the model parameters through backpropagation, wherein the underlying parameters of the first encoder are frozen and only the parameters in the second encoder are trained;

[0080] (3d) A phased prompting interaction strategy is adopted during the training process: in the initial stage, bounding boxes or point prompts are randomly selected for training. In the iterative stage, new point prompts are generated for multiple rounds of interactive learning, with the number of iterations per round set to 4. The new point prompts refer to the correction guide points automatically generated by the model in the iterative training process after comparing the tumor segmentation mask predicted in the previous round with the real tumor mask and finding the region with the greatest difference between the two.

[0081] (3e) Repeat steps (3a) to (3d), saving the model weights every 200 batches until the loss converges, and then save the final model weights.

[0082] In summary, this invention constructs a SAM-VMamba model, utilizes a first encoder to extract local features, a second encoder to extract global features, and combines interactive prompts processed by a prompt encoder with a mask decoder to generate a precise segmentation mask. This invention retains the flexibility of SAM interactive segmentation while improving the processing capability and computational efficiency of long sequence data through the Mamba structure. It effectively adapts to the characteristics of ultrasound images such as uneven grayscale and numerous artifacts, solving the problems of low accuracy and insufficient processing efficiency of traditional methods for breast tumor boundary segmentation. It achieves a balance between high precision and high efficiency, providing strong support for the precise localization and diagnosis of clinical breast tumors.

[0083] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention. The scope of protection claimed by the appended claims and their equivalents is defined.

Claims

1. A method for segmenting ultrasound images of breast tumor lesions based on the SAM-VMamba model, characterized in that: The method includes the following steps in sequence: (1) Obtain a breast ultrasound image set and perform preprocessing to obtain a preprocessed breast ultrasound image set. Divide the preprocessed breast ultrasound image set into a training set and a validation set in a ratio of 8:

2. (2) Construct a SAM-VMamba model, which includes a first encoder, a second encoder, a cue encoder, and a mask decoder; (3) Input the training set into the SAM-VMamba model for training to obtain the trained model; (4) Obtain the breast ultrasound image to be segmented and preprocess it to obtain the preprocessed breast ultrasound image to be segmented; (5) Input the preprocessed breast ultrasound image to be segmented into the trained model to obtain the segmentation results of breast lesions and tumors.

2. The method for segmenting ultrasound images of breast tumor lesions based on the SAM-VMamba model according to claim 1, characterized in that: Step (1) specifically includes the following steps: (1a) Artifact removal: Smooth the image using a 3×3 convolution kernel Gaussian filter; (1b) Noise removal: Adaptive threshold segmentation is used to separate the breast parenchyma from the background and remove interfering regions; (1c) Normalization: Normalize the pixel values ​​to [0,1] to eliminate the grayscale differences between different ultrasound devices; (1d) Size adjustment: The image is uniformly scaled to 512×512 resolution using bilinear interpolation to ensure consistent model input size; (1e) Expand: Perform random flipping, rotation and contrast adjustment to expand the data volume.

3. The method for segmenting ultrasound images of breast tumor lesions based on the SAM-VMamba model according to claim 1, characterized in that: In step (2), the first encoder includes an image embedding layer, a multi-layer ViT encoder, and a feature downsampling layer. Each ViT encoder adopts a dual-branch structure of MSA multi-head self-attention and MLP multilayer perceptron. The image embedding layer receives a pre-processed 512×512 resolution breast ultrasound image and outputs features of shape (B, 1025, 768) to the MSA multi-head self-attention of the multi-layer ViT encoder, where B is the batch size. First, the input features are normalized by layer normalization, then the local correlation between image blocks is captured by MSA multi-head self-attention, and finally the original features and attention output are fused by residual connection. After being normalized again, the input to the MLP multilayer perceptron is subjected to nonlinear feature transformation, and finally the processed features are output through residual connections. After the multilayer ViT encoder is stacked, the feature map is downsampled by a 1×1 convolution kernel with a stride of 2, which reduces the feature dimension and increases the receptive field, preparing for the feature fusion with the second encoder. The first encoder outputs a local feature map.

4. The method for segmenting ultrasound images of breast tumor lesions based on the SAM-VMamba model according to claim 1, characterized in that: In step (2), the second encoder adopts the VMamba architecture, specifically including layer normalization, a first linear layer, depthwise convolution, SiLU activation function, selective scanning 2D module, second linear layer and residual connection module. The layer normalization standardizes the input features, the first linear layer adjusts the dimensions of the normalized features, the depthwise convolution captures the local details of the features through grouped convolution, the SiLU activation function enhances the non-linear expressive ability of the features, the selective scanning 2D module flattens the 2D features into a 1D sequence, and the features output by the selective scanning 2D module are linearly mapped through the second linear layer and then fused through the residual connection module to finally output a global feature map.

5. The method for segmenting ultrasound images of breast tumor lesions based on the SAM-VMamba model according to claim 1, characterized in that: In step (2), the cue encoder includes a coordinate normalization and encoding layer and a sparse cue embedding layer; The coordinate normalization layer and the encoding layer receive interactive prompts from user input, perform coordinate normalization, and align them with the scale of image features. The interactive prompts include point prompts and bounding box prompts. The sparse cue embedding layer converts the outputs of the coordinate normalization layer and the encoding layer into low-dimensional sparse feature vectors, filtering out redundant information.

6. The method for segmenting ultrasound images of breast tumor lesions based on the SAM-VMamba model according to claim 1, characterized in that: In step (2), the mask decoder includes a feature fusion and Transformer encoding module, a mask token generation module, an upsampling and mask prediction module, and a candidate mask and IoU prediction module. The feature fusion and Transformer encoding module concatenates and fuses the local feature map output by the first encoder, the global feature map output by the second encoder, and the cue features output by the cue encoder to obtain the fused features, thereby enhancing the semantic interaction between image features and cue features. The mask token generation module generates command information to control mask generation based on the fused features, defining the logic of the segmented target region. The upsampling and mask prediction module restores the feature map from low resolution to the resolution of the original ultrasound image, and combines it with the mask prediction logic to generate a preliminary segmentation mask. The candidate mask and IoU prediction module generates multiple candidate segmentation masks with different confidence levels, calculates the intersection-union ratio (IoU) between each candidate mask and the real tumor region, selects the mask with the highest IoU as the final output, and filters out small noise areas to ensure the accuracy of the segmentation results.

7. The method for segmenting ultrasound images of breast tumor lesions based on the SAM-VMamba model according to claim 1, characterized in that: Step (3) specifically includes the following steps: (3a) Set the batch size to 24, the number of iterations to 50, the image input resolution to 256×256, use the Adam optimizer to optimize the model, set the initial learning rate to 1e-4, and decrease the learning rate by gamma=0.5 in the 5th and 10th epochs. (3b) After obtaining the output of the model, calculate the loss. The loss function is a hybrid loss function. The formula is as follows: ; in, , , These are all weighting coefficients, with values ​​of 20, 1, and 1 respectively; It is a focal loss. It is a banded coefficient loss. It is a combination of losses; The output of the model refers to the 512×512 resolution candidate segmentation mask generated by the model through the mask decoder for the input breast ultrasound image. The pixel value of each mask is the probability value in the range [0,1], which represents the confidence that the pixel belongs to the breast tumor region. The formula used to solve the class imbalance problem is: ; In the formula, For the first The real label of each pixel The model predicts the probability that this pixel is a tumor region, where γ is the focusing parameter and N is the number of samples. The formula used to optimize boundary segmentation accuracy is: ; in, Represents pixels The predicted value; The formula used to improve regional matching accuracy is: ; (3c) Calculate the gradient based on the hybrid loss function and update the model parameters through backpropagation, wherein the underlying parameters of the first encoder are frozen and only the parameters in the second encoder are trained; (3d) A phased prompting interaction strategy is adopted during the training process: in the initial stage, bounding boxes or point prompts are randomly selected for training. In the iterative stage, new point prompts are generated for multiple rounds of interactive learning, with the number of iterations per round set to 4. The new point prompts refer to the correction guide points automatically generated by the model in the iterative training process after comparing the tumor segmentation mask predicted in the previous round with the real tumor mask and finding the region with the greatest difference between the two. (3e) Repeat steps (3a) to (3d), saving the model weights every 200 batches until the loss converges, and then save the final model weights.

8. An electronic device, comprising: processor; as well as A memory storing computer program instructions, which, when executed by the processor, cause the processor to perform the ultrasound image segmentation method for breast tumor lesions based on the SAM-VMamba model as described in any one of claims 1-7.

9. A computer-readable storage medium having stored thereon computer program instructions, which, when executed by a processor, cause the processor to perform the ultrasound image segmentation method for breast tumor lesions based on the SAM-VMamba model as described in any one of claims 1-7.

Citation Information

Cited By

  • Interactive annotation segmentation method and device for full-slice pathological image

    CN122156650A

  • An interactive annotation and segmentation method and device for whole-section pathological images

    CN122156650B