A medical image segmentation method and system for ultrasound-guided nerve block and applications thereof
By integrating a boundary enhancement adapter and a category comparison adapter into the encoder backbone network, combined with a lightweight decoder and interactive prompts, the challenge of identifying and distinguishing anatomical boundaries in ultrasound-guided nerve block surgery was solved, achieving higher segmentation accuracy and flexibility.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIHANG UNIV
- Filing Date
- 2026-04-13
- Publication Date
- 2026-07-10
AI Technical Summary
Existing medical image segmentation models struggle to accurately extract the boundary features of blurred tissues in ultrasound-guided nerve block surgery, make it difficult to distinguish different anatomical structures with similar texture features, and lack a human-interactive error correction mechanism, resulting in insufficient segmentation accuracy and flexibility.
A pre-trained visual transformer is used as the encoder backbone network, integrating a boundary enhancement adapter and a class contrast adapter. Features are enhanced through gradient-guided attention and class contrast mechanisms, and combined with a lightweight decoder and interactive prompts to generate medical image segmentation masks.
It improves the ability to identify the edges of anatomical structures in ultrasound images, reduces the probability of incorrect segmentation of non-target tissues, enhances the ability of clinical operators to correct complex anatomical structures, and improves the accuracy and flexibility of segmentation.
Smart Images

