A medical image segmentation prompt box self-correction method, device, equipment and medium

By caching image features in the medical segmentation model and updating bounding boxes using an exponential moving average algorithm, the segmentation error caused by loose cue boxes is resolved, achieving efficient, training-free self-correction and improving segmentation accuracy and response speed.

CN122493055APending Publication Date: 2026-07-31SICHUAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SICHUAN UNIV
Filing Date
2026-06-01
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing medical segmentation models, when used in clinical applications, suffer from inconsistent distributions between loose cue boxes and tight cue boxes generated during training due to blurred lesion boundaries and annotation differences. This leads to oversegmentation, false background detection, and boundary drift. Current improvement solutions rely on additional training or online updates, resulting in high deployment costs and significant latency, and cannot meet the requirements for immediate response.

Method used

The image encoder caches features using a pre-trained medical segmentation model. It performs self-correction by comparing the candidate bounding boxes with the coordinate offsets suggested in the current iteration. The bounding boxes are updated using an exponential moving average algorithm, achieving smooth correction without additional training. The termination condition is that the coordinate offset is less than a threshold or the number of iterations reaches the upper limit.

Benefits of technology

It significantly improves the robustness and segmentation accuracy of medical segmentation models under loose bounding box conditions, reduces deployment costs, meets the needs of immediate clinical response, and has high computational efficiency, making it suitable for multimodal datasets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122493055A_ABST
    Figure CN122493055A_ABST
Patent Text Reader

Abstract

A self-calibration method for medical image segmentation cue boxes includes the following steps: acquiring a medical image to be segmented and initial bounding box cue boxes; encoding the medical image to be segmented using an image encoder of a pre-trained medical segmentation model to obtain image embedding features, and caching the image embedding features; generating a predicted segmentation mask using the pre-trained medical segmentation model based on the bounding box cue boxes of the current iteration and the cached image embedding features; extracting candidate bounding boxes from the predicted segmentation mask and calculating the coordinate offset between the candidate bounding boxes and the bounding box cue boxes of the current iteration; if the coordinate offset exceeds a preset threshold, updating the bounding box cue boxes and the candidate bounding boxes of the current iteration according to a weighted fusion mechanism to obtain the bounding box cue boxes of the next iteration, and returning to the step of generating the predicted segmentation mask, until a preset termination condition is met and the final segmentation mask is output.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of medical image segmentation, interactive image processing, and artificial intelligence-assisted diagnosis, specifically to a self-correction method, apparatus, device, and medium for medical image segmentation prompt boxes. Background Technology

[0002] In recent years, interactive medical image segmentation technology has been widely applied in computer-aided diagnosis and the construction of large-scale medical datasets due to its advantages such as high segmentation efficiency and strong interactivity. As the "Segment All" model has demonstrated extremely powerful cue-driven segmentation capabilities in the natural image domain, researchers have further proposed various specialized foundational models for medical image segmentation tasks, thereby promoting the development of cue-based medical image segmentation technology.

[0003] However, most existing medical segmentation models use compact bounding boxes directly generated from real masks as cue inputs during training and evaluation, with slight perturbations. In real clinical applications, due to factors such as blurred lesion boundaries and differences in annotation by different personnel, the cue boxes actually provided by users are often inaccurate and usually include a significant amount of background area. This leads to a discrepancy between the cue distribution received by the model during the testing phase and that during training, resulting in a cue distribution shift problem during testing. This technical issue easily leads to oversegmentation, false background detection, and boundary drift, thereby severely reducing the model's segmentation accuracy and practical clinical usability.

[0004] To address the aforementioned issues, existing technologies typically improve the situation by adding prompt optimization modules, offset prediction modules, multi-prompt adaptation modules, or test-time adaptive strategies. However, these solutions heavily rely on additional model network training, fine-tuning, or online parameter updates during testing, resulting in high actual system deployment costs and significant forward inference computation latency, making it difficult to meet the stringent requirements for immediate response in real-world clinical interactions. Summary of the Invention

[0005] In the field of interactive medical image segmentation, existing technologies typically rely on user-provided bounding box cues. However, in actual clinical testing, due to blurred lesion edges and differences in operator habits, the actual input bounding boxes are often loose and contain a significant amount of background. This leads to a severe discrepancy between the cue distribution during testing and the ideal compact cue distribution during training, easily causing oversegmentation, false detections of background regions, and target boundary drift. Most existing improvement solutions require adding additional dedicated deep neural network training modules or performing highly complex online parameter updates and backpropagation fine-tuning during testing. This results in high deployment costs and significant interaction latency, making it difficult to meet the stringent requirements of real-time response in clinical medicine.

[0006] In view of this, the purpose of the present invention is to provide a method, apparatus, device and medium for self-calibration of medical image segmentation prompt boxes, which can automatically, smoothly and efficiently correct the deviation of loose prompt boxes in the testing phase without any additional neural network training, model fine-tuning or parameter updates, thereby effectively improving the robustness and boundary segmentation accuracy of all medical segmentation models under loose bounding box prompt conditions.

