A method and system for dynamic gating of image segmentation and refinement risks
By constructing pixel-level uncertainty and consensus maps in medical image segmentation, generating a set of directional exploration cue points, and combining prior circuit breaking and posterior verification mechanisms, the problem of irreversible structural damage caused by blind exploration in existing technologies is solved, achieving efficient and safe image segmentation refinement.
Patent Information
- Application Number
- CN202611278416.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-21
- Publication Date
- 2026-11-17
AI Technical Summary
Existing medical image segmentation methods, lacking effective spatial safety constraints, may cause irreversible structural damage by blindly adding hints to highly ambiguous regions, such as discontinuous jumps in segmentation boundaries, topological tearing in narrow lesion regions, and catastrophic degradation such as complete mask disappearance. It is difficult to ensure the safety and controllability of the refinement process while improving image segmentation accuracy.
Multiple sets of predicted probability maps are generated through multiple random forward propagations of the image encoder, constructing pixel-level uncertainty maps and consensus maps, generating a set of directional exploration prompts, and combining prior circuit breaking and posterior verification mechanisms to perform risk gating decisions, strictly limiting the candidate space of exploration points to within the geometric transition zone of the segmentation boundary, ensuring the accurate delivery and security of exploration prompts.
It effectively avoids discontinuous jumps in segmentation boundaries and topological tearing in narrow lesion regions caused by blind exploration, significantly improves image segmentation accuracy while ensuring the safety and controllability of the refinement process and avoiding irreversible structural damage.
Smart Images