Figure CN122368083A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical image processing, specifically to a medical image segmentation method, system, and application for ultrasound-guided nerve block. Background Technology
[0002] Ultrasound-guided nerve block surgery requires clinicians to identify the target nerve, fascial plane, and surrounding anatomical structures such as blood vessels or pleura in ultrasound images. Ultrasound images generally suffer from problems such as speckle noise interference, low tissue contrast, and blurred edges of anatomical structures. Existing medical image segmentation models have difficulty accurately extracting the boundary features of blurred tissues when processing ultrasound-guided nerve block image data, resulting in significant positioning deviations in the output medical image segmentation mask at the edges of anatomical structures.
[0003] Meanwhile, the target nerve tissue and the surrounding muscle or fascia tissue will exhibit similar echo texture features in ultrasound-guided nerve block image data. Existing feature extraction networks lack a category comparison mechanism, making it difficult to effectively distinguish different anatomical structures with similar texture features in the feature space. When faced with complex ultrasound backgrounds, they are prone to incorrect segmentation of non-target tissues.
[0004] Furthermore, objective individual variations exist in the local anatomical structures of different patients. Existing fully automated medical image segmentation methods generally lack human-interactive error correction mechanisms. When the medical image segmentation mask output by the network model deviates, clinical operators cannot provide real-time guidance and dynamic correction to the feature extraction and decoding process through input visual or textual prompts, limiting the segmentation accuracy and clinical applicability of medical image segmentation technology in complex clinical surgical environments. Therefore, this invention proposes an ultrasound-guided nerve block medical image segmentation method, system, and its application to address the shortcomings of existing technologies. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides a medical image segmentation method, system, and application for ultrasound-guided nerve block, which solves the problems of existing medical image segmentation models being unable to accurately extract the boundary features of blurred tissues in ultrasound images, being unable to distinguish different anatomical structures with similar texture features in the feature space, and lacking a manual interactive error correction mechanism, which limits the accuracy of medical image segmentation in complex clinical surgical environments.
[0006] To achieve the above objectives, the present invention provides the following technical solution: a medical image segmentation method for ultrasound-guided nerve block, comprising the following steps: Acquire ultrasound-guided nerve block image data, and use a pre-trained visual transformer as the encoder backbone network for multi-level feature extraction, while keeping the parameters of the encoder backbone network frozen. A boundary enhancement adapter is integrated into the Transformer blocks of layers 1 to 3 of the encoder backbone network. The boundary attention weights of multi-level features are calculated through a gradient-guided attention mechanism. The boundary attention weights are used to adaptively modulate and enhance the multi-level features, and the enhanced features are output. A class contrast adapter is integrated into the Transformer blocks of layers 4 to 12 of the encoder backbone network. Based on the preset foreground class prototype and background class prototype, the class probability of the enhanced features is calculated and the class is assigned. Intra-class aggregation mechanism and inter-class separation mechanism are executed to output the contrast-enhanced feature representation. The system acquires interactive prompts and uses a lightweight decoder to fuse the contrast-enhanced feature representation with the interactive prompts through a cross-attention mechanism to generate a medical image segmentation mask for ultrasound-guided nerve block image data.
[0007] Preferably, the steps of calculating boundary attention weights for multi-level features through a gradient-guided attention mechanism, adaptively modulating and enhancing the multi-level features using these boundary attention weights, and outputting the enhanced features include: Calculate the horizontal and vertical gradients of multi-level features, and calculate the gradient magnitude by combining the gradient information of the horizontal and vertical gradients. Gradient magnitude is processed using a two-layer convolutional neural network to generate boundary attention weights. The basic intermediate features obtained by forward propagation of the feature extraction subnetwork are extracted from multi-level features. The basic intermediate features are then subjected to element-wise multiplication using boundary attention weights for adaptive modulation enhancement. The enhanced features are then output through residual connections.
[0008] Preferably, the steps of calculating the class probabilities of the enhanced features based on preset foreground and background class prototypes, assigning classes, executing intra-class clustering and inter-class separation mechanisms, and outputting the contrast-enhanced feature representation include: Calculate the normalized cosine similarity between each feature point in the enhanced features and the foreground category prototype and the background category prototype. Use the normalized exponential function to convert the normalized cosine similarity into category probability and perform category assignment. For feature points assigned as foreground features, calculate the pulling direction vector of the feature points toward the foreground category prototype, calculate the feature update amount based on the pulling direction vector, and accumulate the feature update amount to the corresponding feature points to complete the spatial aggregation update of feature points and obtain intermediate contrast enhancement features. Introducing a prototype separation regularization term makes the angle between the background category prototype and the foreground category prototype close to ninety degrees, thus completing the inter-class separation mechanism; The intermediate contrast-enhanced features are remapped back to the high-dimensional feature space, and the contrast-enhanced feature representation is output through residual connections.
[0009] Preferably, the steps of acquiring interactive prompts and using a lightweight decoder to fuse the contrast-enhanced feature representation with the interactive prompts through a cross-attention mechanism to generate a medical image segmentation mask for ultrasound-guided nerve block image data include: Interactive prompts are generated by feature encoding. The interactive prompts include point prompts consisting of two-dimensional spatial coordinate points generated by clicking on a specified key anatomical location, box prompts consisting of bounding boxes that enclose the region of interest, and text prompts consisting of natural language text describing the features of the target anatomical structure. The contrast-enhanced feature representation is used as the query matrix, and the interactive prompt features are used as the key matrix and value matrix. The correlation weight between the contrast-enhanced feature representation and the interactive prompt features is calculated to generate the prompt enhancement features. The spatial size of the cue enhancement features is progressively enlarged by using convolutional layers in conjunction with bilinear interpolation, and then input into a multi-channel convolutional layer to generate a feature logarithmic matrix. The normalized exponential function is used to perform probability normalization on the feature logarithm matrix to calculate the predicted probability value. The classification category with the highest predicted probability value is selected to output the medical image segmentation mask.
[0010] Preferably, after the step of acquiring ultrasound-guided nerve block image data, the following steps are included: Perform spatial resolution adjustment on ultrasound-guided nerve block image data to unify pixel resolution; Histogram equalization was used to perform image contrast enhancement processing on the ultrasound-guided nerve block image data after resolution adjustment. Perform data normalization on the contrast-enhanced ultrasound-guided nerve block image data; Data augmentation techniques were applied to the normalized ultrasound-guided nerve block image data. These techniques included random rotation, random flipping, random scaling, and random brightness adjustment.
[0011] Preferably, the medical image segmentation masking step for generating ultrasound-guided nerve block image data includes: The anatomical structure categories in the medical image segmentation mask are mapped to color channel values. The color channel values are then weighted and superimposed with the pixel grayscale values of the ultrasound-guided nerve block image data to generate a color visualization annotation image. Based on the medical image segmentation mask and manually labeled real labels, the number of true positive pixels, false positive pixels, and false negative pixels are counted, and segmentation accuracy indicators including Dice coefficient, intersection-over-union ratio, precision, and recall are calculated. An edge detection operator is used to extract the pixel contours of the target region in a medical image segmentation mask to calculate the boundary continuity score. The average gray-level gradient value of the pixel regions within a fixed range on both sides of the target region boundary is extracted as the boundary sharpness score.
[0012] Preferably, after the step of using an edge detection operator to extract the pixel contours of the target region of the medical image segmentation mask, calculating the boundary continuity score, and extracting the average gray-level gradient value of the pixel regions within a fixed range on both sides of the target region boundary as the boundary sharpness score, the following steps are included: Extract lung tissue or blood vessel regions from medical image segmentation masks as high-risk surgical areas, calculate the shortest spatial Euclidean distance from the target nerve or target fascia plane to the high-risk surgical area, and trigger a high-risk area identification prompt when the shortest spatial Euclidean distance is less than the safe distance threshold; The overall score is calculated using a weighted scoring function based on the Dice coefficient, boundary continuity score, and distance parameter to high-risk areas, and the comprehensive quality rating is output. The text generation model uses a clinical logic rule tree to make logical judgments on the overall quality rating. When the overall quality rating is lower than the clinically usable threshold, it outputs scan improvement suggestions, including suggestions to adjust the ultrasound probe angle, adjust the ultrasound equipment gain parameters, and relocate the target blockage area. The ultrasound-guided nerve block surgery quality control assessment report is generated by combining and formatting color-coded visual annotation images, segmentation accuracy indicators, boundary continuity scores, boundary clarity scores, high-risk area identification prompts, comprehensive quality ratings, and scan improvement suggestions.
[0013] Preferably, the medical image segmentation masking step for generating ultrasound-guided nerve block image data includes: The network model consisting of the encoder backbone network, boundary enhancement adapter, class contrast adapter and lightweight decoder is subjected to model quantization processing, and the floating-point weight parameters in the network model are converted into integer values to generate a quantized inference model. Receive interactive prompts from operators based on visual feedback from medical image segmentation masks, prompting them to re-enter the information. By using a quantitative inference model combined with re-input interactive prompts, inference calculations are performed to dynamically update and optimize the medical image segmentation mask.
[0014] Preferably, the present invention also provides a medical image segmentation system for ultrasound-guided nerve block, comprising: The feature encoding module is used to acquire ultrasound-guided nerve block image data. It uses a pre-trained visual transformer as the encoder backbone network to perform multi-level feature extraction, and the parameters of the encoder backbone network are kept frozen. The boundary enhancement module integrates a boundary enhancement adapter in the Transformer blocks of layers 1 to 3 of the encoder backbone network. It is used to calculate the boundary attention weights of multi-level features through a gradient-guided attention mechanism, and to adaptively modulate and enhance the multi-level features using the boundary attention weights, outputting the enhanced features. The semantic discrimination module integrates a class contrast adapter in the Transformer blocks of layers 4 to 12 of the encoder backbone network. It is used to calculate the class probability of the enhanced features based on the preset foreground class prototype and background class prototype, perform class assignment, execute intra-class aggregation mechanism and inter-class separation mechanism, and output the contrast-enhanced feature representation. The decoding and prompting module contains a lightweight decoder for acquiring interactive prompting information. It fuses the contrast-enhanced feature representation with the interactive prompting information through a cross-attention mechanism to generate a medical image segmentation mask for ultrasound-guided nerve block image data.
[0015] Preferably, the present invention also provides an application of the medical image segmentation method for ultrasound-guided nerve block, which is applied to the medical image segmentation method for ultrasound-guided nerve block described in the present invention, including applying the medical image segmentation method to generate a quality control assessment report and surgical risk warning prompts for ultrasound-guided nerve block surgery.
[0016] This invention provides a medical image segmentation method, system, and application for ultrasound-guided nerve block. It offers the following advantages: 1. This invention integrates a boundary enhancement adapter into the Transformer block of the encoder backbone network and uses a gradient-guided attention mechanism to calculate the boundary attention weights of multi-level features to adaptively modulate and enhance the multi-level features. This enables the full extraction of edge gradient information in ultrasound-guided nerve block image data, clarifies the boundary range of anatomical structures such as nerves and blood vessels, and improves the network model's ability to identify blurred tissue edges in ultrasound images and the edge localization accuracy of medical image segmentation masks.
[0017] 2. This invention utilizes a class comparison adapter integrated into the Transformer block of the encoder backbone network. Based on the foreground class prototype and the background class prototype, it performs intra-class aggregation mechanism and inter-class separation mechanism, which can shorten the spatial distance of features of the same class and widen the spatial distance of features of different classes. It can distinguish nerve tissue with similar echo texture from surrounding muscle or fascia tissue in ultrasound-guided nerve block image data, and reduce the probability of incorrect segmentation of non-target tissues in complex ultrasound backgrounds.
[0018] 3. This invention acquires interactive prompt information including point prompts, box prompts, and text prompts, and uses a lightweight decoder to fuse the contrast-enhanced feature representation with the interactive prompt information through a cross-attention mechanism. It introduces artificial prior knowledge to guide the feature decoding calculation process, allowing clinical operators to provide input instructions for correction in case of complex anatomical variations, thereby improving the flexibility and accuracy of the medical image segmentation network in actual ultrasound-guided nerve block surgery environments. Attached Figure Description
[0019] Figure 1 This is a schematic diagram of the system architecture of the present invention; Figure 2 This is a schematic diagram of the overall process of the method of the present invention; Figure 3 This is a schematic diagram of the mask comparison of the present invention; Figure 4 This is a schematic diagram of the grayscale polygonal line representing the segmentation accuracy coefficient of the present invention. Detailed Implementation
[0020] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] Please see Figure 1 This invention provides an ultrasound-guided nerve block medical image segmentation system based on multi-adaptor collaboration, including a data input module, a feature encoding module, a boundary enhancement module, a semantic discrimination module, a decoding and prompting module, a segmentation output module, a quality assessment module, and a report generation module.
[0022] The data input module is used to acquire ultrasound-guided nerve block image data and the corresponding clinical annotation information. The data input module supports the input of ultrasound images from quadratus lumborum block, serratus anterior plane block, and transverse thoracic plane block / fascial plane block techniques.
[0023] The feature encoding module contains a frozen ViT-Base (basic version of the visual transformer) pre-trained backbone network, which is used to extract multi-level features from ultrasound images.
[0024] The boundary enhancement module integrates a boundary enhancement adapter. The boundary enhancement module is deployed in the Transformer blocks of layers 1 to 3 of the feature encoding module. The boundary enhancement module is used to accurately sharpen anatomical boundaries and preserve boundary details.
[0025] The semantic discrimination module integrates a category comparison adapter. Deployed in the Transformer blocks at layers 4 through 12 of the feature encoding module, the semantic discrimination module enhances foreground / background discrimination capabilities and target recognition accuracy.
[0026] The boundary enhancement module and the semantic discrimination module are fused with the original feature stream through residual connections. The two modules work together to achieve accurate segmentation of muscle tissue, lung regions, and bone structures.
[0027] The decoding and prompting module comprises a lightweight decoder and a prompting encoder. This module is used to fuse encoded features with interactive prompts. Interactive prompts include clicking on a specified neural location, drawing a bounding box for the region of interest, and inputting text describing the target structure.
[0028] The segmentation output module generates medical image segmentation masks and segmentation confidence scores; the quality assessment module performs multi-dimensional quality scoring and classification assessments on the segmentation results; and the report generation module integrates the assessment results and generates a structured quality control assessment report.
[0029] See attached document Figure 2 This invention provides a medical image segmentation method for ultrasound-guided nerve block, comprising the following steps: S1. Acquire ultrasound-guided nerve block image data, and extract features using a pre-trained Vision Transformer as the encoder backbone network, with the backbone network parameters kept frozen.
[0030] Specifically, ultrasound images were acquired using techniques including quadratus lumborum block, serratus anterior plane block, and transverse thoracic plane block. The ultrasound images were uniformly adjusted to a resolution of 512×512 pixels. Histogram equalization was used to enhance image contrast, and data normalization was performed to scale pixel values to the 0-1 range. Data augmentation techniques including random rotation, random flipping, random scaling, and random brightness adjustment were applied. A ViT-Base model pre-trained on the ImageNet-1K dataset was used as the encoder backbone. Pre-trained weights were loaded, and all backbone network parameters were frozen, serving only as a feature extractor.
[0031] S2 integrates a boundary enhancement adapter in the Transformer blocks of layers 1 to 3 of the encoder, and achieves precise sharpening of anatomical boundaries in ultrasound images through a gradient-guided attention mechanism.
[0032] Specifically, the spatial gradient of the features is calculated, including the horizontal and vertical gradients. The gradient magnitude is calculated by combining the horizontal and vertical gradient information. A two-layer convolutional neural network is used to process the gradient magnitude and generate boundary attention weights. Adaptive modulation enhancement is applied to the input features, amplifying feature intensity in boundary regions and maintaining the original intensity in smooth regions. Finally, the enhanced features are fused with the original features through residual connections for output.
[0033] S3 integrates a category contrast adapter in the Transformer blocks of layers 4 to 12 of the encoder, enhancing the foreground-background discrimination capability through a prototype-driven contrastive learning mechanism.
[0034] Specifically, learnable foreground and background class prototypes are initialized. The normalized cosine similarity between each feature point in the input features and the foreground and background class prototypes is calculated. The similarity is converted into class probabilities using a softmax function, and the class assignment of the feature points is determined based on the maximum probability. Intra-class clustering is used to bring similar features closer to their corresponding prototypes, while inter-class separation is used to promote the separation of different prototypes. Finally, a contrast-enhanced feature representation is output through residual connections.
[0035] S4 utilizes a lightweight decoder to process encoded features and combines them with interactive prompts to generate accurate segmentation results for muscle tissue, neural pathways, and fascial target areas in ultrasound images.
[0036] Specifically, the decoder employs a lightweight 4-layer Transformer architecture, fusing high-level semantic features from the encoder with interactive prompts through a cross-attention mechanism. Interactive prompts include point prompts for clicking on key anatomical locations, bounding box prompts for drawing regions of interest, and textual prompts describing the input target structure. The decoder's output features are upsampled to restore the original image resolution, and multi-class segmentation masks are generated through convolutional layers. The class probability of each pixel is normalized using the Softmax function. Finally, the evaluation results are integrated to generate a quality control evaluation report containing color-coded annotations of the segmentation results, segmentation accuracy metrics, boundary continuity and clarity scores, high-risk region identification prompts, and scanning improvement suggestions.
[0037] The specific execution process for acquiring ultrasound-guided nerve block image data and corresponding clinical annotation information, and performing image preprocessing on the ultrasound-guided nerve block image data includes the following steps: S201 collects ultrasound-guided nerve block image data from multiple medical institutions via a data input module. The ultrasound-guided nerve block image data covers various fascial plane block techniques, specifically including quadratus lumborum block, serratus anterior block, and transverse thoracic block. Simultaneously, it acquires clinical annotation information corresponding to the ultrasound-guided nerve block image data, annotated by professional anesthesiologists. This clinical annotation information specifically includes locational annotations of muscle tissue, skeletal structures, lung tissue, fascia, and neural pathway anatomical structures within the ultrasound-guided nerve block image data. All acquired ultrasound-guided nerve block image data are divided into a training set, a validation set, and a test set according to a preset ratio of 8:1:1.
[0038] S202 performs a spatial resolution adjustment operation on the ultrasound-guided nerve block image data in the training set, validation set, and test set, uniformly adjusting the resolution of all ultrasound-guided nerve block image data to 512×512 pixels. This unifies the spatial resolution of the ultrasound-guided nerve block image data, aiming to make the size specifications of the ultrasound-guided nerve block image data compatible with the standard input dimension nodes of the pre-trained Vision Transformer backbone network, and avoid scale disorder of the bottom feature map of the backbone network due to inconsistent input sizes.
[0039] S203 employs histogram equalization technology to perform image contrast enhancement processing on ultrasound-guided nerve block image data after resolution adjustment. Ultrasound images often suffer from severe speckle noise and low tissue boundary contrast. Histogram equalization technology flattens the grayscale histogram of the image, non-linearly stretching the pixel values that were originally concentrated in a narrow grayscale range to the entire grayscale range, thereby highlighting the edge differences between muscles, nerves and fascia without adding additional noise.
[0040] S204, Perform data normalization on the contrast-enhanced ultrasound-guided nerve block image data, linearly scaling the pixel values of each pixel in the ultrasound-guided nerve block image data to a value range of 0 to 1. Specifically, use the extreme value normalization method, assuming the original pixel value of a certain pixel in the ultrasound-guided nerve block image data is... Then the normalized pixel value The calculation formula is: ; in, This represents the minimum pixel value globally in the image. This represents the maximum pixel value globally for this image.
[0041] Calculated This means scaling the feature values to the [0,1] range. Forcing a range limit on pixel values can avoid gradient explosion during model training and improve the numerical stability of the feature extraction stage.
[0042] S205. During the model training phase, data augmentation techniques are applied to the normalized ultrasound-guided nerve block image data. These techniques include random rotation, random flipping, random scaling, and random brightness adjustment of the ultrasound-guided nerve block image data. To ensure the topological consistency of the anatomical structures in the ultrasound images, the parameter range for data augmentation is determined based on the conventional scanning angle of the ultrasound probe and the tissue proportions. For example, the random rotation angle... The value range can be set to [-15°, 15°], and the random scaling coefficient can be set to [0.8, 1.2]. During the iterative process of model training, data augmentation technology is applied to increase the diversity distribution of ultrasound-guided nerve block image data features, thereby improving the robustness of the encoder backbone network and various adapter modules in dealing with differences in ultrasound scanning equipment and different patient anatomical structures. The preprocessed ultrasound-guided nerve block image data is then used as a standard input data stream and passed to the feature encoding module to perform subsequent multi-level feature extraction steps.
[0043] See attached document Figure 2 The feature encoding module receives and processes ultrasound-guided nerve block image data based on a pre-trained backbone network. The specific execution process of obtaining multi-level features of ultrasound-guided nerve block image data includes the following steps: S301, acquire the ultrasound-guided nerve block image data output from the preprocessing stage, and input the ultrasound-guided nerve block image data into the feature encoding module. The feature encoding module is configured with a pre-trained visual Transformer network as the encoder backbone network. The encoder backbone network adopts the ViT-Base model architecture. Since the encoder backbone network processes feature data in a serialized manner, the feature encoding module has a high resolution. Multiply by width The ultrasound-guided nerve block image data (specifically 512×512 pixels) is processed by image block segmentation.
[0044] Specifically, the feature encoding module divides the ultrasound-guided nerve block image data into multiple non-overlapping image blocks, setting the resolution of each image block to be [resolution value missing]. pixels, of which The threshold for the side length of the image patch (set in this embodiment) ), total number of image patches The calculation formula is as follows: ; in, Indicates the height of ultrasound-guided nerve block image data; This indicates the width of the ultrasound-guided nerve block image data.
[0045] The feature encoding module will generate Each image block is flattened and mapped into a one-dimensional image block sequence through a linear projection operation. At the same time, a position code is added to each image block sequence to preserve the spatial position information of the ultrasound-guided nerve block image data. For the specific operation rules of image block processing and position code embedding, those skilled in the art can directly implement them using standard linear projection algorithms and position code functions. Image block processing and position code embedding are well-known technologies in this field and will not be described in detail here.
[0046] S302, construct and initialize the internal topology of the encoder backbone network. The encoder backbone network configured by the feature encoding module contains 12 Transformer blocks. Each Transformer block in the encoder backbone network is configured with a multi-head self-attention mechanism module and a feedforward neural network module. The multi-head self-attention mechanism module is configured with 12 independent attention heads for parallel calculation of the feature correlation between nodes at various positions in the image patch sequence. After the image patch sequence is input into the encoder backbone network, it undergoes mapping and feature interaction between the multi-head self-attention mechanism module and the feedforward neural network module. The feature dimension of the output feature is fixed at 768 dimensions. Before starting the model training process, the feature encoding module performs model initialization operations, loads the weight matrix parameters pre-trained on the large-scale general image dataset ImageNet-1K, and assigns the weight matrix parameters to all internal nodes of the encoder backbone network, enabling the encoder backbone network to obtain basic visual edge and texture perception capabilities.
[0047] S303, during model training, the feature encoding module executes a parameter freeze fine-tuning strategy on the encoder backbone network. The specific technical implementation of the parameter freeze fine-tuning strategy is as follows: the gradient calculation flags of the multi-head self-attention mechanism module parameters, feedforward neural network module parameters, and layer normalization parameters in the 12 Transformer blocks contained in the encoder backbone network are turned off. During the backpropagation update phase, the optimizer does not calculate or update any weight values in the encoder backbone network. All parameters of the encoder backbone network always remain completely consistent with the parameters of the initially loaded pre-trained weight matrix.
[0048] In S304, under the parameter-frozen state, the encoder backbone network only serves as a fixed feature extraction network to process the ultrasound-guided nerve block image data stream, mapping the ultrasound-guided nerve block image data into 768-dimensional multi-level features, and feeding the multi-level features to the subsequent boundary enhancement module and semantic discrimination module. By freezing the encoder backbone network containing a large number of parameters, it is possible to prevent the ViT-Base model from overfitting the training set noise when facing a small sample ultrasound-guided nerve block image dataset. By keeping the pre-trained weight matrix parameters unchanged, it directly blocks the catastrophic forgetting phenomenon caused by the full parameter update, and retains the feature representation learned by the model in the general image dataset. Thus, under the condition of data scarcity, it ensures the numerical stability and generalization ability of the ultrasound-guided nerve block image data feature extraction process.
[0049] See attached document Figure 2 The feature encoding module outputs multi-level features containing feature representations at different depths. The boundary enhancement module integrates a boundary enhancement adapter and is deployed in the Transformer blocks of layers 1 to 3 of the feature encoding module. Deploying the boundary enhancement module in the shallow network region of the feature encoding module is based on the principle that the shallow layers of deep neural networks are more sensitive to low-level spatial details such as edges and textures. Deploying the boundary enhancement module at this level can capture easily blurred anatomical boundary information in ultrasound images. The boundary enhancement module uses a gradient-guided attention mechanism to sharpen and enhance key anatomical boundaries in ultrasound images. The specific workflow of the boundary enhancement module includes the following steps: S401, the boundary enhancement module receives the input features output from the Transformer blocks of layers 1 to 3 of the feature encoding module, removes position encoding from the input features, and reconstructs them from a one-dimensional sequence into a two-dimensional spatial feature map, defining the input features as... The boundary enhancement module targets input features The spatial gradient is calculated. In image processing principles, the spatial gradient reflects the degree of gray-level abrupt change between adjacent pixels or features. Regions with large gray-level abrupt changes typically correspond to the physical boundaries of different tissue structures (such as muscle, fascia, or nerve tissue) in ultrasound images. The boundary enhancement module calculates the input features separately. The horizontal and vertical gradients are calculated as follows: The horizontal gradient is calculated by obtaining the absolute difference of features between the current node and its horizontally adjacent node, and the vertical gradient is calculated by obtaining the absolute difference of features between the current node and its vertically adjacent node. ; ; in, Represents the gradient in the horizontal direction; Represents the gradient in the vertical direction; Represents the input features in spatial coordinates Eigenvalues at; Indicates adjacent feature values in the horizontal direction; This represents adjacent feature values in the vertical direction. and These represent the horizontal and vertical indices in the spatial feature matrix, respectively, and their range is limited by the effective spatial resolution of the current input feature matrix.
[0050] S402, the boundary enhancement module integrates the gradient information of the horizontal and vertical directions to calculate the gradient magnitude. The gradient magnitude represents the overall edge strength at the corresponding spatial location. The formula for calculating the gradient magnitude is as follows: ; in, Indicates the gradient magnitude; These are constant parameters used to maintain numerical stability.
[0051] In computer floating-point arithmetic, constant parameters This prevents gradient calculation errors caused by zero values inside the square root when the gradient is completely zero in smooth regions. (Constant parameter) Set to 1×10 -8 .
[0052] S403, the boundary enhancement module uses a two-layer convolutional neural network to adjust the gradient magnitude. Feature processing is performed to generate boundary attention weights. The two-layer convolutional neural network design constitutes a bottleneck structure. The design principle of the bottleneck structure is to force the feature representation of the high-dimensional gradient to pass through a low-dimensional information channel. This information compression process can filter out redundant information such as speckle noise that is widely present in ultrasound images, prompting the network to retain and strengthen only the structural boundary features. The formula for calculating the boundary attention weights is as follows: ; in, Indicates the generated boundary attention weights; This indicates the first convolutional operation, which performs dimensionality compression, reducing the feature dimension from 768 to 96 (i.e., a feature compression ratio of 1 / 8, to form a feature bottleneck). This indicates the second convolution operation, which performs dimensionality expansion, restoring the feature dimension from 96 dimensions to 768 dimensions to match the base feature dimension of subsequent multiplication operations. Represents a non-linear activation function; This represents the sigmoid activation function, which maps and restricts the values of the generated boundary attention weights to the range of 0 to 1.
[0053] S404, the boundary enhancement module uses boundary attention weights to adaptively modulate and enhance the input features. The boundary enhancement module extracts the input features and obtains the basic intermediate features through forward propagation of the feature extraction subnetwork within the module. Using boundary attention weights for basic intermediate features After performing element-wise multiplication, the formula for calculating adaptive modulation enhancement is as follows: ; in, Indicates the enhanced features; This represents the basic intermediate features output after the input features have been processed by the feature extraction sub-network within the module. This represents element-wise multiplication, with boundary attention weights applied in the boundary regions of ultrasound images. The value is close to 1, so the enhanced feature intensity will be amplified to about 2 times; in smooth regions of ultrasound images, the boundary attention weight... The value is close to 0, and the enhanced features retain the original intensity. This adaptive modulation mechanism enables the individual highlighting of the boundary information of the anatomical structure without changing the overall feature semantics.
[0054] S405, the boundary enhancement module fuses the enhanced features with the original input features through a residual connection structure and outputs the fusion result. The formula for the residual connection structure is as follows: ; in, This represents the feature matrix that is the final output of the boundary enhancement module; The representation layer normalization operation is used to stabilize the distribution of feature data and alleviate the gradient vanishing problem in deep layers of the network. The term refers to the enhanced features before layer normalization. The boundary enhancement module flattens the output feature matrix back into a one-dimensional sequence and passes it to the subsequent Transformer block of the feature encoding module for deeper semantic extraction.
[0055] See attached document Figure 2The multi-level features output by the feature encoding module continuously extract high-level global semantic information as the network depth increases. The semantic discrimination module integrates a category contrast adapter and is deployed in the Transformer blocks of layers 4 to 12 of the feature encoding module. Deep network regions have the ability to process abstract features of complex anatomical structures. Deploying the semantic discrimination module at this level primarily enhances the semantic discrimination capability between the foreground (i.e., the target area in the ultrasound image) and the background. The semantic discrimination module uses a prototype-driven contrastive learning mechanism to solve the category confusion problem caused by similar grayscale distributions of different anatomical structures in ultrasound images. The specific workflow of the semantic discrimination module includes the following steps: S501, the semantic discrimination module receives the input features output from the deep network of the feature encoding module, and reduces the dimensionality of the 768-dimensional input features to 384-dimensional using an internally configured downsampling linear mapping matrix. The semantic discrimination module initializes two learnable category prototype parameters, specifically including the foreground category prototype. and background category prototype Foreground category prototype and background category prototype The feature dimensions are all set to 384, that is... , The principle of reducing the original features to 384 dimensions is to create an information bottleneck in the computational dimension, forcing the network to discard high-frequency image speckle noise that is irrelevant to class distinction, while reducing the memory consumption of subsequent full feature map cosine similarity calculation.
[0056] S502, The semantic discrimination module calculates the relationship between each feature point in the input features and the foreground category prototype. and background category prototype The normalized cosine similarity is calculated for each feature point in the input features. Calculate feature points With background category prototype Normalized cosine similarity and calculating feature points With Foreground Category Prototype Normalized cosine similarity The specific calculation formula is as follows: ; ; in, Represents the first of the input features One feature point; Represents the prototype of the background category; Represents the foreground category prototype; The L2 norm of a vector is used to normalize the vector by normalizing it, since there is a lot of speckle noise in ultrasound images. This can eliminate the interference of the absolute amplitude of the features, allowing the network model to focus only on the semantic direction of the features. Indicates temperature parameter, This is used to control the smoothness of the similarity distribution. By reducing the value of the temperature parameter, the differences between different similarities can be amplified. In this embodiment, the temperature parameter... The value is fixed at 0.03.
[0057] S503, the semantic discrimination module uses the Softmax function to convert normalized cosine similarity into class probability. Class probability indicates the probability that each feature point belongs to the foreground or background. The formula for calculating class probability is as follows: ; in, Indicates the first The feature point belongs to the th feature point The probability values of each category prototype, where ; This represents an exponential function with the natural constant as its base. The semantic discrimination module determines the category assignment for each feature point based on the calculated maximum probability.
[0058] S504, the semantic discrimination module executes an intra-class clustering mechanism. This mechanism causes features of the same class to converge towards their corresponding prototypes. In ultrasound images, the same muscle tissue may exhibit uneven echoes due to the angle of the ultrasound beam. The intra-class clustering mechanism allows these uneven features to form compact clusters in the vector space. Features assigned to foreground features (i.e., belonging to the foreground category prototype)... ) feature points The semantic discrimination module calculates the pulling direction vector. : ; Pull direction vector This reflects the movement path of the feature point toward the target prototype on a unit sphere, based on the pulling direction vector. The semantic discrimination module calculates the feature update amount. : ; in, Indicates the tensile strength parameter. This determines the physical step size at which features converge to the prototype, in order to avoid the feature representation from collapsing due to excessively large single update increments. The specific value is set to 0.1. The semantic discrimination module will update the calculated feature values. Accumulated to the original feature points Above, the spatial clustering update of the feature point is completed, i.e., intermediate contrast enhancement feature. .
[0059] In S505, the semantic discrimination module implements an inter-class separation mechanism by introducing a prototype separation regularization term. This mechanism promotes the separation of different prototypes and avoids overlap between different background features such as muscle tissue and fascia structures. The semantic discrimination module incorporates a prototype separation regularization term into the overall system loss function. Prototype separation regularization term The calculation formula is as follows: ; Prototype Separation Regularization Term Make the background category prototype and foreground category prototype The angle between the two prototypes is close to 90°. In vector space, a 90° angle represents that the two prototypes are orthogonal, meaning that the foreground feature distribution and the background feature distribution are uncorrelated, thus maximizing the discriminative boundary between them. During the model training phase, the prototype separation regularization term... It participates in backpropagation calculations, enhancing the model's ability to distinguish between classes.
[0060] S506, the semantic discrimination module remaps the intermediate contrast-enhanced features processed by the intra-class aggregation mechanism back to the high-dimensional feature space, and outputs the final contrast-enhanced feature representation through residual connections. The final output formula of the class contrast adapter is as follows: ; in, This represents the feature matrix that is the final output of the semantic discrimination module; This represents the input features received by the semantic discrimination module; It refers to the intermediate contrast enhancement features output after processing by intra-class aggregation and inter-class separation mechanisms; Indicates the fusion weight, fusion weight The value is fixed at 1.0; This represents the linear mapping weight matrix used for dimensional expansion. The feature dimension was restored from 384 to 768 to ensure that the feature dimension matches the input feature dimension. The features are completely identical, thus successfully completing the residual addition operation. The semantic discrimination module then passes the output feature matrix to the subsequent decoding and prompting module to perform the final mask generation step.
[0061] See attached document Figure 2After the feature encoding module completes multi-level feature extraction of ultrasound-guided nerve block image data, the decoding and prompting module is responsible for fusing interactive prompting information and generating the final segmentation mask. The decoding and prompting module mainly integrates a lightweight decoder and a prompting encoder. The specific workflow of the decoding and prompting module includes the following steps: S601, the decoding and prompting module receives the high-level semantic features output by the feature encoding module and the boundary enhancement module and semantic discrimination module deployed inside the feature encoding module after joint processing. The high-level semantic features include global anatomical structure information of ultrasound-guided nerve block image data and enhanced foreground and background discrimination features.
[0062] S602, the decoding and prompting module acquires the interactive prompts provided by the doctor during the ultrasound scan planning stage. The interactive prompts support three specific interaction methods: point prompts, box prompts, and text prompts. In complex ultrasound images, it is sometimes difficult to accurately distinguish adjacent tissues with similar echoes by relying solely on the image features themselves. Introducing the doctor's interactive prompts can provide strong prior knowledge and guide the model to focus on specific nerve or fascial planes. The specific form of point prompts is that the doctor clicks on a specified key anatomical location to generate a two-dimensional spatial coordinate point. The specific form of box prompts is that the doctor draws a bounding box surrounding the region of interest. The bounding box is defined by the two-dimensional coordinate values of the upper left and lower right corners.
[0063] The specific form of the text prompt is that the doctor inputs natural language text to describe the anatomical features of the target. The prompt encoder encodes the interactive prompt information by mapping the two-dimensional spatial coordinates and bounding box coordinates into positional encoding vectors and the natural language text into text feature vectors, thereby generating interactive prompt features of a unified dimension.
[0064] The S603's decoding and prompting module is equipped with a lightweight decoder. This lightweight decoder is built using a 4-layer Transformer architecture. It receives high-level semantic features and interactive prompting features, and fuses them through an integrated cross-attention mechanism. The principle of this mechanism is to use the interactive prompting features as a guiding signal to calculate relevance within the global high-level semantic features, thereby assigning higher feature response weights to the anatomical region indicated by the prompting information and suppressing irrelevant background features. The cross-attention mechanism uses the high-level semantic features as a query matrix and the interactive prompting features as key and value matrices, calculating the relevance weights between them. This achieves the guidance and modulation of high-level semantic features by the interactive prompting features. The calculation formula for the cross-attention mechanism is as follows: ; in, This represents the cue enhancement features output after fusion via the cross-attention mechanism; This represents the query matrix generated by linear mapping operations on high-level semantic features, representing the feature query requirements at various spatial locations in the image; The key matrix represents the index matching features of the prompt information, generated by linear mapping operations on the interactive prompt features. This represents the value matrix generated by linear mapping operations on the interactive prompt features, which represents the prompt content in the image features to be injected. The transpose of the key matrix; The value representing the feature dimension of the key matrix is used to scale the inner product calculation result to prevent gradient vanishing. This represents the normalized exponential function, used to transform the inner product of correlations into an attention weight distribution that sums to 1.
[0065] S604, the decoding and prompting module processes the prompt enhancement features through upsampling. Since the prompt enhancement features processed by the Transformer architecture have low resolution in the spatial dimension, the decoding and prompting module first reshapes the prompt enhancement features into a two-dimensional spatial feature map. Then, it uses convolutional layers in conjunction with bilinear interpolation to progressively enlarge the spatial size of the prompt enhancement features, restoring the feature resolution of the prompt enhancement features to 512×512 pixels, consistent with the original input ultrasound-guided nerve block image data.
[0066] S605, the decoding and prompting module inputs the feature matrix that restores the original resolution into the multi-channel convolutional layer to generate a multi-class segmentation mask. The number of output channels of the multi-channel convolutional layer is fixed at 2 channels, which correspond to the background and foreground (muscle tissue, bone structure, lung tissue) respectively. The multi-channel convolutional layer outputs an unnormalized feature logarithmic matrix.
[0067] S606, the decoding and prompting module uses a normalized exponential function to perform probability normalization processing along the channel dimension on the feature logarithm matrix output by the multi-channel convolutional layer, calculating the probability value of each pixel position belonging to the classification category. The calculation formula for probability normalization is as follows: ; in, Indicates spatial coordinate index as The pixels belong to the category The predicted probability value; The spatial coordinate index of the output of the multi-channel convolutional layer is: And the channel index is a category The characteristic logarithmic value; Indicates the total number of categories; This represents the traversal index of the category channel. The decoding and prompting module ultimately selects the category with the highest predicted probability value as the final classification result for each pixel, and outputs a medical image segmentation mask for the ultrasound-guided nerve block image data.
[0068] See attached document Figure 2 After the decoding and prompting module outputs the medical image segmentation mask of the ultrasound-guided nerve block image data, the quality assessment module and the report generation module evaluate the medical image segmentation mask and generate a quality control assessment report for the ultrasound-guided nerve block surgery. The specific workflow of the quality assessment module and the report generation module includes the following steps: S701, the quality assessment module acquires the original ultrasound image and the medical image segmentation mask. The quality assessment module maps different anatomical structure categories in the medical image segmentation mask to different RGB color channel values. It assigns independent color labels to muscle tissue, nerves, skeletal structures, fascia planes, and lung tissue. The quality assessment module then weights and fuses the color channel values with the pixel grayscale values of the original ultrasound image to generate a color-annotated image of the segmentation result. This color-annotated image allows for color differentiation of different anatomical structures within the same view.
[0069] S702, the quality assessment module calculates segmentation accuracy metrics for various anatomical structures based on the medical image segmentation mask and manually labeled ground truth labels. These accuracy metrics include the Dice coefficient, intersection-over-union ratio (IoU), precision, and recall. The quality assessment module also calculates the number of true positive pixels, false positive pixels, and false negative pixels between the medical image segmentation mask and the ground truth labels. The specific formulas for calculating these quantitative assessment metrics are as follows: ; ; ; ; in, This represents the Dice coefficient, which measures the degree of overlap between the predicted and actual regions. Indicates intersection, union, and ratio; Indicates accuracy; Indicates recall rate; This indicates the number of true positive pixels, representing the total number of target pixels whose predicted classification matches the true classification. This indicates the number of false positive pixels, representing the total number of pixels that incorrectly predicted the background as the target anatomical structure. This indicates the number of false negative pixels, representing the total number of pixels that incorrectly predicted the target's anatomical structure as background.
[0070] S703, the quality assessment module calculates the boundary continuity score and boundary sharpness score of each target anatomical structure in the medical image segmentation mask. For the specific calculation of boundary continuity, the quality assessment module uses edge detection operators such as the Canny algorithm to extract the pixel contour of the target region, calculates the ratio of the number of pixels in the largest continuous connected region in the pixel contour to the total number of contour pixels, and directly maps the calculated ratio value to the boundary continuity score. For the specific calculation of boundary sharpness, the quality assessment module extracts the pixel region within a fixed range on both sides of the boundary of the target region, calculates the average gray-level gradient value of the pixel region on both sides, and uses the average gray-level gradient value as the boundary sharpness score.
[0071] S704, the quality assessment module performs high-risk area identification prompts and comprehensive quality rating. The quality assessment module extracts lung tissue regions or specific blood vessel regions from the medical image segmentation mask as high-risk surgical areas. The quality assessment module calculates the shortest spatial Euclidean distance from the target nerve or target fascia plane to the high-risk area. If the shortest spatial Euclidean distance is less than the preset safe distance threshold, the quality assessment module triggers a high-risk area identification prompt and marks the high-risk area in the color visualization annotation image. The safe distance threshold is set according to the safe physical range of clinical nerve block anesthetic diffusion. In actual processing, it is based on the physical resolution of the ultrasound probe and mapped to the image pixel distance. The corresponding physical value range is set to 0.5cm to 1.0cm. The quality assessment module calculates the overall score based on the calculated Dice coefficient, boundary continuity score, and high-risk area distance parameters through a preset weighted scoring function.
[0072] The weights of each item in the weighted scoring function are allocated according to the clinical attention to each indicator. In this embodiment, the weight of the Dice coefficient is set to 0.4, the weight of the boundary continuity score is set to 0.3, and the weight of the high-risk area distance parameter is set to 0.3. The quality assessment module outputs a comprehensive quality rating including excellent, good, and poor levels based on the overall score.
[0073] S705, the report generation module receives all the analysis results output by the quality assessment module and generates a structured ultrasound-guided nerve block surgery quality control assessment report. The report generation module is equipped with a text generation model. The text generation model performs logical judgment on the comprehensive quality rating result according to the preset clinical logic rule tree. When the comprehensive quality rating result is lower than the set clinical usability threshold, the text generation model outputs scanning improvement suggestions for low-quality images. The clinical usability threshold is an empirical value determined by comparing the comprehensive quality rating score distribution of a large number of historical clinical usable images and unusable images. In this embodiment, it is set to 75 points on a percentage scale.
[0074] The specific textual representation of the scan improvement suggestions includes recommendations for adjusting the ultrasound probe angle, adjusting the ultrasound equipment gain parameters, and relocating the target block area. The report generation module combines color-coded visual annotation images, segmentation accuracy indicators, boundary continuity and clarity scores, high-risk area identification prompts, comprehensive quality ratings, and scan improvement suggestions to output an ultrasound-guided nerve block surgery quality control assessment report. This report provides doctors with structured clinical decision support information.
[0075] To verify the effectiveness and advancement of the dual-adaptor collaborative ultrasound neural segmentation framework proposed in this invention in actual complex clinical medical engineering, this embodiment takes the image segmentation of a typical ultrasound-guided transverse thoracic plane block (TTP) surgery as an example, and describes in detail the specific implementation process and beneficial effects of this invention in conjunction with the accompanying drawings.
[0076] Qualitative examination of the boundary localization of complex anatomical structures (combined with) Figure 3 ): In this embodiment, to visually demonstrate the network's ability to understand ultrasound speckle noise and tissue morphology, the predicted masks output by each algorithm were visually compared with the actual labels annotated by clinical experts, such as... Figure 3 As shown: Basic network prediction stage: When faced with high-noise ultrasound images, traditional baseline methods (such as TransUNet) show obvious breaks and misclassifications at the boundaries of muscle tissue; especially under the interference of high-echo areas, some contrast methods seriously lose their semantic anti-confusion ability and produce discrete misclassified color blocks (for example, misclassifying some muscle tissue as high-risk lung areas).
[0077] In the localization phase of this invention: through the intervention of the dual-adaptor cooperation mechanism of this invention, the boundary enhancement adapter (EEA) and the class contrast adapter (CCA) correct the feature extraction bias of the network, as shown in the appendix. Figure 3 As shown, the mask shape output by this invention best matches the real label, and the main muscle layer outline is smooth, continuous, and without breaks.
[0078] High-risk obfuscation prevention effect: In high-risk areas such as the lungs, the segmentation mask of this invention is clean and free of cluttered pixel overflow, achieving smooth tissue transition and localization, proving that the features obtained by this algorithm have high robustness and realism in describing complex physical anatomical structures.
[0079] Quantitative comparison test of segmentation accuracy and performance of multiple algorithms (combined) Figure 4 ): To objectively evaluate the overall performance and accuracy limit of the algorithm of this invention, this embodiment sets up five existing cutting-edge algorithms (including traditional networks and large medical models) for horizontal comparison experiments, namely: UNet (standard U-shaped convolutional neural network), CENet (context encoder network), TransUNet (U-shaped architecture fused with Transformer), UNext (lightweight network based on multilayer perceptron), and SAMUS (large medical ultrasound model based on SAM architecture).
[0080] The distribution of segmentation accuracy coefficients (Dice coefficients) for various anatomical structures (muscle tissue, lung tissue, bone structure) is as follows: Figure 4 As shown: Traditional lightweight convolutional networks (UNet, CENet, UNext) generally have low segmentation accuracy in the core target region (muscle tissue), ranging from 74.79 to 82.66. This indicates that traditional local receptive fields cannot effectively cope with the blurring and noise superposition of muscle texture in ultrasound images, resulting in low clinical reliability.
[0081] Composite architecture and large ultrasound models (TransUNet, SAMUS): TransUNet slightly improved muscle accuracy to 83.67, while SAMUS, as a large medical segmentation model with a large number of parameters, showed an advantage in fitting simple features in lung tissue (98.84) and bone structure (98.53) with high boundary contrast. However, due to the lack of targeted feature contrast fine-tuning, its accuracy in complex muscle tissue (87.21) was insufficient, and the huge computing power made the computational energy efficiency relatively low.
[0082] This invention: as shown in the appendix Figure 4 As shown in the rightmost dashed box area, the overall performance of this invention demonstrates high specificity and breakthrough, especially in the most critical and difficult-to-distinguish muscle tissue in clinical blockade, where the accuracy coefficient of this invention reaches 88.13, breaking through the constraints of the large general model (SAMUS). At the same time, in the secondary areas of lung tissue (96.19) and bone structure (90.09), which serve as risk avoidance references, this invention maintains a safe range of over 90, which proves that the accuracy performance of this invention during the calibration period is consistent with that during the validation period, even with efficient parameter fine-tuning (reducing computational power consumption).
Claims
1. A medical image segmentation method for ultrasound-guided nerve block, characterized in that, Includes the following steps: Acquire ultrasound-guided nerve block image data, and perform multi-level feature extraction using a pre-trained visual transformer as the encoder backbone network, while keeping the parameters of the encoder backbone network frozen. A boundary enhancement adapter is integrated into the Transformer blocks of layers 1 to 3 of the encoder backbone network. The boundary attention weights of the multi-level features are calculated through a gradient-guided attention mechanism. The boundary attention weights are used to adaptively modulate and enhance the multi-level features, and the enhanced features are output. A class contrast adapter is integrated into the Transformer blocks of layers 4 to 12 of the encoder backbone network. Based on the preset foreground class prototype and background class prototype, the class probability of the enhanced features is calculated and the class is assigned. Intra-class aggregation mechanism and inter-class separation mechanism are executed to output the contrast-enhanced feature representation. The interactive prompt information is obtained, and the contrast-enhanced feature representation is fused with the interactive prompt information using a lightweight decoder through a cross-attention mechanism to generate a medical image segmentation mask for the ultrasound-guided nerve block image data.
2. The medical image segmentation method for ultrasound-guided nerve block according to claim 1, characterized in that, The step of calculating the boundary attention weights of the multi-level features through a gradient-guided attention mechanism, and then using these boundary attention weights to adaptively modulate and enhance the multi-level features, specifically includes the following: Calculate the horizontal and vertical gradients of the multi-level features, and calculate the gradient magnitude by combining the gradient information of the horizontal and vertical gradients; The gradient magnitude is processed using a two-layer convolutional neural network to generate the boundary attention weights. The basic intermediate features obtained by forward propagation of the multi-level features are extracted and processed by the feature extraction sub-network. The basic intermediate features are then subjected to element-wise multiplication using the boundary attention weights to perform adaptive modulation enhancement. The enhanced features are then output through residual connections.
3. The medical image segmentation method for ultrasound-guided nerve block according to claim 1, characterized in that, The process of calculating the class probabilities of the enhanced features based on preset foreground and background class prototypes, assigning classes, executing intra-class aggregation and inter-class separation mechanisms, and outputting the contrast-enhanced feature representation specifically includes: Calculate the normalized cosine similarity between each feature point in the enhanced features and the foreground category prototype and the background category prototype, and use the normalized exponential function to convert the normalized cosine similarity into the category probability and perform the category assignment; For feature points assigned as foreground features, calculate the pulling direction vector of the feature points toward the foreground category prototype, calculate the feature update amount based on the pulling direction vector, and accumulate the feature update amount to the corresponding feature points to complete the spatial aggregation update of feature points and obtain intermediate contrast enhancement features; A prototype separation regularization term is introduced to make the angle between the background category prototype and the foreground category prototype close to ninety degrees, thus completing the inter-class separation mechanism. The intermediate contrast-enhanced features are remapped back to the high-dimensional feature space, and the contrast-enhanced feature representation is output through residual connections.
4. The medical image segmentation method for ultrasound-guided nerve block according to claim 1, characterized in that, The step of acquiring interactive prompt information and using a lightweight decoder to fuse the contrast-enhanced feature representation with the interactive prompt information through a cross-attention mechanism to generate a medical image segmentation mask for the ultrasound-guided nerve block image data specifically includes: The interactive prompt information is respectively encoded to generate interactive prompt features. The interactive prompt information includes point prompts consisting of two-dimensional spatial coordinate points generated by clicking on a specified key anatomical location, box prompts consisting of bounding boxes drawn to surround the region of interest, and text prompts consisting of natural language text describing the features of the target anatomical structure. The enhanced feature representation is used as a query matrix, and the interactive prompt features are used as a key matrix and a value matrix. The correlation weight between the enhanced feature representation and the interactive prompt features is calculated to generate the prompt enhancement features. The spatial size of the cue enhancement features is progressively enlarged using convolutional layers and bilinear interpolation, and then input into a multi-channel convolutional layer to generate a feature logarithmic matrix. The predicted probability values are calculated by performing probability normalization processing on the feature logarithm matrix using the normalization exponential function, and the classification category with the highest predicted probability value is selected as the medical image segmentation mask.
5. The medical image segmentation method for ultrasound-guided nerve block according to claim 1, characterized in that, Following the step of acquiring ultrasound-guided nerve block image data, the method further includes: Perform spatial resolution adjustment on the ultrasound-guided nerve block image data to unify pixel resolution; Histogram equalization was used to perform image contrast enhancement processing on the ultrasound-guided nerve block image data after resolution adjustment. Perform data normalization on the contrast-enhanced ultrasound-guided nerve block image data; Data augmentation techniques are applied to the normalized ultrasound-guided nerve block image data. These techniques include random rotation, random flipping, random scaling, and random brightness adjustment.
6. The medical image segmentation method for ultrasound-guided nerve block according to claim 1, characterized in that, The step of generating the medical image segmentation mask for the ultrasound-guided nerve block image data includes: The anatomical structure categories in the medical image segmentation mask are mapped to color channel values, and the color channel values are weighted, superimposed, and fused with the pixel gray values of the ultrasound-guided nerve block image data to generate a color visualization annotation image. Based on the medical image segmentation mask and manually labeled real labels, the number of true positive pixels, false positive pixels, and false negative pixels are counted, and segmentation accuracy indicators including Dice coefficient, intersection-over-union ratio, precision, and recall are calculated. An edge detection operator is used to extract the pixel contours of the target region of the medical image segmentation mask to calculate the boundary continuity score, and the average gray-level gradient value of the pixel regions within a fixed range on both sides of the target region boundary is extracted as the boundary sharpness score.
7. The medical image segmentation method for ultrasound-guided nerve block according to claim 6, characterized in that, The steps following the steps of extracting the pixel contours of the target region of the medical image segmentation mask using an edge detection operator to calculate the boundary continuity score, and extracting the average gray-level gradient value of the pixel regions within a fixed range on both sides of the target region boundary as the boundary sharpness score, further include: Extract the lung tissue region or blood vessel region from the medical image segmentation mask as the high-risk surgical region, calculate the shortest spatial Euclidean distance from the target nerve or target fascia plane to the high-risk surgical region, and trigger a high-risk region identification prompt when the shortest spatial Euclidean distance is less than the safe distance threshold; The overall score is calculated using a weighted scoring function based on the Dice coefficient, the boundary continuity score, and the distance parameter to high-risk areas, and the comprehensive quality rating is output. The text generation model performs a logical judgment on the comprehensive quality rating based on the clinical logic rule tree. When the comprehensive quality rating is lower than the clinically usable threshold, it outputs scan improvement suggestions, including suggestions to adjust the ultrasound probe angle, suggestions to adjust the ultrasound equipment gain parameters, and suggestions to relocate the target blockage area. The ultrasound-guided nerve block surgery quality control assessment report is output by combining the color-coded visual annotation image, the segmentation accuracy index, the boundary continuity score, the boundary clarity score, the high-risk area identification prompt, the comprehensive quality rating, and the scan improvement suggestions.
8. The medical image segmentation method for ultrasound-guided nerve block according to claim 1, characterized in that, Following the step of generating the medical image segmentation mask for the ultrasound-guided nerve block image data, the method further includes: The network model consisting of the encoder backbone network, the boundary enhancement adapter, the category comparison adapter and the lightweight decoder is subjected to model quantization processing, and the floating-point weight parameters in the network model are converted into integer values to generate a quantized inference model. Receive the interactive prompt information re-entered by the operator based on the visual feedback of the medical image segmentation mask; The medical image segmentation mask is dynamically updated and optimized by using the quantization inference model in conjunction with the re-input interactive prompts.
9. A medical image segmentation system for ultrasound-guided nerve block, characterized in that, A medical image segmentation method for performing an ultrasound-guided nerve block as described in any one of claims 1-8, comprising: The feature encoding module is used to acquire ultrasound-guided nerve block image data and perform multi-level feature extraction using a pre-trained visual transformer as the encoder backbone network. The parameters of the encoder backbone network are kept frozen. The boundary enhancement module integrates a boundary enhancement adapter in the Transformer blocks of layers 1 to 3 of the encoder backbone network. It is used to calculate the boundary attention weights of the multi-level features through a gradient-guided attention mechanism, and to perform adaptive modulation enhancement on the multi-level features using the boundary attention weights, and output the enhanced features. The semantic discrimination module integrates a category contrast adapter in the Transformer blocks of layers 4 to 12 of the encoder backbone network. It is used to calculate the category probability of the enhanced features based on preset foreground category prototypes and background category prototypes, perform category assignment, execute intra-class aggregation mechanism and inter-class separation mechanism, and output the contrast-enhanced feature representation. The decoding and prompting module includes a lightweight decoder for acquiring interactive prompting information. It fuses the contrast-enhanced feature representation with the interactive prompting information through a cross-attention mechanism to generate a medical image segmentation mask for the ultrasound-guided nerve block image data.
10. An application of a medical image segmentation method for ultrasound-guided nerve block, characterized in that, The medical image segmentation method for ultrasound-guided nerve block as described in any one of claims 1-8 includes applying the medical image segmentation method to generate a quality control assessment report and surgical risk warning for ultrasound-guided nerve block surgery.