[0007] In a first aspect, this application discloses a self-correction method for medical image segmentation cue boxes, comprising: acquiring a medical image to be segmented and initial bounding box cue boxes; encoding the medical image to be segmented using an image encoder of a pre-trained medical segmentation model to obtain image embedding features, and caching the image embedding features; generating a predicted segmentation mask using the pre-trained medical segmentation model based on the bounding box cue boxes of the current iteration and the cached image embedding features; extracting candidate bounding boxes from the predicted segmentation mask and calculating the coordinate offset between the candidate bounding boxes and the bounding box cue boxes of the current iteration; if the coordinate offset exceeds a preset threshold, updating the bounding box cue boxes and the candidate bounding boxes of the current iteration according to a weighted fusion mechanism to obtain the bounding box cue boxes for the next iteration, and returning to the step of generating the predicted segmentation mask, until a preset termination condition is met and the final segmentation mask is output.

[0008] Optionally, the pre-trained medical segmentation model is an interactive medical image segmentation basic model driven by a prompting mechanism, which specifically includes an image encoder, a prompting encoder, and a mask decoder. The pre-trained medical segmentation model is MedSAM, LiteMedSAM, SAM-Med2D, or any other medical segmentation model based on a prompting mechanism.

[0009] Furthermore, the image encoder performs a forward encoding operation on the medical image to be segmented only once before the first iteration, and directly reuses the cached image embedding features in subsequent iterations to reduce the computational overhead of the refinement process during testing.

[0010] Optionally, the construction method for extracting candidate bounding boxes from the predicted segmentation mask is as follows: calculate the minimum bounding rectangle of the target region of the predicted segmentation mask in the image coordinate system, and use the minimum bounding rectangle as the candidate bounding box; Specifically, based on the minimum bounding box marked by the real mask, while keeping the center position of the bounding box unchanged, the width and height of the bounding box are proportionally expanded according to a preset relaxation coefficient to obtain a simulated loose bounding box.

[0011] Furthermore, the update method according to the weighted fusion mechanism is as follows: using the exponential moving average algorithm, the bounding box hints of the current iteration round are weighted and summed with the candidate bounding boxes to obtain the bounding box hints for the next iteration round. The weight coefficients of the bounding box hints of the current iteration round are... Limited to a value between 0 and 1, this value is used to adjust the weighting of historical hints and current candidate bounding box information during the update process. The updated bounding box hint formula is expressed as:

[0012] in The bounding box hint for the current iteration round. This represents the newly extracted candidate bounding boxes. This indicates the bounding box hint for the next iteration.

[0013] Optionally, the termination condition is specifically: the coordinate offset is less than or equal to a preset threshold, or the current iteration count reaches the preset maximum iteration round.

[0014] Furthermore, the coordinate offset is obtained by calculating the maximum absolute difference between the four corresponding vertex coordinates between the candidate bounding box and the bounding box cue in the current iteration. The preset threshold... The size of the medical image to be segmented is dynamically determined proportionally based on the input size.

[0015] The termination condition is determined based on the maximum absolute coordinate difference between the candidate bounding box and the current bounding box prompt, and termination is determined when the following relationship is met:

[0016] in, The preset threshold is determined according to the size of the input image of the model, and satisfies... , =0.01, where H and W represent the height and width of the input image to the model, respectively.

[0017] Secondly, this application discloses a self-correcting device for medical image segmentation prompt boxes, comprising: an image encoding and caching module for acquiring a medical image to be segmented and encoding the image to be segmented in one go to cache image embedding features; a segmentation prediction module for outputting a predicted segmentation mask based on the bounding box prompts of the current iteration and the cached image embedding features; and a self-correcting iteration module for extracting candidate bounding boxes from the predicted segmentation mask, and generating bounding box prompts for the next iteration according to a weighted fusion mechanism when the coordinate offset exceeds a preset threshold to trigger a loop call of the segmentation prediction module, and stopping the loop call and outputting the final segmentation mask when a preset termination condition is met.

[0018] Thirdly, this application discloses an electronic device including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the medical image segmentation prompt box self-correction method disclosed above.

[0019] Fourthly, this application discloses a computer-readable storage medium for storing a computer program. When executed by a processor, the computer program implements the steps of the aforementioned self-calibration method for medical image segmentation prompt boxes.

[0020] As can be seen from the above technical solutions, the medical image segmentation prompt box self-correction method, device, equipment, and medium disclosed in this application have the following beneficial effects compared with the prior art: First, this solution employs a test-time closed-loop adaptive correction strategy that requires no training and no updates to weight parameters. Since it does not rely on any additional dedicated neural network training modules, nor does it require fine-tuning the model or updating parameters via online backpropagation during the test inference phase, this solution can be directly applied to various existing interactive medical segmentation models, thereby significantly reducing engineering deployment costs and demonstrating excellent cross-model generalization performance.

[0021] Secondly, this solution can significantly alleviate the problem of cue distribution offset during testing. In real-world scenarios where clinical users provide loose bounding boxes, this solution progressively tightens the cue boxes through a closed-loop correction link based on forward prediction masks. This allows the cue boxes to continuously approximate the actual lesion area, effectively reducing interference from irrelevant background features and improving the stability and boundary fit of the segmentation results.

[0022] Furthermore, this scheme incorporates an exponential moving average algorithm into the weight fusion mechanism, which balances the responsiveness and smoothness of boundary updates. Compared to a pure iterative scheme that rigidly replaces candidate box coordinates, the exponential moving average mechanism effectively suppresses large-scale back-and-forth oscillations of bounding boxes caused by local noise in a single forward prediction by preserving the trajectory inertia of historical cue boxes, thus mitigating the risk of losing target lesions.