Figure CN123118499A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of image processing and artificial intelligence security technology, specifically to a dynamic gating method and system for image segmentation and refinement risk control. Background Technology
[0002] Accurate segmentation of medical images (such as ultrasound, computed tomography (CT), magnetic resonance imaging (MRI), and pathological slides) is a core component of computer-aided diagnosis and intelligent healthcare. In recent years, visual foundational models, such as the SegmentAnything Model (SAM), have demonstrated strong generalization capabilities in interactive medical image segmentation tasks after domain adaptation (e.g., MedSAM, SAM-Med2D). To meet the scalability requirements of large-scale clinical screening, the system needs to eliminate explicit expert guidance, moving towards zero-click, fully automated segmentation. In this scenario, an automatic prompt generation module can provide the system with initial anchor point prompts and generate an initial segmentation mask accordingly.
[0003] Because complex lesion boundaries in medical images are characterized by low contrast, highly blurred boundaries, and texture aliasing, the initial segmentation mask is often of poor quality in difficult boundary regions. To improve the quality of boundary segmentation, existing technologies usually introduce an automatic refinement mechanism. Near the boundary of the initial segmentation mask, heuristic strategies (such as uniform sampling or random perturbation) are used to generate additional exploration cue points. These exploration points are then jointly encoded with the initial anchor points, and the refined segmentation mask is obtained through secondary forward inference of the mask decoder.
[0004] However, in the absence of effective spatial safety constraints, the existing refinement methods that rely on the generation strategy of exploratory prompts may cause irreversible structural damage by blindly adding prompts to highly ambiguous regions. This includes discontinuous jumps in segmentation boundaries, topological tearing of narrow lesion regions (such as bridging parts and necks), and even catastrophic degradation such as the complete disappearance of the entire lesion mask (degradation into an empty mask). This makes it difficult to ensure the safety and controllability of the refinement process while improving the accuracy of image segmentation. Summary of the Invention
[0005] To address the shortcomings of existing technologies that blindly add hints to highly ambiguous regions in the absence of effective spatial safety constraints, which may lead to irreversible structural damage, this invention proposes a dynamic gating method and system for image segmentation refinement risk. This method organically integrates uncertainty quantification, directional exploration, and dual-layer gating, thereby solving the problems existing in the prior art.
[0006] A dynamic gating method for image segmentation refinement risk includes the following steps: Obtain the initial anchor point cue set and the corresponding initial segmentation mask of the input medical image; The input medical image is subjected to multiple random forward propagations by an image encoder to obtain multiple sets of prediction probability maps; the divergence metric value of the multiple sets of prediction probability maps is calculated pixel by pixel to form a pixel-level uncertainty map. A narrow-band candidate region is constructed around the boundary of the initial segmentation mask. A set of directional exploration cue points is generated within the narrow-band candidate region using a pixel-level uncertainty map and a consensus map composed of the average of multiple sets of predicted probability maps as joint guidance. The directional exploration cue point set and the initial anchor cue set are jointly encoded and then input into the mask decoder for fine-tuning forward inference, together with the encoder output obtained by modulating the feature increment output of the image encoder based on the pixel-level uncertainty map, to obtain the refined segmentation mask. Using the global uncertainty index of the pixel-level uncertainty map as the prior circuit breaker condition and the geometric divergence of the refined segmentation mask relative to the initial segmentation mask as the a posteriori verification condition, risk gating decision is made on the refined segmentation mask to generate the final decision result.
[0007] Furthermore, the step of performing multiple random forward propagations on the input medical image using an image encoder to obtain multiple sets of predicted probability maps specifically includes the following steps: Set the randomly deactivated units interpolated in the adapter layer of the image encoder to training mode to enable random neuron dropout, and freeze the batch normalization layer to evaluation mode. Perform on input medical images K Each independent forward propagation, in which the random deactivation unit randomly discards different neurons, and the batch normalization layer uses frozen global statistics for normalization; Collect the predicted logits from each forward propagation output, and apply a sigmoid activation function to each predicted logits to obtain... K Probability plot of the next prediction.
[0008] Furthermore, the step of calculating the divergence metric values of multiple sets of predicted probability maps pixel by pixel to form a pixel-level uncertainty map specifically includes the following steps: Pixel-by-pixel calculation K The divergence metric of the sub-prediction probability plot is: ; in, for K The arithmetic mean of the predicted probabilities. ; It is a binary entropy function. ; For the first k Secondary forward propagation at location The predicted probability at that location; K It is an integer not less than 2; according toK The divergence metric of the predicted probability map is used to generate a pixel-level uncertainty map.
[0009] Furthermore, the mean value of pixels located above a preset high quantile in the pixel-level uncertainty map is taken. As an indicator of global uncertainty: ; ; in The 95% quantile threshold is used for the pixel-level uncertainty map. The set of pixels whose divergence metric value is not lower than this threshold. This represents the number of pixels in the set.
[0010] Furthermore, the encoder output obtained by modulating the feature increment output of the image encoder based on the pixel-level uncertainty map specifically includes the following steps; The pixel-level uncertainty map is downsampled to the same spatial resolution as the internal feature map of the image encoder and linearly normalized to the [0,1] interval to obtain the normalized uncertainty map; The normalized uncertainty map is input into a feature modulation network consisting of a convolutional layer followed by a cascaded S-type activation function. The convolutional layer maps the normalized uncertainty map of a single channel into a multidimensional vector with the same number of feature channels as the adapter layer. The S-type activation function compresses each element of the multidimensional vector to the (0,1) interval to generate channel-wise modulation coefficients. The channel-by-channel modulation coefficients are applied to the feature increment output of the adapter layer in each Transformer block of the image encoder, and the feature increment output is scaled channel by channel to obtain the modulated encoder output.
[0011] Furthermore, the step of generating a set of directional exploration prompts within a narrow-band candidate region using a pixel-level uncertainty map and a consensus map composed of the average of multiple predicted probability maps as joint guidance specifically includes the following steps: Morphological dilation and morphological erosion operations are performed on the initial segmentation mask respectively. The difference between the dilation result and the erosion result is taken as the positive point narrowband candidate region, and the difference between the dilation result and the initial segmentation mask is taken as the negative point narrowband candidate region. A consensus graph is obtained by taking the arithmetic mean of the multiple sets of predicted probability graphs along the sampling dimension. Within the positive point narrowband candidate region, the normalized pixel-level uncertainty map, consensus map, and positive point narrowband mask are multiplied pixel by pixel to obtain a positive point joint scoring map; within the negative point narrowband candidate region, the normalized pixel-level uncertainty map, the complementary term of the consensus map, and the negative point narrowband mask are multiplied pixel by pixel to obtain a negative point joint scoring map. Local maxima are taken from the positive point joint scoring map and the negative point joint scoring map respectively, and candidate positions with scores below a preset lower limit are filtered out to obtain a positive exploration point candidate set and a negative exploration point candidate set; After sorting the candidate points in the positive and negative exploration point candidate sets according to their scores from high to low, a minimum distance constraint is applied to each candidate point. If the Euclidean distance between the current candidate point and any selected point is less than the preset minimum distance, the candidate point is discarded; otherwise, the candidate point is adopted. After the dispersion constraint, the directional exploration prompt point set is output.
[0012] Furthermore, before generating the set of directional exploration prompts, a circuit breaker protection mechanism is also included, specifically comprising the following steps: Calculate the maximum value of the normalized pixel-level uncertainty map within the candidate region of the positive point narrow band; When the maximum value is lower than the preset circuit breaker threshold, circuit breaker protection is triggered, and the generation of the directional exploration prompt point set is skipped.
[0013] Furthermore, before performing the refined forward inference, the method further includes multiplying the probability map of the initial segmentation mask with the complementary term of the normalized pixel-level uncertainty map pixel by pixel and downsampling to construct a soft region of interest prior map as an additional dense cue input to the mask decoder for performing refined forward inference.
[0014] Furthermore, the geometric divergence metric includes one or more combinations of overlap consistency deviation, boundary distance degradation, or mask topology vanishing; wherein the overlap consistency is measured using the Dice similarity coefficient, and the boundary distance is measured using the 95% Hausdorff distance; the determination criteria for the geometric divergence metric include the following three parallel checks: , , ;in, This represents the change in the Dice similarity coefficient of the mask before and after refinement. To refine the 95% Hausdorff distance variation before and after masking, The pixel area of the target region. To preset the overlap tolerance threshold, To preset the area protection benchmark value, To preset the tolerance threshold for boundary mutations, As the initial segmentation mask, For refining the segmentation mask.
[0015] The present invention also includes an image segmentation refinement risk dynamic gating system, comprising: The acquisition module is used to acquire the initial anchor point cue set and the corresponding initial segmentation mask of the input medical image; The extraction module is used to perform multiple random forward propagations on the input medical image through the image encoder to obtain multiple sets of predicted probability maps; the divergence metric value of the multiple sets of predicted probability maps is calculated pixel by pixel to form a pixel-level uncertainty map. The refinement forward inference module is used to construct narrowband candidate regions around the boundaries of the initial segmentation mask. Using a pixel-level uncertainty map and a consensus map composed of the average of multiple sets of prediction probability maps as joint guidance, a set of directional exploration cue points is generated within the narrowband candidate regions. The directional exploration cue point set and the initial anchor cue set are jointly encoded and then input into the mask decoder along with the encoder output obtained by modulating the feature increment output of the image encoder based on the pixel-level uncertainty map for refinement forward inference to obtain the refinement segmentation mask. The risk gating decision module is used to perform risk gating decision on the refined segmentation mask by using the global uncertainty index of the pixel-level uncertainty map as the prior circuit breaker condition and the geometric divergence of the refined segmentation mask relative to the initial segmentation mask as the a posteriori verification condition, and generate the final decision result.
[0016] This invention provides a dynamic gating method for image segmentation and refinement risk control, which has the following beneficial effects: This invention strictly limits the candidate space of exploration points to the geometric transition zone of the segmentation boundary by constructing a morphological narrowband. It uses the three-dimensional product of mutual information, consensus graph and narrowband mask as a joint score, which requires the selection of exploration points to simultaneously meet the triple conditions of weak cognition, semantic credibility and spatial constraints. This ensures that exploration prompts are accurately placed in highly ambiguous boundary areas while avoiding boundary jumps caused by semantically unreliable location deployment. Finally, through a two-layer defense of prior circuit breaking and a posteriori verification, it effectively avoids structural damage such as discontinuous jumps in segmentation boundaries, topological tearing in narrow lesion areas and complete disappearance of the mask caused by blindly adding prompts to highly ambiguous areas. It improves the segmentation accuracy and significantly enhances the safety and controllability of the refinement process. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating the image segmentation refinement risk dynamic gating method in an embodiment of the present invention. Figure 2 This is a schematic diagram of the uncertainty quantization and feature modulation mechanism of the MC Dropout mutual information graph in an embodiment of the present invention; Figure 3 This is a flowchart illustrating the decision-making process for a two-layer security defense system in an embodiment of the present invention. Detailed Implementation
[0018] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0019] Accurate segmentation of medical images is a core component of computer-aided diagnosis and intelligent healthcare. Due to the low contrast, highly blurred boundaries, and texture overlap inherent in complex lesion boundaries in medical images, initial segmentation masks often suffer from poor quality in challenging boundary regions. To improve boundary segmentation quality, existing technologies typically introduce automatic refinement mechanisms, adding additional exploration cue points to the initial segmentation and obtaining a refined segmentation mask through secondary forward inference. However, existing refinement methods exhibit the following four key shortcomings in practical clinical deployment:
[0020] (1) Lack of explicit modeling and guidance for cognitive uncertainty of the model. Traditional refinement methods often use uniform sampling, random perturbation or fixed rules to generate exploration prompts, without incorporating the model's cognitive hesitation about its own predictions into the decision-making basis for the exploration direction. This results in a large number of exploration prompts being placed in areas where the model has already determined the model, causing a waste of computing power, while the highly ambiguous boundary areas that really need fine-tuning are not fully explored.
[0021] (2) Blindly exploring during the refinement process may cause irreversible structural damage. Without safety constraints, blindly adding exploration prompts to highly ambiguous regions may lead to discontinuous jumps in segmentation boundaries, topological tearing of narrow lesion regions (such as bridging areas and neck), or even the complete disappearance of the entire lesion mask (degradation to an empty mask). Such catastrophic degradation is particularly prominent in difficult samples with complex anatomical structures or poor image quality.
[0022] (3) Lack of pre-emptive prediction and dynamic control of refinement risks. Existing methods generally lack mechanisms for assessing risks before refinement and determining actual benefits after refinement. Traditional posterior-driven models rely solely on fixed static thresholds to intercept refinement results. Taking Dice similarity coefficient and Hausdorff distance as examples, their standard definitions are: ; ;in, and Let each represent the set of boundary points of the two masks. This indicates taking the 95th percentile; calculate the values obtained from the mask. A boundary to mask B The boundary and the mask B boundary to mask AThe nearest distance to the 95th percentile of the boundary is taken, and the larger of the two values is used as the boundary value. Existing methods construct judgment rules based on the above indicators. ,in A globally static tolerance threshold is preset by the user. If the threshold is too wide, catastrophic degradation will be missed; if the threshold is too strict, refined results with positive benefits will be incorrectly blocked, creating a typical static threshold paradox. This fixed threshold strategy cannot dynamically adjust the blocking criteria based on the cognitive uncertainty of the samples.
[0023] (4) The conditional distributions of training and inference are misaligned. During the training phase, refined exploration hints generate accessible real-labeled data for constructing corrective hints; however, during the inference phase, the labels are unavailable, and the model must rely entirely on its own uncertainty estimates and initial predictions to generate exploration hints. This discrepancy in conditional distributions causes the model to learn error correction with answers during training, but faces exploration without answers during inference, thus degrading the refinement effect.
[0024] Based on this, this invention proposes a dynamic risk gating method and system for image segmentation refinement. This method receives initial anchor point hints and an initial segmentation mask, performs multiple random forward propagations on the input image, calculates mutual information values pixel-by-pixel to construct a pixel-level uncertainty map, feeds the uncertainty map into a feature modulation network, applies channel-level adaptive scaling to the encoder, and simultaneously constructs narrowband candidate regions at the segmentation boundaries. A safe exploration point set is generated through multi-source scoring and spatial constraints. After fusing anchor points and exploration points for refinement inference, a two-layer defense decision is made: if backoff is triggered, the initial mask is output; otherwise, the refined mask is adopted. This invention organically integrates cognitive uncertainty quantification, targeted safe exploration, and two-layer risk gating, providing a quantifiable and adjustable trade-off mechanism between segmentation performance and safety controllability.
[0025] The method specifically includes the following steps: S1. Receive the initial anchor point cue and initial segmentation mask of the input medical image.
[0026] Perform on the same input medical image K The image encoder's embedded random perturbation unit is enabled during each forward propagation, while the statistical normalization layer is frozen in evaluation mode to prevent runtime statistics from being contaminated by noise from multiple samplings; data is collected. K Group prediction probability map, calculated pixel by pixel K The divergence metric values from the sub-predictions are used to construct a pixel-level uncertainty map to measure cognitive uncertainty. A global uncertainty index is extracted from this uncertainty map, and low-confidence state markers are recorded. K It is an integer not less than 2.
[0027] Among them, the random perturbation unit is the random dropout unit interpolated in the adapter layer of the image encoder; the statistical normalization layer is the batch normalization layer; K In the next random forward propagation, all Dropout layers are set to training mode to enable random neuron dropping, and all batch normalized layers are frozen to evaluation mode.
[0028] Specifically, perform on the same input image K In each random forward propagation, the random perturbation units embedded in the image encoder are set to training mode to enable random neuron dropout, while all batch normalization layers are frozen to evaluation mode to prevent runtime statistics from being contaminated by noise from multiple samplings; collecting K The predicted logits from the next forward propagation are then applied with the Sigmoid function to obtain... K Group prediction probability plot.
[0029] The divergence metric is calculated based on mutual information, pixel by pixel. K The mutual information value of the prediction probability is: in, for K The arithmetic mean of the predicted probabilities. For the first k Secondary forward propagation at location The predicted probability at that location; It is a binary entropy function. In p Represents any probability value.
[0030] This constitutes a pixel-level mutual information graph. This is used to characterize cognitive uncertainty; further, the mean value of pixels located above a preset high quantile in the mutual information graph is taken. As an indicator of global uncertainty: in The 95th percentile threshold for the mutual information graph. The set of pixels whose mutual information value is not lower than this threshold. This represents the number of pixels in the set. Simultaneously, it records low-confidence alarm states; when the maximum value of the probability heatmap corresponding to the initial segmentation mask is lower than a preset confidence threshold, this alarm state is set to true. K It is an integer not less than 2.
[0031] S2. Input the pixel-level uncertainty map into a lightweight feature modulation network, and apply channel-level scaling to the feature increment output of the neighborhood adaptation layer in the image encoder, so that the image encoder produces differentiated feature responses to high-uncertainty regions and low-uncertainty regions; simultaneously, construct narrowband candidate regions around the boundaries of the initial segmentation mask, using the pixel-level uncertainty map and the... K The consensus graph, composed of the probability of the sampled mean, serves as a joint guide. Within this narrow candidate region, a set of directional exploration prompts is generated through multi-source scoring and spatial constraints.
[0032] Specifically, the pixel-level mutual information map is input into the feature modulation network to generate channel-wise modulation coefficients. These modulation coefficients are then applied to the feature increment output of the Adapter layer in each Transformer block of the image encoder, enabling the encoder to produce differentiated feature responses to high-mutual-information regions and low-mutual-information regions. Simultaneously, narrowband candidate regions are constructed around the boundaries of the initial segmentation mask, and the pixel-level mutual information map is compared with the input from the Adapter layer. K The consensus graph, constructed from the probability of the subsampled mean, serves as a joint guide. Within this narrow-band candidate region, local peak candidates are extracted using a multi-source joint score based on mutual information, consensus degree, and narrow-band mask. The scoring expression is as follows: in, For normalized mutual information graphs, For consensus diagrams, and These are the positive and negative narrowbands, respectively. and Positive and negative scores are assigned respectively, and a set of directional exploration prompts is generated through spatial dispersion constraints; if the maximum mutual information value in the narrow-band candidate region is lower than the preset circuit breaker threshold, the generation of exploration points is skipped.
[0033] The lightweight feature modulation network consists of a 1×1 convolutional layer followed by a cascaded Sigmoid (S-type activation) function. The 1×1 convolutional layer maps the normalized uncertainty map of a single channel into a multidimensional vector with the same number of feature channels as the Adapter layer. The Sigmoid function compresses the elements of this vector to the (0,1) interval, generating channel-wise modulation coefficients. These modulation coefficients are applied channel-wise to the feature increment output of the Adapter layer in each Transformer block of the image encoder. The expression for feature modulation is: in, This is the normalized mutual information map obtained by linearly normalizing the aforementioned pixel-level mutual information map to the [0,1] interval. For each channel, the modulation coefficients are... and These are the incremental outputs of the Adapter features before and after modulation. This indicates channel-by-channel multiplication.
[0034] Preferably, the narrowband candidate region is constructed as follows: morphological dilation and morphological erosion operations are performed on the initial segmentation mask respectively, and the difference between the dilation result and the erosion result is taken as the positive narrowband candidate region, and the difference between the dilation result and the initial segmentation mask is taken as the negative narrowband candidate region; wherein, the positive narrowband mask is used to limit the candidate position of the foreground exploration point, and the negative narrowband mask is used to limit the candidate position of the background suppression point.
[0035] Preferably, the multi-source scoring method is as follows: the normalized pixel-level uncertainty map, consensus map or initial segmentation probability map, and narrowband mask are multiplied pixel by pixel to form a joint scoring map; the local maxima of the joint scoring map are taken, and candidate positions with scores below a preset lower limit are filtered out to obtain candidate exploration points; in a preferred embodiment, the score of a positive exploration point is composed of the multiplication of the uncertainty map, consensus map, and positive point narrowband mask, and the score of a negative exploration point is composed of the multiplication of the uncertainty map, the complementary term of the consensus map, and negative point narrowband mask. In this preferred embodiment, the above multi-source scoring expression is used:
[0036] in, For the normalized uncertainty graph, For consensus diagrams, and These are the positive and negative narrowbands, respectively. and These are positive and negative scores, respectively.
[0037] Preferably, the spatial constraint includes circuit breaker protection, which is triggered when the maximum uncertainty within the narrowband candidate region is lower than a preset circuit breaker threshold. The expression for this protection is: in This is a candidate region for the narrow band of positive points. The system skips the generation of additional exploration points. In one embodiment, the system can directly reuse the initial segmentation results or perform fine-tuning inference using only the initial anchor points. In a preferred embodiment, the preset circuit breaker threshold is 0.2.
[0038] S3. Input the directional exploration cue point set and the initial anchor point cue into the cue encoder for encoding. Then, input the obtained cue encoding result, the modulated encoder output obtained in step S2, and the soft region of interest prior map into the mask decoder to perform refined forward inference and obtain the refined segmentation mask.
[0039] This also includes constructing a soft region of interest prior map as additional dense cue input to the mask decoder before performing refined forward inference. The refined forward inference is then performed to obtain the refined segmentation mask. The mask is constructed by multiplying the sigmoid probability map of the initial segmentation mask pixel-wise with the complementary term of a pixel-level uncertainty map normalized to the [0,1] interval, and downsampling the product to the same spatial resolution as the internal feature map of the mask decoder. The expression for the prior map is: in, The Sigmoid probability map for the initial segmentation mask. The mutual information graph is normalized to the [0,1] interval. This indicates a downsampling operation. This is a soft region of interest prior map.
[0040] S4. Construct a two-layer security defense consisting of prior circuit breaking and subsequent verification: The first layer checks whether the global uncertainty index exceeds the preset valve threshold, whether the low confidence status marker is low confidence, or whether all initial positive anchor point prompts have failed. If any one of these conditions is met, prior backoff is triggered. For samples that pass the first layer, the second layer calculates the geometric divergence metric of the refined segmentation mask relative to the initial segmentation mask. During online deployment, this metric is directly determined by the overlap difference, boundary distance difference, and empty mask status between the refined mask and the initial mask, without relying on the actual annotation. When the geometric divergence metric exceeds the corresponding preset tolerance threshold, subsequent backoff is triggered. The geometric divergence metric includes at least one or more combinations of overlap consistency deviation, boundary distance deterioration, or mask topology disappearance. When backoff is triggered, the initial segmentation mask is output as the final result; otherwise, the refined segmentation mask is output.
[0041] The overlap was determined using the Dice similarity coefficient, the boundary distance was determined using the 95% Hausdorff distance, and the criterion for geometric divergence included the following three parallel checks: in, This represents the change in the Dice similarity coefficient of the mask before and after refinement. To refine the 95% Hausdorff distance variation before and after masking, Area The pixel area of the target region. To preset the overlap tolerance threshold, To preset the area protection benchmark value, To preset the tolerance threshold for boundary mutations, As the initial segmentation mask, For refining the segmentation mask; The preset valve threshold is set to 0.15 (default, adjustable range 0.05~0.30). In a preferred embodiment, the preset overlap tolerance threshold is 0.05, the preset area protection baseline value is 100 pixels, and the preset boundary change tolerance threshold is 20 pixels.
[0042] Its prior circuit breaker conditions and final output logic are as follows: Triggering rollback conditions: No valid positive anchor point, or a low confidence alarm is triggered, or Conditions for a disaster to occur: Final output: (If a rollback or disaster occurs, otherwise) ,in, As the initial segmentation mask, To refine the segmentation mask, This is the final output mask.
[0043] In training and offline evaluation scenarios, the geometric divergence metric is calculated by comparing the difference between the refined and unrefined masks with the ground truth annotations. In online deployment scenarios, the geometric divergence metric is calculated directly between the refined segmentation mask and the initial segmentation mask, based on the degree of overlap consistency deviation and boundary distance difference, without relying on the ground truth annotations.
[0044] The preset valve threshold is a continuously adjustable parameter. Lowering the valve threshold makes the system more conservative, and the backoff rate and disaster interception rate increase simultaneously. Raising the valve threshold makes the system more aggressive, and the backoff rate decreases while the risk of disaster leakage increases. This allows for a continuously adjustable balance between the backoff rate and disaster interception rate by adjusting the valve threshold. In a preferred embodiment, the default value of the valve threshold is 0.15, and the adjustable range is from 0.05 to 0.30.
[0045] This invention also proposes a training method for a dynamic gating model for image segmentation refinement risk. The model includes an initial segmentation head, and the training method includes the following steps: a soft-landing mechanism using Focal Loss is adopted, in which only the binary cross-entropy loss function is used in the first 3 to 10 training cycles, and then the weight of Focal Loss is linearly increased from 0 to 1.0 after 3 to 10 ramp-up cycles; after the warm-up period, a contrastive topology loss mechanism is enabled, based on the Euclidean distance transformation of the labeled mask, to force the average prediction probability of the lesion core region to be higher than the average prediction probability of the edge region by at least a preset minimum difference requirement, and the minimum difference requirement is dynamically increased with the training process.
[0046] The core innovations and synergistic benefits of this invention are as follows: (1) A pixel-by-pixel divergence quantization system was constructed, using the adapter's built-in Dropout as the random perturbation source and mutual information as the measure of cognitive uncertainty. Unlike the conventional approach of disabling Dropout in inference, this invention explicitly enables Dropout and employs a statistical normalization layer freezing strategy, reusing the existing structure as an uncertainty sensor without introducing additional network modules. K The mutual information value characterizes the degree of prediction discrepancy in multiple independent random forward passes, representing the model's hesitation in predicting each pixel. When each prediction in multiple random forward passes gives a definite but contradictory judgment close to 0 or close to 1, the entropy of each prediction itself is low, but the mean of multiple predictions is close to 0.5, resulting in a high mean entropy. The difference between the two (i.e., mutual information) thus increases, accurately marking the ambiguous boundary regions in the model's cognition. Furthermore, the mutual information map is input into a lightweight feature modulation network composed of a single 1×1 convolution and a sigmoid gate, and the output of the Adapter layer is scaled at the channel level. At the feature representation level, the domain adaptation capability is automatically redistributed to high uncertainty regions, fundamentally solving the problem of traditional methods lacking cognitive uncertainty modeling and guidance. Unlike traditional methods that simply concatenate the uncertainty map as an additional channel with the original image at the input or output layer, this invention transforms the uncertainty map into a channel-level modulated signal, deeply embedding it into the Adapter operation link of each Transformer block of the image encoder. This design produces a technical effect that cannot be achieved by simply adding up existing technologies, such as adaptive allocation of computing resources according to cognitive needs. In deterministic regions, the model hardly triggers adapter correction, maintaining the stability of pre-trained features; in highly ambiguous regions, it fully activates domain adaptation capabilities, and the two do not interfere with each other.
[0047] (2) A targeted and safe exploration point generation strategy was designed, which consists of morphological narrowband constraints, multi-source joint scoring, circuit breaker protection, and spatial distribution control as progressive levels. This strategy strictly limits the candidate space of exploration prompts to the geometric transition zone of the segmentation boundary, and uses the product of mutual information, consensus degree, and narrowband mask as the joint score. Regions with higher consensus degree (more consistent collective opinion of the model) have a greater weight in the positive exploration point score, ensuring the safe deployment of exploration prompts from multiple dimensions. The circuit breaker protection mechanism automatically terminates the exploration process when the initial segmentation is sufficiently reliable, avoiding unnecessary computational consumption and the risk of over-correction. Distributed control prevents multiple points from clustering through minimum spacing constraints, ensuring the geometric coverage efficiency of exploration. This multi-level progressive constraint system ensures that exploration prompts are accurately placed in the highly ambiguous boundary regions where the model truly needs help, while avoiding the risk of topological destruction caused by blind exploration from the two dimensions of spatial range and semantic credibility.
[0048] (3) A two-layer security defense system was constructed, linking prior uncertainty circuit breaker prediction with posterior geometric divergence verification. The first layer (prior layer) performs parallel checks on global uncertainty indicators, low-confidence states, and anchor point validity before fine-tuning (or before post-fine-tuning decision-making), and directly implements circuit breaker rollback for high-risk samples, blocking the possibility of high-risk corrections entering the decision chain. The second layer (posterior layer) performs post-fine-tuning verification on samples that have passed the prior layer, while monitoring three disaster modes: overlap consistency deviation, supplemented by area protection lock to prevent small lesions from being misjudged due to Dice sensitivity, and does not rely on real annotations during online deployment, but only measures risk from the direct difference between the two masks; boundary distance abrupt change, capturing discontinuous jumps in the segmentation contour; and mask disappearance, detecting topological disasters in extreme cases where the lesion target is completely erased. It should be noted that in the online deployment scenario, the geometric divergence measurement of the posterior verification is calculated entirely based on the direct comparison between the fine-tuned mask and the initial mask, without relying on real annotations; real annotations are only used in training, verification, and offline evaluation embodiments. In this two-tiered defense system, the valve threshold is a continuously adjustable parameter: lowering the threshold makes the system more conservative, with both the backoff rate and the catastrophic interception rate increasing; raising the threshold makes the system more aggressive, allowing more samples to receive refinement opportunities, but increasing the risk of catastrophic misses. This parameter creates a continuously adjustable trade-off between safety and refinement benefits among the backoff rate, catastrophic interception rate, and final segmentation accuracy, providing a configurable risk control solution for clinical scenarios with different safety requirements.
[0049] (4) A progressive supervised decay training strategy combining Focal Loss soft landing and contrastive topology loss was designed. Focal Loss soft landing applies only a smooth binary cross-entropy loss in the early training phase, allowing the model to first learn the approximate outline of the heatmap. Subsequently, the Focal Loss weights are linearly increased, gradually introducing a sharpening penalty for difficult-to-distinguish samples, forming a progressive learning process from blurry to clear. Contrastive topology loss is activated after the warm-up period. Based on the Euclidean distance transformation of the labeled mask, a probability gradient constraint decreasing from the lesion center to the edge is constructed, forcing the prediction probability of the core region to be systematically higher than that of the edge region. This constraint does not focus on the absolute probability value but rather shapes the gradient shape within the heatmap, decreasing sequentially from the center to the edge, providing a deterministic geometric prior for locating exploration points in subsequent refinement. The two mechanisms work together to alleviate the misalignment problem caused by accessible labels during the training phase but inaccessible labels during the inference phase.
[0050] Based on the above methods, the present invention proposes an embodiment, such as... Figure 1 As shown, the specific steps include: S100. In the fully automated medical image segmentation pipeline, the automatic prompt generation module has completed the initial prompt generation and initial forward inference of the input image, and the system obtains the initial anchor point prompt set. and the corresponding initial segmentation mask .
[0051] S200, Quantification of cognitive uncertainty and extraction of global prior indicators.
[0052] To quantify the model's cognitive uncertainty regarding the current segmentation results, the system reuses the Dropout units inserted in the Adapter layer of the image encoder as a built-in source of random perturbation. In normal inference, the Dropout layers are set to evaluation mode (i.e., random dropping is disabled); however, in this step, the system explicitly sets all Dropout layers to training mode to enable random neuron dropping, while simultaneously freezing all batch normalization layers in evaluation mode to prevent the running mean and variance from being contaminated by noise from multiple samplings.
[0053] Under this configuration, for the same input image I implement K A second independent forward propagation, obtaining K Group prediction logits (unnormalized predictions). Number of samples. K The value is set to 5; the Sigmoid function is applied to each group of logits to obtain... K Group prediction probability map ( k =1,2,...,K ).
[0054] Pixel-by-pixel calculation K Mutual information (MI) of the sub-predictions serves as a measure of cognitive uncertainty: in, pixel position Mutual information value at the location; for K The arithmetic mean of the predicted probabilities; The entropy of this mean; For the first k The entropy of the predicted probability. Mutual information measures the degree of inconsistency between predictions in multiple random forward passes. Its physical meaning is: when multiple random forward passes give contradictory but definite predictions close to 0 or close to 1 (e.g., three predictions of 0.1, 0.9, and 0.1), the entropy of each prediction itself is low. (The individual values are relatively small), but the arithmetic mean of multiple predictions is close to 0.5, and the mean entropy is... The difference between the two is relatively high, i.e., mutual information, and therefore it increases significantly in locations where there is cognitive disagreement, thus accurately marking the ambiguous boundary regions in the model's cognition.
[0055] Will K The arithmetic mean of the predicted probabilities along the sampling dimension is used to construct a consensus graph: Consensus diagram Numerically equal to the aforementioned K Arithmetic mean of the predicted probabilities ,in, Used to calculate pixel-level mutual information This consensus graph serves as input for the multi-source joint scoring in step S2. It represents the collective opinion from multiple samplings and will be used for multi-source joint scoring in step S2. Regions with consensus probabilities close to 0 or 1 indicate that the model's collective opinion is consistent and suitable as a safe reference for exploratory point deployment; regions with consensus probabilities close to 0.5 indicate internal disagreements within the model, and their scores will naturally be lower.
[0056] Extracting global uncertainty indicators from pixel-level mutual information graphs Take the arithmetic mean of pixels above the 95th percentile in the mutual information graph: in, The 95th percentile threshold for the mutual information graph. The set of pixels whose mutual information value is not lower than this threshold. This represents the number of pixels in the set. The high quantile interval is used as the mean instead of the global mean to eliminate the dilution effect of a large number of low-uncertainty background pixels on the metric, ensuring that the metric primarily reflects the model's hesitation in highly ambiguous boundary regions.
[0057] Simultaneously, the system records low-confidence alarm states, and the probability heatmap corresponding to the initial segmentation mask is recorded. When the maximum value is lower than the preset confidence threshold (0.3), the alarm state is set to true, indicating a low confidence state. This is the initial probability map processed by the sigmoid activation function and not binarized.
[0058] S300, uncertainty-guided implicit feature modulation and directional security exploration point generation, such as Figure 2 As shown.
[0059] This step comprises two parallel sub-processes: implicit feature modulation (A) and explicit directional security exploration point generation (B).
[0060] (A) Implicit feature modulation.
[0061] The pixel-level mutual information map obtained in step S1 is downsampled to the same spatial resolution as the internal feature map of the image encoder through spatial average pooling, and then linearly normalized to the [0,1] interval to obtain the modulation input map. .Will Input feature modulation network (Modulator), which consists of a A convolutional layer and a cascaded sigmoid activation function constitute a structure:
[0062] in, Convolutional layers map a single-channel normalized mutual information graph to... C dimensional vector ( C (equal to the number of feature channels in the Adapter layer), the Sigmoid function compresses each element of the vector to... interval, This is the channel-by-channel modulation coefficient vector.
[0063] In each Transformer block of the image encoder, the Adapter layer produces feature increment outputs. The increment is modulated by the coefficient. Scaling per channel:
[0064] in, The modulated adapter output, This indicates channel-wise multiplication (broadcast along the channel dimension). The semantics of the modulation coefficients are: in the feature channels corresponding to image regions with high mutual information, When the value is close to 1, the Adapter effectively performs its domain adaptation capabilities; in the feature channels corresponding to image regions with low mutual information, When the value approaches zero, the Adapter's response is suppressed. This mechanism allows the encoder to automatically focus its adaptation capabilities on regions of high uncertainty at the feature representation level, without altering the model's structural parameters.
[0065] (B) Generation of directional safety exploration points.
[0066] To obtain mutual information graphs and consensus graphs and initial segmentation mask As input, generate a set of directional exploration hint points in the following progressive hierarchy.
[0067] First layer: Morphological narrowband constraint: for the initial segmentation mask Morphological dilation and erosion operations are performed separately, and the difference between the two is used as a candidate narrowband for exploration. The dilation and erosion operations use morphological operators with an equivalent radius of 5 pixels.
[0068] in, and These represent performing morphological dilation and morphological erosion operations on the input mask using preset structuring elements, respectively. It is a candidate narrowband at the right time. This is a negative candidate narrowband. Geometrically, the narrowband represents the transition region on both sides of the initial segmentation boundary. Positive narrowbands cover the suspected under-segmented region inside the boundary and the suspected over-segmented region outside the boundary, while negative narrowbands cover the adjacent background region outside the boundary. Exploratory point candidate sampling is performed only within the area defined by the narrowband, excluding the determined foreground core region and the determined background far region, which are far from the boundary.
[0069] Second layer: Multi-source joint scoring: For each candidate location within the narrowband, a joint score is calculated by integrating mutual information, consensus, and narrowband location information sources. in, To normalize to Mutual information value of the interval, For consensus diagrams, Give a positive rating. Negative points are scored. The scoring logic is as follows: the higher the mutual information (the more uncertain the model), the higher the score of the candidate position; the higher the consensus (the more consistent the model's collective opinion in identifying it as a foreground), the greater the weight of the position in the positive point score and the smaller the weight in the negative point score; only positions within the narrow band participate in the scoring.
[0070] The third layer: Local peak extraction and score filtering: Local maxima are extracted from the joint score map (non-maximum suppression, equivalent radius of 5 pixels) to obtain candidate exploration point locations; candidate locations with scores below a preset lower limit (e.g., 0.05) are filtered out. This step selects significant peaks in the score map as exploration points to avoid wasting prompt quotas at suboptimal locations.
[0071] Fourth layer: Fuse protection: Before starting sampling, check the maximum mutual information value within the intersection area of the point narrow band and mutual information. If:
[0072] in, If a preset circuit breaker threshold (set to 0.2) is used, it indicates that the model's overall understanding of the current initial segmentation boundary is quite certain. K The predictions within this boundary region are highly consistent, with no significant cognitive discrepancies. At this point, the system skips the additional exploration point generation step and does not generate any directional exploration points. In one embodiment, the system can directly reuse the initial segmentation result; in another embodiment, the system can perform refined inference using only the initial anchor points. This circuit breaker mechanism avoids unnecessary perturbation of already sufficiently reliable segmentation results.
[0073] Fifth layer: Decentralized control: When multiple exploration points need to be generated (such as punctual quotas) Individual, negative point quota When there are (number) points, apply a minimum spacing constraint to the selected point sequence. (Take 18 pixels). If the Euclidean distance between a newly sampled candidate point and any already selected point is less than 18 pixels... If the candidate is not found, it is discarded and resampling is performed. Distributed control prevents multiple exploration points from concentrating in the same local area, ensuring equal coverage of different segments of a long boundary.
[0074] The output of the above five-level progressive constraints is the set of directional exploration hint points. It contains the image coordinates of each point and its corresponding foreground / background label.
[0075] S400, fine-tuning and risk gating, such as Figure 3 As shown.
[0076] S401, Refined Reasoning Based on Fusion Exploration Points The set of directional exploration hints generated in step S2 With initial anchor point hints Combined, these form a complete set of tips for the refinement phase: The complete cue set is positionally encoded using a prompt encoder, mapping point coordinates to sinusoidal position embeddings and assigning corresponding learnable label embeddings based on foreground / background labels. The encoded sparse cue embeddings, along with the image embeddings output by the image encoder, are then fed into a mask decoder.
[0077] Simultaneously, construct a soft region of interest prior map. As additional dense cue input for the mask decoder: in, ( The probability map corresponding to the initial segmentation mask in step S1 (after Sigmoid but not binarized) is shown. To normalize to Inter-interval mutual information graph This indicates a downsampling operation. The product construct conveys the following guiding semantics: the model should focus on regions initially considered to belong to the foreground (…). (high position), but the uncertainty of the high ground ( The high-confidence region needs to be kept open to re-examination (multiplied by a complementary factor less than 1), while the initial high-confidence region ( The lower position basically maintains the original judgment (multiplied by a factor close to 1). Downsampled to the same resolution as the internal feature map of the mask decoder (e.g.) ), which serves as a dense cue embedded input decoder.
[0078] Based on the above complete set of prompts And soft ROI prior plot The refined forward inference is performed to obtain the refined segmentation logits. After binarization with the Sigmoid function and a fixed threshold (0.5), the refined segmentation mask is obtained. .
[0079] S402, Priority Fuse and Subsequent Verification Dual-Layer Safety Gating Decision: Construct a dual-layer safety defense line consisting of a priority fuse layer and a subsequent verification layer connected in series, and implement safety control for the fine repair process in sequence.
[0080] (A) First layer: Prior circuit breaker prediction.
[0081] Before refining the inference (or after obtaining the refining result but before the final decision output), the system performs a parallel check on the following three prior conditions, and triggers a prior backoff if any one of the conditions is true: Condition 1 (Anchor Point Failure): The automatic prompt generation module does not generate any valid positive anchor point prompts; all positive anchor points are invalid. This condition occurs in scenarios where the input image quality is extremely poor and the lesion area is completely submerged in noise. In this case, the initial segmentation itself is unreliable, and fine-tuning is not feasible.
[0082] Condition 2 (Low Confidence Alarm): The low confidence alarm recorded in step S1 is true, meaning the maximum probability value of the initial segmentation heatmap is less than 0.3. This condition indicates that the model lacks confidence in the basic location of the lesion, and the heatmap distribution is nearly uniform or exhibits a multi-peak chaotic pattern.
[0083] Condition 3 (High Uncertainty Circuit Breaker): The global uncertainty index extracted in step S1 Exceeding the preset valve threshold ,Right now: The default value is 0.15, and the adjustable range is 0.05 to 0.30. This condition indicates that the model has a large cognitive divergence in the initial segmentation boundary region, and the risk of catastrophic degradation caused by fine-tuning operations is high.
[0084] The above three conditions are logical OR relations. If any one of them is true, the system will trigger a rollback, skipping the refinement result and directly applying the initial segmentation mask. As the final output.
[0085] (B) Second layer: Post-disaster verification.
[0086] For samples that pass the prior circuit breaker (i.e., do not trigger backoff), the system has obtained the refined segmentation mask. At this point, it is necessary to further verify whether the finishing work actually caused unacceptable geometric degradation.
[0087] In training, validation, or offline evaluation scenarios, the ground truth ground truth (GT) can be accessed to calculate the changes in overlap and boundary distance between the mask and the GT before and after refinement. in, The Dice similarity coefficient is defined as twice the area of the intersection of two masks divided by the sum of the areas of the two masks. The 95% Hausdorff distance is calculated by taking the nearest distance at the 95th percentile in each of the two mask boundary point sets in two directions, and then taking the larger of the two values.
[0088] In online deployment scenarios, the actual marked area is inaccessible; in this case, the aforementioned changes are handled by a refined mask. With the initial mask Direct geometric difference substitution between: This directly measures the overlap consistency and boundary deviation between the refined mask and the initial mask. Since online scenarios lack real-world annotations, this deviation metric is not directly equivalent to performance degradation, but rather serves as a statistical indicator of increased risk. If the overlap consistency between the two masks is too low or the boundary deviation is too large, the refined result may be unreliable, and a rollback should be triggered. This alternative approach maintains the operability of disaster detection, ensuring that the technical solution is fully implementable during online deployment. It should be noted that in online deployment scenarios, the posterior verification metric is the consistency deviation between the refined mask and the initial mask, and its tolerance threshold is an adjustable parameter. During clinical deployment, the above tolerance threshold can be set higher than the offline evaluation value, based on the expected refinement gain. For example, it could be set to 0.05 for offline evaluation and 0.15 to 0.25 for online deployment, to allow for reasonable large-scale boundary corrections.
[0089] Based on the above changes, the system performs a parallel check of the following three disaster criteria; if any one of them is true, a catastrophic degradation is determined to have occurred: Criterion 1 (Reduced overlap consistency + area protection lock): in, The preset overlap tolerance threshold is preferably set to 0.05 in training and offline evaluation scenarios, and can be set to 0.15 to 0.25 in online deployment scenarios. This represents the absolute pixel area of the lesion target region. In training and offline evaluation scenarios, this criterion detects whether the refinement operation leads to a true degradation in segmentation quality; in online deployment scenarios, this criterion detects whether there is a significant deviation in the overlap consistency between the refined mask and the initial mask. Excessive deviation indicates that the refinement operation may have introduced unreliable boundary changes. The area protection lock is designed based on the fact that the Dice coefficient of small lesions (less than 100 pixels in area) is extremely sensitive to small boundary changes; even if the segmentation quality is substantially improved, It's also possible for the value to drop by more than 0.05 due to variations in individual pixels. Without area protection, normal boundary fine-tuning will be misjudged as catastrophic. Furthermore, for large lesions... A drop of more than 0.05 usually indicates an unacceptable pattern change that must be intercepted.
[0090] Criterion 2 (Sudden Change in Boundary Distance): in, A preset threshold for tolerating abrupt boundary changes (20 pixels) is set. This criterion directly captures discontinuous jumps in the segmented contour. Even if the overall overlap does not change significantly before and after refinement, if the local boundary expands or contracts significantly, the criterion will be correct. It will deteriorate drastically.
[0091] Criterion 3 (mask topology disappearance): Initial segmentation mask The segmentation mask is non-empty (i.e., foreground pixels exist) and refined. Degenerates into an empty mask (zero foreground pixels), resulting in The calculation returns a non-numeric value (NaN) or infinity.
[0092] This criterion addresses the most extreme topological disaster in the refinement operation, where the target lesion is completely erased. In this scenario, the boundary distance operator loses its mathematical meaning; therefore, this criterion is independent of Criterion 1 and Criterion 2, directly triggering the highest risk priority.
[0093] The system determines that a disaster has occurred, triggers a retrospective rollback, and outputs the initial segmentation mask. As the final result.
[0094] (C) The logic of the final judgment.
[0095] A comprehensive two-tiered defense system with risk retreat indicators. This represents the combined judgment result of prior circuit breaker failure and subsequent verification, where... This indicates that a rollback has been triggered. This indicates that the rollback was not triggered. Final output. Determined by the following formula:
[0096] That is: if a priori circuit breaker triggers a rollback or a subsequent review discovers a disaster, then... Output the initial segmentation mask; otherwise, let The logic is to adopt a refined segmentation mask. The essence of this logic is: to trust the refined result by default, but to set two independent blocking conditions. The first condition is to predict the risk before execution, and the second condition is to review the quality after execution.
[0097] Valve threshold It is a continuously adjustable system hyperparameter, the value of which directly determines the safety-performance trade-off boundary: Will Lowering the value (e.g., 0.05) makes the system more conservative, increases the prior circuit breaker trigger frequency, increases the backoff rate, and improves the ability to intercept catastrophic degradation. However, some normal samples that could have obtained fine-tuning gains are backed up, and the final average segmentation accuracy is slightly lower than the optimal value.
[0098] Will Increase (e.g., 0.30): The system becomes more aggressive, the frequency of prior circuit breaker triggering decreases, the backoff rate decreases, more samples get the opportunity for refinement, and the final average segmentation accuracy may improve, but the risk of missing catastrophic events increases simultaneously.
[0099] default value It falls within the balance range between safety and performance. Experiments have verified that near-optimal final segmentation accuracy can be obtained around this value, while maintaining a high level of disaster interception rate.
[0100] The quantitative relationship between the backoff rate, disaster interception rate, and final average Dice coefficient under valve threshold adjustment constitutes the Pareto front. During clinical deployment, an appropriate work point can be selected based on the department's risk preference: lower risk levels should be chosen for high-safety-requirement scenarios (such as preoperative navigation). For high-throughput screening scenarios (such as physical examinations), a higher value can be selected. value.
[0101] S500 outputs the final decision result to achieve medical image segmentation.
[0102] In addition, to alleviate the misalignment of condition distribution caused by differences in label accessibility between training and inference, the present invention employs the following progressive supervision decay strategy during the training phase.
[0103] (i) Focal Loss soft landing mechanism.
[0104] Number of warm-up cycles during initial segment head training Within this model, only the binary cross-entropy (BCE) loss function is applied, without applying Focal Loss, allowing the model to first learn the approximate outline of the heatmap. From the [previous stage]... Starting from the first cycle, after the climbing cycle Focal Loss weights Linear growth from 0 to 1.0:
[0105] in, Number the current training period. This refers to the number of preheating cycles. The number of climb cycles is 5, with both the number of preheating cycles and the number of climb cycles set to 5.
[0106] set up This represents the total loss of the initial segmentation head. This represents the binary cross-entropy loss. Let represent the focus loss. Then the total loss function of the initial segmentation head is:
[0107] This design enables heatmap learning to form a gradual process from coarse to fine: the pure BCE stage produces a smooth probability profile, and Focal Loss gradually intervenes to apply a sharpening penalty to the boundary region, suppressing edge blurring and artifacts in the heatmap and forming needle-like probability peaks.
[0108] (ii) Comparison of topological loss mechanisms.
[0109] After the preheating period ends (i.e. Enabled at [time]. Euclidean distance transformation of the labeled mask GT. Based on this, the pixels inside the lesion are divided into core regions. and edge areas :
[0110] in, This represents the maximum value of the distance transformation within the lesion.
[0111] Comparison of topological loss The average predicted probability of the core area is forced to be at least The margin is higher than the average predicted probability of the edge region, where the margin is a non-negative adjustable parameter whose value is dynamically adjusted during training: in, For dynamic margins, ReLU represents the corrected linear unit. The loss is 0.3 for the first 12 training epochs, increasing to 0.5 from the 13th epoch onwards. This loss does not concern itself with the absolute value of the predicted probability, but only forces the probability spatial distribution within the lesion to exhibit a gradient pattern that decreases sequentially from the center to the edge. This gradient pattern is crucial for the subsequent refinement stage. The exploration point localization strategy in refinement relies on the global maximum value of the heatmap to determine the lesion center location. A heatmap with a clear gradient and prominent peaks can ensure that the center anchor point is stably located in the core region of the lesion.
[0112] The dynamic gating method for fine-tuning risk of this invention can be widely applied to various computer-aided diagnostic scenarios in medical imaging. For example, in ultrasound screening of thyroid nodules, this invention can safely refine nodule boundaries based on automatic segmentation, avoiding boundary jumps or disappearance of small lesions caused by blind exploration, while flexibly adjusting the threshold according to clinical risk preferences; in the follow-up comparison of computed tomography (CT) lung nodules, this invention can ensure the stability of segmentation results before and after fine-tuning, preventing catastrophic degradation from interfering with follow-up judgment; in the preoperative planning of magnetic resonance imaging (MRI) brain tumors, the high-safety operating point of this invention can minimize the miscorrection of key anatomical structures during fine-tuning operations.
[0113] Based on the same inventive concept, this invention also proposes an image segmentation refinement risk dynamic gating system, comprising: The acquisition module is used to acquire the initial anchor point cue set and the corresponding initial segmentation mask of the input medical image.
[0114] The extraction module is used to perform multiple random forward propagations on the input medical image through the image encoder to obtain multiple sets of predicted probability maps; the divergence metric value of the multiple sets of predicted probability maps is calculated pixel by pixel to form a pixel-level uncertainty map.
[0115] The refinement forward inference module is used to construct narrowband candidate regions around the boundaries of the initial segmentation mask. Using a pixel-level uncertainty map and a consensus map composed of the average of multiple sets of predicted probability maps as joint guidance, a set of directional exploration cue points is generated within the narrowband candidate regions. The directional exploration cue point set and the initial anchor cue set are jointly encoded and then input into the mask decoder along with the encoder output obtained by modulating the feature increment output of the image encoder based on the pixel-level uncertainty map for refinement forward inference, resulting in the refined segmentation mask.
[0116] The risk gating decision module is used to perform risk gating decisions on the refined segmentation mask, using the global uncertainty index of the pixel-level uncertainty map as the prior circuit breaker condition and the geometric divergence of the refined segmentation mask relative to the initial segmentation mask as the a posteriori verification condition, and generate the final decision result.
[0117] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A dynamic gating method for image segmentation refinement risk, characterized in that, Includes the following steps: Obtain the initial anchor point cue set and the corresponding initial segmentation mask of the input medical image; The input medical image is subjected to multiple random forward propagations by an image encoder to obtain multiple sets of prediction probability maps; the divergence metric value of the multiple sets of prediction probability maps is calculated pixel by pixel to form a pixel-level uncertainty map. Narrow-band candidate regions are constructed around the boundaries of the initial segmentation mask. A set of directional exploration cue points is generated within the narrow-band candidate regions, using a pixel-level uncertainty map and a consensus map composed of the average of multiple sets of predicted probability maps as joint guidance. After jointly encoding the directional exploration cue point set and the initial anchor point cue set, the encoder output obtained by modulating the feature increment output of the image encoder based on the pixel-level uncertainty map is input into the mask decoder for fine-tuning forward inference to obtain the fine-tuned segmentation mask. Using the global uncertainty index of the pixel-level uncertainty map as the prior circuit breaker condition and the geometric divergence of the refined segmentation mask relative to the initial segmentation mask as the a posteriori verification condition, risk gating decision is made on the refined segmentation mask to generate the final decision result.
2. The image segmentation refinement risk dynamic gating method according to claim 1, characterized in that, The process of performing multiple random forward propagations on the input medical image using an image encoder to obtain multiple sets of predicted probability maps specifically includes the following steps: Set the randomly deactivated units interpolated in the adapter layer of the image encoder to training mode to enable random neuron dropout, and freeze the batch normalization layer to evaluation mode. Perform on input medical images K Each independent forward propagation, in which the random deactivation unit randomly discards different neurons, and the batch normalization layer uses frozen global statistics for normalization; Collect the predicted logits from each forward propagation output, and apply a sigmoid activation function to each predicted logits to obtain... K Probability plot of the next prediction.
3. The image segmentation refinement risk dynamic gating method according to claim 2, characterized in that, The step of calculating the divergence metric of multiple sets of predicted probability maps pixel by pixel to form a pixel-level uncertainty map specifically includes the following steps: Pixel-by-pixel calculation K The divergence metric of the sub-prediction probability plot is: ; in, for K The arithmetic mean of the predicted probabilities. ; It is a binary entropy function. ; For the first k Secondary forward propagation at location The predicted probability at that location; K It is an integer not less than 2; according to K The divergence metric of the predicted probability map is used to generate a pixel-level uncertainty map.
4. The image segmentation refinement risk dynamic gating method according to claim 3, characterized in that, By taking the mean value of pixels located above a preset high quantile in the pixel-level uncertainty map. As an indicator of global uncertainty: ; ; in The 95% quantile threshold is used for the pixel-level uncertainty map. The set of pixels whose divergence metric value is not lower than this threshold. This represents the number of pixels in the set.
5. The image segmentation refinement risk dynamic gating method according to claim 1, characterized in that, The encoder output obtained by modulating the feature increment output of the image encoder based on the pixel-level uncertainty map specifically includes the following steps: The pixel-level uncertainty map is downsampled to the same spatial resolution as the internal feature map of the image encoder and linearly normalized to the [0,1] interval to obtain the normalized uncertainty map; The normalized uncertainty map is input into a feature modulation network consisting of a convolutional layer followed by a cascaded S-type activation function. The convolutional layer maps the normalized uncertainty map of a single channel into a multidimensional vector with the same number of feature channels as the adapter layer. The S-type activation function compresses each element of the multidimensional vector to the (0,1) interval to generate channel-wise modulation coefficients. The channel-by-channel modulation coefficients are applied to the feature increment output of the adapter layer in each Transformer block of the image encoder, and the feature increment output is scaled channel by channel to obtain the modulated encoder output.
6. The image segmentation refinement risk dynamic gating method according to claim 1, characterized in that, The process of generating a set of directional exploration prompts within a narrow-band candidate region using a pixel-level uncertainty map and a consensus map composed of the average of multiple predicted probability maps as joint guidance includes the following steps: Morphological dilation and morphological erosion operations are performed on the initial segmentation mask respectively. The difference between the dilation result and the erosion result is taken as the positive point narrowband candidate region, and the difference between the dilation result and the initial segmentation mask is taken as the negative point narrowband candidate region. A consensus graph is obtained by taking the arithmetic mean of the multiple sets of predicted probability graphs along the sampling dimension. Within the positive point narrowband candidate region, the normalized pixel-level uncertainty map, consensus map, and positive point narrowband mask are multiplied pixel by pixel to obtain a positive point joint scoring map; within the negative point narrowband candidate region, the normalized pixel-level uncertainty map, the complementary term of the consensus map, and the negative point narrowband mask are multiplied pixel by pixel to obtain a negative point joint scoring map. Local maxima are taken from the positive point joint scoring map and the negative point joint scoring map respectively, and candidate positions with scores below a preset lower limit are filtered out to obtain a positive exploration point candidate set and a negative exploration point candidate set; After sorting the candidate points in the positive and negative exploration point candidate sets according to their scores from high to low, a minimum distance constraint is applied to each candidate point. If the Euclidean distance between the current candidate point and any selected point is less than the preset minimum distance, the candidate point is discarded; otherwise, the candidate point is adopted. After the dispersion constraint, the directional exploration prompt point set is output.
7. The image segmentation refinement risk dynamic gating method according to claim 6, characterized in that, Before generating the set of directional exploration cue points, circuit breaker protection is also included, specifically comprising the following steps: Calculate the maximum value of the normalized pixel-level uncertainty map within the candidate region of the positive point narrow band; When the maximum value is lower than the preset circuit breaker threshold, circuit breaker protection is triggered, and the generation of the directional exploration prompt point set is skipped.
8. The image segmentation refinement risk dynamic gating method according to claim 1, characterized in that, Before performing the refined forward inference, the method further includes multiplying the probability map of the initial segmentation mask pixel by pixel with the complementary term of the normalized pixel-level uncertainty map and downsampling it to construct a soft region of interest prior map as additional dense cue input to the mask decoder for performing refined forward inference.
9. The image segmentation refinement risk dynamic gating method according to claim 1, characterized in that, The geometric divergence metric includes one or more combinations of overlap consistency deviation, boundary distance degradation, or mask topology vanishing; wherein, the overlap consistency is measured using the Dice similarity coefficient, and the boundary distance is measured using the 95% Hausdorff distance; the determination criteria for the geometric divergence metric include the following three parallel checks: , , ;in, This represents the change in the Dice similarity coefficient of the mask before and after refinement. To refine the 95% Hausdorff distance variation before and after masking, The pixel area of the target region. To preset the overlap tolerance threshold, To preset the area protection benchmark value, To preset the tolerance threshold for boundary mutations, As the initial segmentation mask, For refining the segmentation mask.
10. A dynamic gating system for image segmentation refinement risk control, characterized in that, include: The acquisition module is used to acquire the initial anchor point cue set and the corresponding initial segmentation mask of the input medical image; The extraction module is used to perform multiple random forward propagations on the input medical image through the image encoder to obtain multiple sets of predicted probability maps; the divergence metric value of the multiple sets of predicted probability maps is calculated pixel by pixel to form a pixel-level uncertainty map. The forward inference module is refined to construct narrow-band candidate regions around the boundaries of the initial segmentation mask. A pixel-level uncertainty map and a consensus map composed of the average of multiple prediction probability maps are used as joint guidance to generate a set of directional exploration cue points within the narrow-band candidate regions. After jointly encoding the directional exploration cue point set and the initial anchor point cue set, the encoder output obtained by modulating the feature increment output of the image encoder based on the pixel-level uncertainty map is input into the mask decoder for fine-tuning forward inference to obtain the fine-tuned segmentation mask. The risk gating decision module is used to perform risk gating decision on the refined segmentation mask by using the global uncertainty index of the pixel-level uncertainty map as the prior circuit breaker condition and the geometric divergence of the refined segmentation mask relative to the initial segmentation mask as the a posteriori verification condition, and generate the final decision result.