[0023] Furthermore, this scheme boasts high computational response efficiency while also considering inference efficiency. Since the computationally intensive image encoding operation is performed only once before the first iteration, subsequent cue box refinement iterations fully reuse the same cached set of image embedding features, involving only extremely lightweight cue encoder and mask decoder calls, thus avoiding significant redundant feature extraction overhead. Experiments show that this scheme has good generalization ability on multimodal datasets; approximately 55% of clinical samples trigger early convergence and exit after an average of 4.85 iterations, demonstrating its well-suited compatibility with mainstream models such as MedSAM, LiteMedSAM, and SAM-Med2D for deployment in the medical edge. Attached Figure Description

[0024] Figure 1 This is an overall logic flowchart of a self-correction method for medical image segmentation prompt boxes disclosed in an embodiment of the present invention.

[0025] Figure 2 This is a framework diagram and workflow of a self-correction method for medical image segmentation prompt boxes disclosed in this invention.

[0026] Figure 3 This is a comparison of the visualization segmentation results of representative samples under three different imaging modalities disclosed in the embodiments of the present invention, used to demonstrate the comparison of the final mask visual effects before and after the introduction of the correction method of the present invention.

[0027] Figure 4 This is a schematic diagram illustrating the dynamic refinement process of the predicted mask in the iterative self-correction process, in which the background region gradually decreases and the boundary gradually approaches the real target region.

[0028] Figure 5 The graph shows the performance comparison of the three typical medical segmentation models disclosed in this invention on multiple datasets before and after introducing the correction method of this invention, on the Dice and Jaccard indices.

[0029] Figure 6 The three-dimensional heatmaps show the segmentation performance of different base models disclosed in the embodiments of the present invention under different maximum iteration steps and exponential moving average coefficients.

[0030] Figure 7This diagram illustrates the mechanism and sensitivity analysis of the interaction between the exponential moving average coefficient and relaxation coefficient, and other key parameters disclosed in this invention, and their ability to maintain tight-frame accuracy and correct loose-frame errors in the model. Detailed Implementation

[0031] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the relevant background and technical details. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0032] Interactive medical image segmentation technology, due to its advantages such as high segmentation efficiency and strong interactivity, has been widely applied in core scenarios such as clinical auxiliary diagnosis and the construction of large-scale medical datasets. With the SegmentAnythingModel (SAM) demonstrating extremely powerful cue-driven segmentation capabilities in the natural image domain, researchers have further proposed a series of fundamental models, such as MedSAM, LiteMedSAM, and SAM-Med2D, specifically tailored to the unique characteristics of medical images, greatly promoting the development of cue-based medical image segmentation technology. However, existing medical SegmentAnythingModels mostly use extremely tight bounding boxes directly generated from the real mask as cue input during the training and evaluation phases, with only very slight perturbations. But in real clinical applications, due to the ambiguity of lesion boundaries and differences in annotation habits among different doctors, the cue boxes manually provided by users are often not accurate enough, usually including a large amount of non-lesion background areas.

[0033] The discrepancy between the ideal compact cues during training and the actual loose cues during testing leads to a severe test-time cue distribution offset problem. This issue easily induces oversegmentation, false detections of background regions, and target boundary drift, significantly reducing the model's segmentation accuracy and clinical usability. Currently, conventional improvement techniques for addressing this problem typically involve adding extra cue optimization neural network modules, introducing dedicated offset prediction modules, or employing test-time adaptation strategies. However, these solutions heavily rely on additional training processes, require fine-tuning massive network weights, or perform backpropagation to update parameters during inference, resulting in high computational resource consumption and extremely high deployment costs, failing to meet the stringent clinical requirements for real-time interaction and zero latency. Therefore, this invention provides a completely training-free, parameter-update-free self-calibration scheme for medical image segmentation cues, which can automatically correct cue biases caused by loose bounding boxes, significantly improving the robustness and segmentation accuracy of all medical segmentation models in real-world interactive scenarios.

[0034] like Figure 1 As shown, this embodiment of the invention discloses a self-calibration method for medical image segmentation prompt boxes, including: Step S11: Obtain the medical image to be segmented and initial bounding box hints.

[0035] In this embodiment, the basic input data for the interactive image segmentation task needs to be obtained first, namely the patient's medical image to be segmented and the initial bounding box hints provided by the user or a pre-screening system. It is understandable that in real clinical interactive segmentation scenarios, when doctors select lesion areas on the screen with a mouse, the given bounding boxes often fail to perfectly fit the target edges, resulting in loose bounding boxes containing a large amount of irrelevant background information. To scientifically simulate and quantify this loose hint at the algorithm verification level, this embodiment uses a spatial expansion method to construct the initial loose bounding box hint: based on the minimum bounding box of the real lesion mask, while strictly maintaining the center coordinate position of the bounding box, the physical width and height of the bounding box are proportionally expanded according to a preset relaxation coefficient, thereby obtaining the simulated loose bounding box. Let the compact bounding box hint generated based on the real mask be... The preset relaxation coefficient is The initial loose bounding box hint It can be represented as a pair in accordance with The results of scaling up the dimensions proportionally show that as the looseness factor gradually increases, the model exhibits significant oversegmentation, illustrating the source of the technical problem addressed by this invention. The formula is: ; It should be noted that the above method of constructing bounding boxes using real masks and relaxation coefficients is only used for test set construction during the algorithm performance verification stage; in actual clinical deployment or real-time inference scenarios, the initial bounding box prompts are directly obtained and input through user GUI interaction (such as mouse selection of coordinate point pairs) or directly through the pre-screening detection model.

[0036] Specifically, the proportional expansion mapping The exact coordinate transformation logic is as follows: Let the true compact bounding box be... Its corresponding physical width is Physical height is The coordinates of the geometric center point are While maintaining the coordinates of the geometric center point Under strictly constant conditions, based on the preset relaxation coefficient The calculated initial loose bounding box The formula for mapping the coordinates of each vertex is: ; .

[0037] For example, Scenario 1: The input is an enhanced abdominal CT image with a spatial resolution of 1024 x 1024, and the objective is to segment an irregular tumor within the liver. The clinician quickly drags an initial bounding box cue onto the screen, containing the tumor and some surrounding healthy liver parenchyma. At the algorithm level, if the minimum bounding rectangle size of the actual tumor lesion is 100 x 100 pixels, then with a relaxation coefficient... With the value set to 1.30, the initial bounding box cue size is proportionally expanded to 130 by 130 pixels. Clearly, this initial bounding box inevitably includes a significant proportion of healthy tissue background beyond the actual lesion area, making it a typical loose bounding box cue.

[0038] Step S12: Use the image encoder of the pre-trained medical segmentation model to encode the medical image to be segmented to obtain image embedding features, and cache the image embedding features.

[0039] In this embodiment, after the medical image to be segmented is prepared, it needs to be converted into a high-dimensional feature representation that the model can understand. The pre-trained medical segmentation model used here is a basic interactive medical image segmentation model driven by a prompting mechanism. Its core network architecture mainly consists of three components: an image encoder, a prompting encoder, and a mask decoder. It is understandable that mainstream models in the industry, such as MedSAM and LiteMedSAM, strictly follow this architectural paradigm. When processing high-resolution medical images, the floating-point operation of the image encoder often accounts for the majority of the forward inference overhead of the entire model. The image encoder is usually a VisionTransformer architecture with an extremely large number of parameters, such as ViT-Base or ViT-Huge.

[0040] Furthermore, to completely eliminate computational bottlenecks during the iteration process, the image encoder performs a forward encoding operation only once before the first iteration on the medical image to be segmented. After completing a single feature extraction, the system directly allocates a dedicated region in GPU memory or system memory to cache the output image embedding features. In subsequent iterations aimed at correcting the cue boxes, these image embedding features are directly reused from the cache. The core advantage of this design is that, since the image encoder is in a completely frozen state and runs only once, this scheme requires no additional training and no updating of model parameters during the testing phase, achieving computational decoupling between feature extraction and cue correction. Specifically, in the computation graph configuration, the gradient calculation flags (such as the `requires_grad` attribute) of the image encoder, cue encoder, and mask decoder are globally configured to `False` to ensure that the system only performs forward propagation calculations during inference testing.

[0041] For example, in scenario 2: For the aforementioned 1024x1024 abdominal CT image, a complete Transformer forward propagation network computation is performed using the image encoder of the pre-trained MedSAM model. After computation time of approximately tens of milliseconds, the model outputs a tensor with dimensions of 1x256x64x64 as the image embedding feature and immediately stores it in the GPU's cache. In subsequent iterations of the self-correction of the pop-up boxes, the algorithm will directly retrieve this 1x256x64x64 feature tensor from the cache, completely skipping the massive ViT computation graph, thereby drastically reducing the computation time of each subsequent iteration from tens of milliseconds to the level of two or three milliseconds.

[0042] Step S13: Based on the bounding box cue and cached image embedding features of the current iteration, generate a predicted segmentation mask using a pre-trained medical segmentation model.

[0043] In this embodiment, let the current iteration round be t (in the initial state t=0), and we need to display the current bounding box of the t-th round. The input is fed into the prompt encoder of the pre-trained medical segmentation model. Specifically, the prompt encoder is responsible for mapping the two-dimensional spatial coordinates of the top-left and bottom-right corners of the bounding box into high-dimensional positional encoding vectors. Subsequently, the system feeds this positional encoding vector together with the image embedding features cached in step S12 into a lightweight mask decoder. The mask decoder typically employs a multi-layer bidirectional cross-attention mechanism, enabling high-frequency deep spatial information interaction between image features and prompt features. Specifically, the mask decoder in the pre-trained medical segmentation model directly adopts the publicly available MedSAM, LiteMedSAM, or SAM-Med2D basic model architecture. In this invention, all network weights are frozen during inference testing without performing backpropagation fine-tuning. In the bidirectional cross-attention layer inside the mask decoder, the prompt positional encoding vector output by the prompt encoder is used as the query vector (Query, abbreviated as Q), and the image embedding features cached in memory are used as the key vector (Key, abbreviated as K) and value vector (Value, abbreviated as V). This is achieved by performing a cross-attention matrix multiplication formula. (in The spatial feature map and the cue vector are deeply fused (with the feature dimension as the feature dimension). The fused feature map is then fed into a double-layer transposed convolution for upsampling to restore the resolution. Finally, it is binarized with a threshold of 0.5 after passing through the Sigmoid activation function, and the resulting single-channel predicted segmentation mask is mapped out. After multiple layers of decoding and feature upsampling, a single-channel predictive segmentation mask targeting the lesion is finally generated at the output. .

[0044] For example, in scenario 3: In the 0th iteration (i.e., when the first forward inference is triggered), the system input receives an initial loose bounding box from the doctor that contains a background of more healthy liver parenchyma. The encoder performs high-dimensional encoding on the 130x130 coordinate pairs and combines them with global CT image features before feeding them into the mask decoder. Because the initial cue box is too broad, the model suffers severe interference from edge background pixels during decoding. The final output initial predicted segmentation mask M0 exhibits a degree of oversegmentation, with some healthy liver parenchyma in edge regions being incorrectly classified as tumor foreground by the algorithm.

[0045] Step S14: Extract candidate bounding boxes from the predicted segmentation mask and calculate the coordinate offset between the candidate bounding boxes and the bounding box cue in the current iteration round.

[0046] In this embodiment, to dynamically correct the currently biased prompt box, the algorithm needs to deduce a new bounding box with a more compact spatial distribution from the forward-predicted mask. Specifically, the method for extracting candidate bounding boxes from the predicted segmentation mask is as follows: traverse the current mask... Given the coordinates of all pixels activated as foreground pixels, calculate the minimum bounding box of the target region in the global image coordinate system, and strictly define this minimum bounding rectangle as the current candidate bounding box, denoted as . If the predicted segmentation mask contains multiple disconnected foreground regions caused by noise or artifacts, then before extracting candidate bounding boxes, a connected component analysis is performed on the predicted segmentation mask, and only the connected component with the largest area is retained. The minimum bounding rectangle is calculated based on the connected component with the largest area to eliminate the interference of isolated noise on the scale of the candidate bounding boxes.

[0047] It's important to note that after extracting candidate bounding boxes, it's crucial to quantify the physical spatial difference between the current bounding box suggestion and the newly extracted candidate bounding boxes. This serves as a hard indicator of whether the model correction process has converged. Specifically, the coordinate offset is calculated by... Bounding box hints for the current iteration round It is obtained by the maximum absolute difference between the coordinates of the four corresponding vertices.

[0048] Appendix Figure 2 This paper presents a framework diagram and workflow of a self-calibration method for medical image segmentation cue boxes disclosed in this invention. Black arrows represent the data flow of the original medical image segmentation cue boxes, while yellow arrows represent the newly added data flow after the introduction of this method. Specifically, the entire system includes: an image encoding module, a cue encoding module, a mask decoding module, and a bounding box self-calibration module. Given an input medical image X, the initial loose cue is... The input image first passes through a frozen image encoder. Perform a forward encoding to obtain the cached image embedding. This allows the image feature to be reused in subsequent iterations, reducing redundant computation overhead. In the t-th iteration, the current bounding box is hinted at. Input prompt encoder And embed the cue features with the image The data is fed into the mask decoder D to obtain the predicted segmentation mask. Its expression can be represented as: Next, from the predicted segmentation mask... Extract the minimum bounding box to obtain the candidate bounding box. .

[0049] Let the bounding box cue coordinates of the current iteration be represented as follows: The coordinates of the newly extracted candidate bounding boxes are represented as follows: ,in and These represent the coordinates of the top left corner of each frame. and These represent the coordinates of the bottom right corner vertices of the two boxes. The coordinate offset between them on the image plane is also shown. The exact mathematical formula for calculating this is obtained by calculating the maximum absolute difference between the corresponding vertex coordinates:

[0050] Furthermore, the preset threshold used to measure whether the offset is acceptable is not a rigid, fixed constant, but rather dynamically and adaptively determined proportionally to the input size of the medical image to be segmented. Let the preset threshold be... It satisfies the dynamic relation. Where H and W represent the absolute number of pixels in the height and width of the input image to the model, respectively. The sensitivity scaling factor, which is set manually, is usually set to 0.01 in most medical scenarios. This dynamic scaling threshold design ensures that the method has excellent scale invariance and robustness when dealing with medical images of different resolutions, from small ultrasound images to large pathological slides.

[0051] For example, in scenario 4: during the evaluation phase of the first iteration, the current bounding box cue coordinates are (100, 100, 230, 230). Based on the minimum bounding box rule of the prediction mask in the previous step, the extracted candidate bounding box coordinates are narrowed down to (115, 105, 220, 225). The algorithm quickly calculates the absolute differences of the four coordinate pairs between the two sets of bounding boxes, which are 15, 5, 10, and 5 respectively. Then, the maximum value is extracted to obtain the maximum coordinate offset. =15 pixels. Assume the overall size of the current input image is 1024 x 1024, and the scaling factor is... =0.01, then the preset threshold is dynamically calculated by the system. =10.24 pixels (usually rounded down to 10 pixels in a discrete pixel system). Clearly, the current coordinate offset of 15 pixels exceeds the tolerance range of 10 pixels.

[0052] Step S15: If the coordinate offset exceeds the preset threshold, the bounding box cue and candidate bounding box of the current iteration are updated according to the weight fusion mechanism to obtain the bounding box cue for the next iteration, and the process returns to the step of generating the predicted segmentation mask until the preset termination condition is met and the final segmentation mask is output.

[0053] In this embodiment, the algorithm needs to perform a strict termination judgment on whether to continue to the next iteration loop. Specifically, there are two explicit termination conditions: one is the coordinate offset. Less than or equal to the preset threshold calculated above (i.e., satisfy) ≤ This indicates that the bounding box shrinkage has essentially stopped, and further iterations would yield negligible gains. Secondly, the current iteration count has reached the pre-set maximum iteration count T, a protective mechanism to prevent extreme anomalies from causing the algorithm to enter an infinite loop. When the algorithm detects that either of these conditions is met, it immediately determines that the correction process has converged, directly interrupts the iteration loop, and updates the currently generated predicted segmentation mask. The segmentation result is established as the final output.

[0054] Furthermore, when it is determined that none of the above termination conditions are met (i.e., as in scenario 4, the coordinate offset of 15 is greater than the threshold of 10, and the number of iterations has not reached the upper limit), that is... This indicates that the candidate bounding box still has significant room for boundary correction compared to the current loose cue. Therefore, a simple, crude coordinate replacement strategy is not appropriate; instead, a smooth update method based on a weighted fusion mechanism is used. Specifically, this scheme utilizes an exponential moving average algorithm to linearly weight and sum the coordinates of the bounding box cue from the current iteration with the coordinates of the newly extracted candidate bounding box, thus robustly obtaining the new bounding box cue required for the next iteration. Let the current bounding box cue in the t-th iteration be... Candidate bounding boxes are Then the bounding box hint for the next iteration into the network. It is calculated strictly according to the following exponential moving average update formula:

[0055] Among them, the historical weight coefficients of the bounding box hints in the current iteration round. Limited to the real number range of 0 to 1 (i.e.) This is used to adjust the weight ratio of historical prompts and current candidate bounding box information during the update process.

[0056] Understandably, abandoning the EMA fusion mechanism and adopting pure iterative replacement (i.e., directly assigning the candidate box to the next prompt) is equivalent to setting... While this approach is extremely rapid and sensitive to initial error correction, it is highly susceptible to severe oscillations in the bounding box coordinates during iterations due to isolated noise points remaining at the edges of early prediction masks. In severe cases, this can even lead to the complete loss of the target lesion. The EMA update mechanism of this invention introduces a method... The control's historical information damping powerfully and effectively absorbs and suppresses large jumps in coordinates, making the contraction process of the bounding box approaching the actual lesion boundary extremely smooth and stable.

[0057] In actual clinical deployment, parameters Preset threshold The maximum number of iterations T can be customized based on the input resolution and inherent predictive stability of different pre-trained base models. Specifically, the historical weight coefficient, sensitivity ratio coefficient, and maximum number of iterations are static preset input values ​​during system initialization, preset through the system configuration interface, and remain constant during the self-calibrating loop calculation process.

[0058] For example, in scenario 5, for a MedSAM model with standard parameter scale, the default input resolution is high, at 1024 x 1024. Under this configuration, the momentum coefficient is typically set... =0.6, preset threshold =10 pixels, maximum iteration count is set to T=7. Continuing from scene 4, due to the current coordinate offset... =15>10, triggering the EMA update mechanism. According to the formula... ,by The calculation is performed with a value of 0.6, resulting in the new bounding box prompt B2 coordinates for the second iteration as (106, 102, 226, 228). The system then uses this new prompt to return to step S13.

[0059] In the second iteration, the model generated a new predicted segmentation mask M2 based on B2. Since B2 has shrunk towards the lesion region, the background false positives in M2 are significantly reduced. The candidate bounding box B̃3 extracted from M2 has coordinates (112, 108, 222, 223). The coordinate offset Δ2 at this point is calculated as max(|112-106|,|108-102|,|222-226|,|223-228|) = max(6, 6, 4, 5) = 6 pixels.

[0060] Since Δ2=6≤ =10, satisfying the termination condition, the iteration converges early. The system stops iterating and outputs the currently generated predicted segmentation mask M2 as the final segmentation result.

[0061] In this example, the EMA mechanism effectively suppressed large jumps in the bounding box, allowing the cue box to smoothly shrink from (100,100,230,230) to (106,102,226,228) and then to stable convergence, without any coordinate oscillations, ensuring that the lesion target remained correctly tracked throughout. The iteration exited early after the second iteration, avoiding unnecessary computational overhead.

[0062] Depend on Figure 4 As can be seen, the original MedSAM prediction results exhibit significant oversegmentation, including a large amount of background regions; after introducing IBS-EMA, the optimized mask result is much closer to the true annotation. (Appendix) Figure 5 The refinement process of the mask during iteration is further illustrated. As the number of iterations increases, the background region in the predicted mask gradually decreases, the boundary gradually approaches the true target region, and eventually stabilizes. The visualization results above demonstrate that the method of this invention can effectively correct the segmentation error caused by loose cues without changing the model weights.

[0063] To further verify the effectiveness and universality of the method of this invention, a comparative analysis was conducted on the model segmentation performance before and after the introduction of IBS-EMA under the same backbone model conditions. (Appendix) Figure 5 The performance of three typical segmentation models—MedSAM, LiteMedSAM, and SAM-Med2D—before and after introducing IBS-EMA on multiple datasets is compared using graphs on the Dice and Jaccard metrics. The results show that, under various loosely scaled cue conditions, the proposed method significantly improves performance compared to the original model, effectively mitigating the segmentation performance degradation caused by cue distribution shift. Furthermore, the performance gain becomes more pronounced with increasing looseness coefficients, indicating good robustness even in scenarios with significant cue bias.

[0064] Furthermore, experimental results on multiple models and different modal datasets demonstrate that this invention is not limited to specific models or datasets, but exhibits good applicability and generalization ability across different medical SAM backbone networks. In other words, the method of this invention can stably provide prompts and corrections under different model structures and medical image scenarios, demonstrating strong cross-model versatility. Based on this, this invention can serve as a pluggable, test-time prompt optimization method, easily integrated into existing medical image segmentation models, thus possessing high engineering application value.

[0065] It's important to note that when dealing with lightweight deployment environments like LiteMedSAM or SAM-Med2D models, the native input resolution is typically reduced to 256 x 256. In this case, the corresponding preset threshold must be scaled down proportionally, usually set to [value missing]. =2 pixels. To address the structural jitter that is more easily generated at low resolutions, LiteMedSAM recommends configuring higher damping, i.e., =0.9, while SAM-Med2D is configurable. =0.6, and the maximum number of iterations remains unchanged at T=7. Numerous real-world medical image experimental statistics show that after introducing the EMA-based convergence self-correction mechanism proposed in this invention, up to 55.23% of clinical samples trigger the termination condition and safely exit early after an average of only 4.85 iterations. This mechanism avoids the ineffective computational waste caused by forcibly reaching the maximum of 7 iterations, perfectly achieving a trade-off between segmentation pixel accuracy and front-end inference efficiency.

[0066] As attached Figure 6 and attached Figure 7 As shown, this invention further analyzes the mechanism of action of relevant parameters. Research indicates that parameter α determines the degree to which historical prompt information is retained in the current update, directly affecting the smoothness and stability of the prompt correction process; parameter T determines the depth of prompt correction, thus affecting the model's ability to correct large deviations in prompts. Heatmaps and sensitivity experiments show that the high-performance region is mainly concentrated in the range of medium to large iteration counts, while the value of α requires a trade-off between maintaining tight-frame accuracy and loose-frame correction capability depending on the different models. These results further demonstrate that the parameter settings in this invention have a clear mechanism of action and engineering adjustability, and are not arbitrarily selected.

[0067] Based on the same inventive concept, this embodiment also naturally leads to a medical image segmentation prompt box self-correction device for performing the above method, comprising: An image encoding and caching module is used to acquire a medical image to be segmented and to encode the medical image to be segmented in one go to cache the image embedding features; The segmentation prediction module is used to output a predicted segmentation mask based on the bounding box cue for the current iteration and the cached image embedding features; The self-calibrating iterative module is used to extract candidate bounding boxes from the predicted segmentation mask, and when the coordinate offset exceeds a preset threshold, it generates bounding box hints for the next iteration according to the weight fusion mechanism to trigger the cyclic call of the segmentation prediction module. When the preset termination condition is met, the cyclic call stops and the final segmentation mask is output.

[0068] Specifically, the image encoding cache module acquires the medical image to be segmented and drives a large image encoder to perform a unique one-time forward encoding on the image, subsequently freezing the image embedding features in a high-speed cache. The segmentation prediction module operates at high frequency, rapidly outputting a predicted segmentation mask based on the input bounding box cue for the current iteration and the cached image embedding features. The self-correcting iteration module performs closed-loop monitoring, extracting extreme value candidate bounding boxes from the predicted segmentation mask and, when the dynamic coordinate offset exceeds a preset threshold, strictly generating bounding box cue for the next iteration according to an exponential moving average weight fusion mechanism, thereby automatically triggering the cyclical calls of the segmentation prediction module until convergence. It is understood that each functional module within the above device completely maps to and executes the detailed calculation steps in the aforementioned method embodiments. Its underlying operating principles and achieved technical effects have been deeply analyzed in the method section and will not be repeated here.

[0069] Furthermore, to support the physical implementation of the aforementioned algorithms and devices, embodiments of this application also provide an electronic device, including: Memory; processor; The memory stores a computer program that, when executed by the processor, implements the steps of the method as described in any of the preceding claims.

[0070] Specifically, the hardware structure includes at least a large-capacity memory and a high-performance processor. The memory non-volatilely stores a compiled computer program, which, when read and executed by the processor (such as a CPU, or more preferably an AI acceleration chip like a GPU / NPU), can flawlessly implement the complete steps of the self-correction method for medical image segmentation prompt boxes described in any of the foregoing embodiments. In reality, such electronic devices can manifest as high-performance image reading workstations in the radiology departments of major hospitals, cloud-based medical AI analysis servers, or integrated auxiliary diagnostic and treatment machines deployed at the edge of the operating room.

[0071] Furthermore, embodiments of this application also provide a computer-readable storage medium for storing a computer program, which, when executed by a processor, implements the steps of the method as described in any of the foregoing claims.

[0072] Specifically, it is a computer program instruction specifically used to store the core logic described above. When the computer program is executed by any compatible processor, it can reproduce and implement all the steps of the self-calibration method for the medical image segmentation prompt box described in any of the foregoing embodiments. The physical storage medium is diverse in form, not limited to USB flash drives and portable hard drives, but also widely encompassing various media that can circulate and store program code between different systems, such as read-only memory (ROM), random access memory (RAM), server array disks, or optical read-only optical discs.

[0073] As can be seen from the overall design of the above embodiments, this invention creatively constructs a complete and self-consistent closed-loop self-calibration process at a minimal code level, including obtaining initial loose bounding boxes, extracting and caching image features, predicting lesion masks, extracting circumscribed candidate bounding boxes, calculating spatial offsets to determine convergence, and performing EMA smoothing updates. Compared with existing test-time adaptation techniques or methods that add cumbersome additional feature calibration networks, this invention has disruptive and significant technical advantages: First, it is completely training-free, achieving true zero-parameter fine-tuning. The original gigabit-level weights of the model can be directly frozen for lightweight plug-and-play deployment, maximizing engineering applicability. Second, it boasts extremely high computational efficiency. By performing a single execution of the high-computation-density image encoder and stripping feature caching, subsequent dozens of iterations only require calling the resource-efficient prompt encoder and mask decoder, fundamentally eliminating redundant computation. Third, it cleverly utilizes a dual mechanism of exponential moving average and adaptive convergence determination, which not only smooths the geometric path of the prompt box shrinking towards the real target and eliminates the possibility of oscillation divergence, but also extremely restrains unnecessary ineffective iterative calculations. Ultimately, this invention improves the core robustness of various general medical segmentation models under harsh conditions such as loose prompts and a large amount of background tissue noise interference, as well as the final segmentation accuracy in real high-frequency clinical interaction scenarios.

[0074] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0075] The solution provided by the present invention has been described in detail above. Specific examples have been used to illustrate the principle and implementation of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation and application scope based on the idea of ​​the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A medical image segmentation bounding box self-correction method, characterized in that, Includes the following steps: Obtain the medical image to be segmented and initial bounding box prompts; The image encoder of the medical image to be segmented is used to encode the image embedding features obtained by the pre-trained medical segmentation model, and the image embedding features are cached. Based on the bounding box cue of the current iteration and the cached image embedding features, a predicted segmentation mask is generated using the pre-trained medical segmentation model; Extract candidate bounding boxes from the predicted segmentation mask and calculate the coordinate offset between the candidate bounding boxes and the bounding box cue in the current iteration round; If the coordinate offset exceeds a preset threshold, the bounding box hints and candidate bounding boxes of the current iteration are updated according to the weight fusion mechanism to obtain the bounding box hints for the next iteration, and the process returns to the step of generating the predicted segmentation mask until the preset termination condition is met and the final segmentation mask is output.

2. The method of claim 1, wherein, The pre-trained medical segmentation model is an interactive medical image segmentation basic model driven by a prompting mechanism, including: an image encoder, a prompting encoder, and a mask decoder. 3.The medical image segmentation bounding box self-correction method of claim 1, characterized in that, The image encoder performs a forward encoding operation on the medical image to be segmented only once before the first iteration, and directly reuses the cached image embedding features in subsequent iterations. 4.The medical image segmentation bounding box self-correction method of claim 1, characterized in that, The method for extracting candidate bounding boxes from the predicted segmentation mask is as follows: Calculate the minimum bounding rectangle of the target region of the predicted segmentation mask in the image coordinate system, and use the minimum bounding rectangle as a candidate bounding box.

5. The method of claim 1, wherein, The update method according to the weighted fusion mechanism is as follows: using the exponential moving average algorithm, the bounding box hints of the current iteration round are weighted and summed with the candidate bounding boxes to obtain the bounding box hints of the next iteration round. The weight coefficient of the bounding box hint in the current iteration is between 0 and 1. 6.The medical image segmentation bounding box self-correction method of claim 1, characterized in that, The termination condition is: the coordinate offset is less than or equal to a preset threshold, or the number of iterations reaches the preset maximum number of iterations.

7. The method of claim 6, wherein, The coordinate offset is obtained by calculating the maximum absolute difference between the coordinates of the four corresponding vertices between the candidate bounding box and the bounding box cue of the current iteration round; The preset threshold is dynamically determined proportionally based on the input size of the medical image to be segmented.

8. A self-calibrating device for a medical image segmentation prompt box, characterized in that, include: An image encoding and caching module is used to acquire a medical image to be segmented and to encode the medical image to be segmented in one go to cache the image embedding features; The segmentation prediction module is used to output a predicted segmentation mask based on the bounding box cue for the current iteration and the cached image embedding features; The self-calibrating iterative module is used to extract candidate bounding boxes from the predicted segmentation mask, and when the coordinate offset exceeds a preset threshold, it generates bounding box hints for the next iteration according to the weight fusion mechanism to trigger the cyclic call of the segmentation prediction module. When the preset termination condition is met, the cyclic call stops and the final segmentation mask is output.

9. An electronic device, characterized in that, include: Memory; processor; The memory stores a computer program that, when executed by the processor, implements the steps of the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium for storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 7.