An intracranial hemorrhage segmentation method based on interactive prompt segmentation
By constructing an intracranial hemorrhage segmentation framework that includes initial segmentation, interactive segmentation, and medical structure consistency refinement, and employing residual supervised learning with error region constraints and positive and negative point prompts, the trade-off between segmentation accuracy and efficiency in existing methods is resolved, achieving efficient and accurate segmentation of intracranial hemorrhage lesions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHONGQING UNIV OF TECH
- Filing Date
- 2026-05-19
- Publication Date
- 2026-07-14
AI Technical Summary
Existing medical image segmentation methods for intracranial hemorrhage segmentation involve a trade-off between segmentation accuracy and computational efficiency. Reliance on manual interaction is inefficient, and error information is not fully utilized, thus limiting the improvement of both segmentation accuracy and interaction efficiency.
We constructed an intracranial hemorrhage segmentation framework that includes initial segmentation, interactive segmentation, and medical structure consistency refinement. We adopted residual supervised learning with error region constraints and positive and negative point prompts, combined with the MSCR module to achieve accurate segmentation of the lesion region.
It achieves stable lesion segmentation in various clinical imaging scenarios, improves segmentation accuracy and efficiency, reduces manual interaction costs, and the segmentation results conform to medical structural characteristics.
Smart Images

Figure CN122391184A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical image processing and image segmentation technology, specifically to a method for segmenting intracranial hemorrhage based on interactive prompts. Background Technology
[0002] Medical image segmentation, as a crucial component of image-based clinical analysis, plays a significant role in enhancing the accuracy of disease identification, the precision of diagnostic interpretation, and the development of treatment plans. Through segmentation techniques, clinicians can extract lesion regions or regions of interest from complex medical images, enabling more intuitive visualization and quantitative analysis, thereby supporting clinical decision-making and treatment planning. The accuracy of segmentation results is particularly critical in the diagnosis and treatment of brain diseases such as intracranial hemorrhage.
[0003] Currently, medical image segmentation methods are mainly based on deep learning models, especially segmentation frameworks centered on convolutional neural networks (CNNs). Typical methods achieve good results in medical image segmentation by constructing encoder-decoder structures and combining them with skip connections to effectively fuse multi-scale features. Building on this, researchers have further enhanced the model's ability to represent key structures and complex regions by introducing attention mechanisms, dense connections, and multi-scale feature extraction strategies. However, limited by the local receptive field of convolutional operations, these methods still have shortcomings in modeling long-distance spatial dependencies, thus restricting further improvements in segmentation performance. To overcome these shortcomings, researchers have introduced medical image segmentation methods based on Transformer structures in recent years. These methods utilize self-attention mechanisms to model the relationships between different locations in the image, thereby enhancing the ability to represent global features. Simultaneously, some methods, by fusing convolutional neural networks and Transformer structures, can, to some extent, balance local details and global semantic information. However, due to the high computational complexity of self-attention mechanisms or limitations imposed by local window mechanisms, these methods still face a trade-off between segmentation accuracy and computational efficiency, limiting their widespread application in practice. Furthermore, with the development of novel network architectures, some state-space model-based methods have gradually been applied in medical image segmentation, achieving a balance between global modeling capabilities and computational efficiency to a certain extent. However, the stability and generalization ability of these methods in complex medical scenarios still need further verification.
[0004] While the aforementioned methods have made significant progress in automatic segmentation tasks, most still rely on design for specific tasks or data distributions, often requiring model retraining for different application scenarios. This not only increases data annotation costs but also limits the model's generalization ability. To reduce reliance on large-scale, finely labeled data, interactive medical image segmentation methods have gained increasing attention in recent years. These methods guide the segmentation results by introducing user prompts, enabling the model to adapt to some extent to unseen target regions. However, existing methods typically rely on frequent human interaction, resulting in low efficiency in practical applications and failing to meet the demands of efficient clinical processing. Meanwhile, general segmentation models trained on large-scale data are emerging. These models possess strong generalization capabilities, support various forms of input prompts, and demonstrate good adaptability across different visual tasks. Building on this foundation, some studies have attempted to apply general segmentation models to medical image segmentation tasks to broaden their applicability.
[0005] However, existing methods still have the following shortcomings: on the one hand, interactive prompts rely heavily on human experience or simple strategies and lack effective modeling for segmentation errors, resulting in insufficient stability of the correction process; on the other hand, error information in the automatic segmentation results is not fully utilized, making the interactive process lack specificity, thus limiting further improvement in segmentation accuracy and interactive efficiency. Summary of the Invention
[0006] To address the aforementioned technical problems, this application discloses a method for segmenting intracranial hemorrhage based on interactive prompts, comprising the following steps:
[0007] S1. Collect cranial CT medical image data, preprocess the raw image data, and divide the preprocessed data into training set, validation set and test set;
[0008] S2. Input the preprocessed cranial CT image into the automatic segmentation model, perform initial segmentation processing, and generate and output the initial segmentation mask. ;
[0009] S3. Construct an intracranial hemorrhage segmentation framework consisting of an initial segmentation stage, an interactive segmentation stage, and a medical structure consistency refinement stage connected sequentially.
[0010] S4. Combine the training set data with the initial segmentation mask obtained in S2. The segmentation framework constructed using S3 as a common input is used to perform model training and obtain the weights of the trained model.
[0011] S5. Combine the test set data with the initial segmentation mask obtained in S2. Input the trained intracranial hemorrhage segmentation model, perform inference based on the model weights obtained from S4, and output the final segmentation result of the intracranial hemorrhage lesion region.
[0012] Preferably, the preprocessing in S1 specifically includes: decomposing the three-dimensional cranial CT image into two-dimensional slices and converting them into a preset image format; performing uniform resolution resampling processing, pixel intensity normalization processing, and contrast enhancement processing on all two-dimensional images to ensure that all input images are consistent in resolution, pixel value range, and contrast, so as to ensure the consistency of input for subsequent segmentation processing.
[0013] Preferably, the automatic segmentation model in S2 uses the nnUNet network model, with the preprocessed two-dimensional image as the model input, and the initial segmentation mask is generated through inference by the nnUNet model. The initial segmentation mask This is a binary image, with dimensions represented as... ,in Represents the image height. The initial segmentation mask represents the image width. Used to provide prior structural constraints for the lesion region in the subsequent interactive segmentation phase.
[0014] Preferably, the interactive segmentation stage process is as follows: in the initial segmentation mask... Under structural constraints, obtain the input image. Initial segmentation mask punctuality reminders collection With negative point hint set The above information is input into the SAM2 segmentation model to perform interactive segmentation calculations. The calculation formula is as follows:
[0015]
[0016] in, This represents the segmentation mapping function of the SAM2 model, used to characterize the segmentation process of the SAM2 model on the input information; This represents the preprocessed input cranial CT image; Indicates the initial segmentation mask; This represents the set of point prompts used to indicate unsegmented lesion regions; This represents the set of negative tips used to suppress oversegmentation of non-lesion regions; This represents the interactive segmentation results output by the SAM2 model.
[0017] Preferably, the interactive segmentation stage employs a residual supervised learning method with error region constraints. The model uses the residual correction term of the initial segmentation result as the training objective, and combined with interactive prompts, the overall prediction process of the model is uniformly represented as follows:
[0018]
[0019] in, Indicates the initial segmentation mask; This represents the residual correction term obtained by the SAM2 model based on the initial segmentation error prediction, and ; This represents the predicted probability map output by the model; Sigmoid represents the activation function used to map the prediction results to a preset interval.
[0020] Preferably, an error-aware residual loss function is constructed during the residual supervised learning process. This is used to constrain the model to perform gradient updates and optimization learning only in the initial segmentation error region. The loss function expression is:
[0021]
[0022] in, Represents the error-aware residual loss function; This represents the element-wise multiplication operation, used to perform element-wise operations on corresponding positions in the feature map; Represents the binary cross-entropy loss function; This represents the probability plot predicted by the model. This represents the error region mask, used to distinguish between the initially correctly segmented region and the incorrect region; This represents the true mask, i.e., the standard labeling result of the lesion area; when When the corresponding pixel is in the initially correctly segmented region, this region does not participate in the loss calculation and does not generate a gradient; when When the corresponding pixel is the initial segmentation error region, this region participates in the loss calculation and generates the optimization gradient.
[0023] Preferably, the medical structure consistency refinement stage employs the MSCR module to perform structure optimization processing. The MSCR module first performs an element-wise addition initial fusion operation on the initial segmentation mask and residual correction term to obtain the initial fusion features. The fusion formula is:
[0024]
[0025] in, This represents the initial fusion feature, used to integrate initial segmentation information with residual correction information; Indicates the initial segmentation mask; This represents the residual correction term.
[0026] Preferably, the MSCR module obtains the initial fusion features. Then, the initial fusion features Compared with the initial segmentation mask Perform feature concatenation operations along the channel dimension to obtain concatenated features. The splicing formula is:
[0027]
[0028] in, This indicates a channel-dimensional concatenation operation, used to fuse different feature information along the feature channel dimension; Indicates the initial fusion features; Indicates the initial segmentation mask; This represents the features after channel splicing, used to enhance structural constraint information and feature expression capabilities.
[0029] Preferably, the MSCR module has splicing features. By sequentially performing multi-layer convolution, group normalization, and activation function processing, a structural correction term is calculated to optimize the connectivity and boundary smoothness of the lesion structure. The calculation formula is:
[0030]
[0031] in, This represents a convolution operation with a receptive field size of k×k, used to extract local neighborhood features; This represents the group normalization operation, used to stabilize feature distribution and accelerate model convergence. Represents the ReLU activation function, used to introduce nonlinear transformations to enhance the model's feature representation capabilities; This indicates the characteristics after channel splicing; This indicates a structural modification term.
[0032] Preferably, the MSCR module will include structural correction items. Inject initial fused features as residuals with learnable weights. After processing with an activation function, the final segmentation result conforming to the characteristics of medical structures is obtained. The calculation formula is:
[0033]
[0034] in, This represents the Sigmoid activation function, used to output the final segmentation probability map; Indicates the initial fusion features; This represents the learnable weight parameters used to adaptively adjust the strength of structural corrections; Indicates structural modification terms; This indicates the final segmentation result.
[0035] Compared with the prior art, the technical solution of this application has the following technical effects:
[0036] This invention constructs a complete intracranial hemorrhage segmentation framework that includes initial segmentation, interactive segmentation, and medical structure consistency refinement. It can complete the lesion segmentation processing of cranial CT images in a standardized process. The entire process relies on the preset model structure and operation logic to execute stably. It can realize the complete process from data input to lesion output without relying on complex external adjustments, ensuring the continuity and execution stability of the segmentation process. The various stages of the framework are sequentially connected and mutually supportive, and can be adapted to intracranial hemorrhage image data of different sources and forms. It can maintain a stable processing state in various clinical imaging scenarios, providing a reliable technical implementation path for the automated segmentation of intracranial hemorrhage lesions.
[0037] This invention employs a residual-supervised learning approach based on error region constraints. This allows the model to optimize only the error regions in the initial segmentation, effectively reducing invalid computations and redundant adjustments, and improving the overall efficiency of model training and inference. This learning method clearly defines the optimization range through error region masks, concentrating computational resources on the pixel regions that need correction. This avoids interference with correctly segmented regions, maintaining the stability of the existing segmentation structure. Simultaneously, the residual correction design reduces the learning difficulty of the model, allowing it to quickly focus on segmentation errors. While ensuring processing efficiency, this improves the accuracy of lesion localization and boundary characterization, making the segmentation results more closely match the actual lesion distribution.
[0038] This invention introduces a processing method combining positive and negative point prompts with a priori masks in the interactive segmentation stage. The prompts precisely guide the model's correction direction, optimizing missed and over-segmented regions without extensive manual interaction. The priori mask provides the model with lesion structure references, while the positive and negative point prompts correspond to missed lesions and misjudged areas, respectively. Their synergistic effect allows the model to quickly lock onto the correction target, reducing interactive operations while improving correction accuracy. It effectively captures small lesions and blurred boundary areas, ensuring the segmentation results fully cover the actual lesion range and improving adaptability and segmentation integrity for complex hemorrhage areas.
[0039] This invention refines the segmentation results for medical structural consistency using the MSCR module. It fuses, stitches, and models the initial segmentation information with residual correction information, optimizing the connectivity and boundary smoothness of the lesion region. The module extracts local neighborhood features through multi-layer convolution and normalization, injecting these features as residuals into the structural correction term. This avoids structural shifts caused by over-smoothing, preserving the true morphology of the lesion while improving the regularity of the segmentation results. The refined segmentation results better conform to the structural characteristics of medical images, with continuous boundaries and no internal discrete noise, providing a clear and morphologically standardized basis for lesion segmentation for clinical diagnosis and subsequent analysis.
[0040] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the preferred embodiments of this application are described in detail below with reference to the accompanying drawings.
[0041] The above and other objects, advantages and features of this application will become more apparent to those skilled in the art from the following detailed description of specific embodiments in conjunction with the accompanying drawings. Attached Figure Description
[0042] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In all drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn to scale.
[0043] Based on the description of the figures and their corresponding technical content in the document, the titles of the figures are as follows:
[0044] Figure 1 This is a schematic diagram of a segmentation method for intracranial hemorrhage based on interactive prompts.
[0045] Figure 2 This is a schematic diagram of the overall structure of the intracranial hemorrhage segmentation method of the present invention;
[0046] Figure 3 This is a schematic diagram of the Medical Structure Consistency Refinement Module (MSCR) of the present invention;
[0047] Figure 4 This is a visualization of the qualitative comparison on the spontaneous ICH dataset, based on the present invention.
[0048] Figure 5This is a visualization of qualitative comparisons on the traumatic ICH dataset, based on the present invention.
[0049] Figure 6 This is a comparison of the visualization results of the linear residual superposition and MSCR module segmentation results of the present invention. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. In the following description, specific details such as specific configurations and components are provided merely to help fully understand the embodiments of this application. Therefore, those skilled in the art should understand that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. In addition, for clarity and brevity, descriptions of known functions and structures are omitted in the embodiments.
[0051] It should be understood that the phrase "an embodiment" or "this embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "an embodiment" or "this embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.
[0052] Furthermore, reference numerals and / or letters may be repeated in different examples within this application. Such repetition is for the purpose of simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or settings discussed.
[0053] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, B exists alone, and A and B exist simultaneously. The term " / and" in this article describes another type of relationship between related objects, indicating that two relationships can exist. For example, A / and B can mean: A exists alone, and A and B exist alone. In addition, the character " / " in this article generally indicates that the related objects before and after it are in an "or" relationship.
[0054] In this article, the term "at least one" is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, "at least one of A and B" can mean: A exists alone, A and B exist simultaneously, or B exists alone.
[0055] It should also 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.
[0056] Example 1
[0057] This embodiment mainly describes a method for segmenting intracranial hemorrhage based on interactive prompts, such as... Figure 1 As shown, it specifically includes:
[0058] S1. Collect cranial CT medical image data, preprocess the raw image data, and divide the preprocessed data into training set, validation set and test set;
[0059] S2. Input the preprocessed cranial CT image into the automatic segmentation model, perform initial segmentation processing, and generate and output the initial segmentation mask. ;
[0060] S3. Construct an intracranial hemorrhage segmentation framework consisting of an initial segmentation stage, an interactive segmentation stage, and a medical structure consistency refinement stage connected sequentially.
[0061] S4. Combine the training set data with the initial segmentation mask obtained in S2. The segmentation framework constructed using S3 as a common input is used to perform model training and obtain the weights of the trained model.
[0062] S5. Combine the test set data with the initial segmentation mask obtained in S2. Input the trained intracranial hemorrhage segmentation model, perform inference based on the model weights obtained from S4, and output the final segmentation result of the intracranial hemorrhage lesion region.
[0063] Furthermore, the preprocessing of the raw data includes at least the following steps:
[0064] All images are processed into 2D slices and converted to PNG format. At the same time, the images are resampled at a uniform resolution, pixel intensity is normalized, and contrast is enhanced to ensure the consistency of input data and segmentation accuracy between different modalities.
[0065] Furthermore, S2 designed and built the ESCIF segmentation framework, specifically as follows:
[0066] The predictions generated by the automatic segmentation model are used as the initial structural prior. At the core interaction level, SAM2 is introduced in conjunction with a prior mask-driven cueing strategy, achieving low-cost error correction through a distance-transform-based hierarchical weighted sampling mechanism. At the learning objective level, residual-supervised learning with error region constraints is introduced to guide gradients to focus on key inconsistencies. At the output, a Medical Structural Consistency Refinement (MSCR) module is integrated to enhance lesion connectivity and eliminate discrete noise through joint morphological modeling of the initial mask and residual information. All modules are designed collaboratively to balance interaction efficiency, segmentation accuracy, and structural consistency. The model is implemented in Python using the PyTorch framework, completing network construction and training preparation.
[0067] ESCIF network architecture structural design Figure 2 The structure of the ESCIF network architecture is demonstrated. The overall process first uses the automatic segmentation model nnUNet to infer the image, generating an initial segmentation result, which is then used as a mask prior input to SAM2. This allows the interactive segmentation process to make constrained local corrections based on the existing structure. In the interactive phase, the model no longer directly predicts the complete segmentation result, but instead learns to correct the residuals of the initial segmentation. By explicitly modeling the error region between the initial segmentation and the ground truth annotation, the network is guided to focus on key areas such as inaccurate boundaries, missed segments, and oversegments, thereby avoiding repeated optimization of already correct regions. Building on this, a medical structure consistency refinement module is introduced after the Mask Decoder of SAM2 to jointly model the initial segmentation result and residual information. Through morphologically-aware feature fusion and residual refinement, the connectivity and boundary smoothness of the lesion region are enhanced, and discrete noise and structural fragmentation are suppressed.
[0068] In interactive segmentation tasks, prompts convey the user's prior knowledge of the segmentation results to the model. Their core function is to constrain the model's correction direction, rather than re-searching for the target. Addressing common problems in intracranial hemorrhage segmentation such as missed segmentation, over-segmentation, and inaccurate boundaries, this invention designs an interactive prompt strategy primarily based on a priori masks and supplemented by positive / negative point prompts to achieve stable segmentation correction with low interaction costs. The implementation of this interactive prompt strategy includes at least the following steps:
[0069] When the total area of the erroneous regions is less than a threshold, the segmentation result is considered to have only minor noise or boundary deviation, and no point prompts are generated to avoid unnecessary interference with the model. For samples exceeding this threshold, connected component analysis is performed on false negative and false positive regions separately. Small connected components with an area of less than 50 pixels are removed to reduce the impact of annotation noise. Then, the remaining connected components are sorted by area, with priority given to regions with more severe errors.
[0070] To address false negative regions, a distance-transform-based weighted sampling strategy is employed from the largest connected components. This involves comparing the actual annotations with the prior mask to identify two types of error regions: false negatives (FN) and false positives (FP). Subsequently, 8-neighbor connected component analysis is performed on each of these regions, and small connected components with areas below a threshold are removed to reduce the interference of annotation noise and boundary perturbations. Within each valid connected component, a distance-transform-based weighted sampling mechanism is introduced. Let the connected component be... pixel The minimum Euclidean distance to the boundary of this connected domain is defined as:
[0071]
[0072] The distance values are normalized and used as sampling probabilities to preferentially select points located at the core of the error region, forming the positive point hint set. Positive point hints are used to indicate bleeding regions missed in the initial segmentation, and are defined as follows:
[0073]
[0074] in Indicates the actual bleeding area. This represents pixels located in the actual bleeding area but not covered by the initial segmentation mask.
[0075] False positive areas are sampled for negative points in the same manner, forming a negative point cue set. Negative point cue sets are used to suppress non-hemorrhagic areas that are misclassified as foreground features, and are defined as follows:
[0076]
[0077] Then, let the input image be... The initial segmentation result is The interactive segmentation process can then be represented as:
[0078]
[0079] in This represents the segmentation function of SAM2.
[0080] The residual supervised learning design based on error region constraints provides the model with explicit spatial priors through mask priors, positive and negative hints, allowing the corrections in the interaction phase to be built upon existing segmentation results rather than searching for target regions from scratch. Simply introducing mask hints at the input level is insufficient to fully realize their value. When the initial mask quality is high, the difference between the predicted result and the true label is often concentrated in local regions. If global supervision is still applied to the complete prediction result, the model will be continuously subject to gradient constraints on a large number of correctly predicted regions, leading not only to ineffective optimization but also potentially weakening its ability to correct key error regions. This application uses a residual supervised learning method based on error region constraints to match the model's learning objective with the interaction mechanism. Under this framework, the model no longer directly predicts the complete segmentation mask but learns a residual correction term based on the initial segmentation result, focusing on local correction of missegmented regions. The residual supervised learning based on error region constraints includes the following steps:
[0081] Combining interactive prompts, the model's prediction process can be uniformly represented as:
[0082]
[0083] in, Residual correction term representing model prediction .
[0084] Based on the above definition, an error region mask is introduced to explicitly constrain the model to learn only in the regions where initial segmentation errors occur. and real mask Furthermore, an error-aware residual loss function is proposed, which has the following form:
[0085]
[0086] in, This represents element-wise multiplication. This is the binary cross-entropy loss.
[0087] The key feature of this loss function lies in the selective constraint of the error mask: pixels with a mask of zero do not participate in the loss calculation, the gradient only acts on the regions that truly need correction, and the correctly predicted regions do not generate any gradient, thereby avoiding damage to the existing structure.
[0088] As training progresses, the model gradually learns to make local corrections to the initial mask within the error region. The residual correction term gradually increases or decreases within the error region, while remaining close to zero in the correct region.
[0089] The structural design of the MSCR module, such as Figure 3The architecture of the MSCR module shown, after residual-supervised learning with error region constraints, yields relatively accurate pixel-level fusion results. However, it still lacks explicit modeling of the continuity of medical structures. The spatial relationship between the error region and the original structure, the morphological consistency of neighboring pixels, and the global connectivity implied by the initial mask are not fully utilized. Therefore, simple linear residual superposition may still cause some problems in space, such as jagged or locally discontinuous lesion boundaries, discrete pixels or holes inside, and a lack of natural transition between the correction region and the initial mask. These phenomena indicate that relying solely on residual injection is insufficient to effectively model the structural continuity and morphological consistency of medical targets. In intracranial hemorrhage segmentation tasks, lesions typically exhibit a connected, compact, and relatively smooth boundary morphology, and their semantic expression depends on local neighborhood relationships rather than isolated pixel responses. This invention proposes a Medical Structure Consistency Refinement Module (MSCR) to jointly model and morphologically constrain the initial mask and residual correction terms. The application process of building the MSCR module includes at least the following steps:
[0090] Initial fusion of the initial mask and residual correction term:
[0091]
[0092] in This represents the initial fusion characteristics, and the design provides a stable foundation for subsequent structural modeling.
[0093] Furthermore, the fusion results Compared with the initial mask Splicing is performed in the channel dimension:
[0094]
[0095] This input format enables the model to spatially distinguish between regions that need correction and regions that maintain structure, thereby reducing over-smoothing of boundaries and small lesions.
[0096] Features after splicing The input is fed into a morphological modeling network consisting of multiple convolutional layers and normalization:
[0097]
[0098] in Represents the ReLU activation function. This represents the structural refinement residual in the prediction. The above convolution process is equivalent to learning morphological consistency constraints in the local neighborhood, making the discrete responses tend to be connected, and smoothly modeling the boundaries.
[0099] To avoid structural drift caused by over-smoothing, this invention employs a residual refinement strategy, applying learnable weights to the structural correction terms. Injection of initial fusion results:
[0100]
[0101] in These are learnable parameters used to adaptively control the structure refinement intensity. This strategy maintains the stability of the initial structure while making appropriate adjustments to local regions, thereby obtaining a smoother and more connected segmentation result.
[0102] The ESCIF network architecture is implemented using the Python programming language within the PyTorch deep learning framework. PyTorch, a high-performance tensor computation library based on Python and Torch, is widely used in deep learning tasks requiring GPU and CPU collaborative computation. Compared to other frameworks such as TensorFlow and Keras, PyTorch is favored for its dynamic computation graph and high compatibility with Python, allowing developers and researchers to debug and verify model code in real time without waiting for the complete training process to check the correctness of each function.
[0103] This implementation constructs an interactive segmentation framework that integrates an automatic segmentation prior mask, an error-driven positive and negative point prompting strategy, and a medical structure consistency refinement module. It can achieve accurate segmentation of intracranial hemorrhage lesions with low manual interaction costs. It can effectively focus on the error region in the initial segmentation for local residual correction, while improving the connectivity and boundary smoothness of the lesion region, suppressing discrete noise and structural fragmentation, making the segmentation process more efficient and the segmentation results more consistent with medical structural features. It can stably adapt to a variety of complex clinical intracranial hemorrhage imaging scenarios and provide reliable support for refined clinical diagnosis.
[0104] Based on Example 1, this example details the specific implementation verification of this application, using two medical image datasets: a spontaneous ICH dataset and a traumatic ICH dataset. The spontaneous ICH dataset consists of 310 CT images (512×512 resolution, 5 mm slice thickness) from Wuxi Taihu Hospital, of which 248 were used for training and 62 for testing. The traumatic ICH dataset consists of 199 CT images from Chongqing Daping Hospital, totaling 1,479 images (1,107 for training, 181 for validation, and 191 for testing). Data preprocessing includes uniform resolution resampling, pixel intensity normalization, and contrast enhancement to ensure consistency of input data and segmentation accuracy across different modalities.
[0105] For model training, the network model was implemented using PyTorch version 1.13.0. All experiments were conducted on a single NVIDIA RTX 4090 graphics card equipped with 24GB of VRAM. For both the spontaneous ICH and traumatic ICH datasets, the training batch size was set to 8, and the number of training epochs was 400. The Adam optimizer was used, with an initial learning rate of 1e-4, supplemented by a cosine annealing learning rate scheduler. The minimum learning rate was 1e-5 to promote stable convergence during training.
[0106] This invention evaluates model performance using a validation set after every 400 training iterations. The main evaluation metrics used are Dice similarity coefficient (DSC), IoU, and Hausdorff distance (HD95), which are widely used in medical image segmentation. DSC is calculated based on the intersection-union ratio (IoU) of two segmentation sets, and its specific expression is as follows:
[0107]
[0108] Where P represents the segmented region predicted by the model, and G represents the ground truth labeled region. The DSC value represents the number of elements in the intersection of the two sets. The DSC value ranges from 0 to 1. The closer the value is to 1, the closer the segmentation result is to the true label. The closer the value is to 0, the greater the difference in the segmentation result.
[0109] The specific expression for IoU is as follows:
[0110]
[0111] The specific expression for HD95 is as follows:
[0112]
[0113] in, Let G be the set of minimum distances from P to G. It is the 95th percentile of the distance distribution.
[0114] After training, the network model parameters are frozen, and the performance of the model on unknown image segmentation is evaluated using test sets from two datasets. The evaluation metrics used are DSC and IoU. To demonstrate the advancement of the proposed ESCIF, this invention compares it with 14 baseline methods. Among them, 7 are automatic segmentation learning methods: U-Net, nnUNet, Swin-Unet, TransUNet, UNeXt, U-Mamba, and MedDINOv3; the other 7 are SAM-based interactive segmentation methods: SAM, SAM-2, MedSAM, MedSAM-2, SAMed, SAM-adapter, and Medical-SAM-adapter.
[0115] The datasets used in this invention are privately owned datasets of spontaneous ICH and traumatic ICH intracranial hemorrhage. DSC (higher is better), IoU (higher is better), and HD95 (lower is better) are used. To verify the effectiveness of ESCIF, the experiments first used the same training settings and evaluation metrics, comparing current mainstream convolutional neural networks (such as U-Net, nnU-Net) and Transformer architectures (such as Swin-Unet, TransUnet) with other emerging methods (such as U-Mamba, UNeXt, SAM, SAM-2, MedSAM, MedSAM-2, SAMed, SAM-adapter, and Medical-SAM-adapter).
[0116] The specific results are shown in Table 1. On both the spontaneous ICH and traumatic ICH datasets, the method of this invention achieved the best overall segmentation performance on both datasets, significantly outperforming existing methods in terms of segmentation accuracy. On the spontaneous ICH dataset, this method achieved 95.75% DSC and 92.18% IoU, significantly outperforming traditional medical automatic segmentation networks. On the traumatic ICH dataset, this method also performed excellently, achieving 91.99% DSC and 86.19% IoU, significantly surpassing all comparison models. Specifically, compared to nnUNet (81.80% DSC, 71.40% IoU), this method improved DSC and IoU by 10.19% and 14.79%, respectively, while significantly reducing HD95 from 13.45mm to 1.49mm, demonstrating strong robustness in the challenging segmentation scenario of traumatic brain injury. In terms of method categories, medical automatic segmentation networks perform stably in fully automated tasks, but still have certain limitations in complex boundary and multi-lesion scenarios. Although the series of methods based on SAM have been improved after domain adaptation, they are still insufficient in balancing high overlap and fine boundaries, and the performance decline is particularly obvious on the traumatic ICH dataset.
[0117] The visualization comparison results on the spontaneous ICH dataset show, for example Figure 4 As shown, in small, discretely distributed hemorrhage areas, some comparative methods exhibit significant missed detections, detecting only parts of the hemorrhage area or incorrectly merging multiple small lesions. In contrast, the proposed method can more completely identify multiple scattered small lesions, and the predicted area is more continuous and complete, indicating that the model has a stronger ability to capture fine-grained structural features.
[0118] Visual comparisons on the traumatic ICH dataset show, for example Figure 5As shown, in regions with elongated shapes and indistinct boundaries (such as the case in row 2), some methods exhibit boundary breaks or localized missing parts, resulting in discontinuous strip-like structures in the prediction results. The proposed method, however, maintains overall morphological consistency while better conforming to the actual boundaries, reducing breakage and demonstrating stronger structure preservation capabilities.
[0119] Table 1
[0120] Table 2 illustrates the effectiveness of each strategy and module. To verify the effectiveness of each strategy and module, ablation experiments were conducted on the traumatic ICH dataset, using the original SAM2 as the baseline model. Without introducing any additional strategies, the baseline DSC, IoU, and HD95 were 74.32% / 62.58% / 25.11 mm, respectively, showing significant inadequacy in segmenting complex hemorrhage areas, with particularly weak boundary accuracy. After introducing a mask prior, DSC improved to 79.52%, IoU improved to 68.96%, and HD95 decreased to 18.10 mm, indicating that the coarse segmentation mask can effectively guide the model to focus on potential lesion areas and suppress large-scale missegmentation. Further adding a residual supervised learning strategy resulted in a significant performance improvement, with DSC and IoU reaching 90.10% and 82.83%, respectively, and HD95 decreasing to 4.50 mm, demonstrating that explicitly modeling the residual information between the coarse segmentation and the true boundary helps the model achieve more accurate boundary correction in difficult-to-segment regions. Building upon this foundation, a hierarchical weighted positive / negative point suggestion strategy was introduced, further improving DSC and IoU to 91.02% and 83.76%, respectively, while reducing HD95 to 2.61 mm. This validates the stability and discriminative power of the suggestion point generation strategy based on hierarchical faulty connected components and distance-weighted sampling in scenarios with multiple lesions and large-area errors. Finally, after adding a medical structure consistency refinement module, the complete model achieved optimal performance: DSC, IoU, and HD95 reached 91.99%, 86.19%, and 1.49 mm, respectively. The gradual stacking of each module resulted in consistent performance gains, indicating a good synergistic effect within the overall framework.
[0121] Table 2
[0122] Table 3 shows the ablation results of the residual learning strategy. To verify the effectiveness and necessity of the residual supervised learning based on error region constraints in the proposed residual learning strategy, three different residual learning methods were designed for comparative experiments. First, in the No Residual setting, the model directly predicts the final segmentation mask without introducing any residual learning mechanism. At this time, the model performance is significantly limited, with DSC and IoU only 80.71% and 68.08%, respectively. This result shows that in complex lesion scenes, direct global prediction is difficult to take into account both the overall structure and local details, especially in the boundary region where large errors are easily generated. Subsequently, based on the introduction of mask prior, a simple residual addition method is used for prediction, that is, the model learns the overall residual correction on the coarse segmentation result. Compared with No Residual, the model performance is significantly improved, with DSC and IoU increasing to 90.15% and 82.34%, respectively, and HD95 decreasing to 4.10 mm. This shows that residual learning itself can effectively alleviate the difficulty of directly predicting the complete mask, allowing the model to focus more on the segmentation correction task. However, the aforementioned simple residual learning approach still imposes supervised constraints on the entire prediction region, failing to distinguish between correctly predicted and incorrect regions. This may lead to repeated optimization of the model on a large number of correctly predicted regions, thereby weakening its ability to correct key error regions. Building on this, the proposed error region-weighted residual learning strategy (+Residual) is further introduced. This strategy explicitly constrains the residual prediction and loss function through an error region mask, ensuring the model learns only in regions where initial segmentation errors occur. This strategy achieves optimal performance, with DSC and IoU reaching 91.99% and 86.19%, respectively, and HD95 significantly reduced to 1.49 mm. Compared to simple residual learning, boundary accuracy and overall consistency are further improved.
[0123] Table 3
[0124] Figure 6 This paper presents a visual comparison of the results from linear residual overlay and the MSCR module. From left to right, the images show the original CT image, the coarse segmentation result, the predicted result after residual correction, and the final result optimized by the Medical Structure Consistency Refinement (MSCR) module. It can be observed that the coarse segmentation result suffers from missing regions and insufficient detail. While residual correction restores the main regions to some extent, it still introduces local artifacts, such as isolated noise and structural discontinuities (indicated by red arrows), because residual prediction is primarily based on pixel-level independent updates. The MSCR module proposed in this invention effectively suppresses these artifacts by introducing structural consistency constraints, and enhances the spatial connectivity and morphological integrity of the segmentation results, resulting in a more compact, smoother, and more realistically anatomical structure of the lesion.
[0125] This embodiment demonstrates, through implementation and validation on spontaneous and traumatic intracranial hemorrhage datasets, that the proposed interactive segmentation framework can stably output lesion segmentation results with high consistency and high fit. It can maintain complete segmentation and accurate boundary characterization even in scenarios with complex boundaries, small lesions, and irregular morphology of hemorrhage, effectively reducing segmentation errors and boundary offsets. At the same time, it achieves efficient correction through lightweight interaction. The overall framework has significant synergistic effects among its various modules and can run stably and continuously under real clinical CT imaging conditions, fully meeting the actual clinical needs for accurate segmentation and efficient auxiliary diagnosis of intracranial hemorrhage lesions.
[0126] The above are merely preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. For those skilled in the art, the present invention can have various modifications and variations. Any changes, modifications, substitutions, integrations, and parameter changes made to these embodiments within the spirit and principles of the present invention, without departing from the principles and spirit of the present invention, through conventional substitutions or to achieve the same function, fall within the scope of protection of the present invention.
Claims
1. A method for segmenting intracranial hemorrhage based on interactive prompting, characterized in that, Includes the following steps: S1. Collect cranial CT medical image data, preprocess the raw image data, and divide the preprocessed data into training set, validation set and test set; S2. Input the preprocessed cranial CT image into the automatic segmentation model, perform initial segmentation processing, and generate and output the initial segmentation mask. ; S3. Construct an intracranial hemorrhage segmentation framework consisting of an initial segmentation stage, an interactive segmentation stage, and a medical structure consistency refinement stage connected sequentially. S4. Combine the training set data with the initial segmentation mask obtained in S2. The segmentation framework constructed using S3 as a common input is used to perform model training and obtain the weights of the trained model. S5. Combine the test set data with the initial segmentation mask obtained in S2. Input the trained intracranial hemorrhage segmentation model, perform inference based on the model weights obtained from S4, and output the final segmentation result of the intracranial hemorrhage lesion region.
2. The method according to claim 1, characterized in that, The preprocessing described in S1 specifically includes: decomposing the three-dimensional cranial CT image into two-dimensional slices and converting them into a preset image format; performing uniform resolution resampling, pixel intensity normalization, and contrast enhancement on all two-dimensional images to ensure that all input images are consistent in resolution, pixel value range, and contrast, so as to ensure the consistency of input for subsequent segmentation processing.
3. The method according to claim 2, characterized in that, The automatic segmentation model described in S2 uses the nnUNet network model, taking the preprocessed 2D image as the model input, and generating an initial segmentation mask through nnUNet model inference. The initial segmentation mask This is a binary image, with dimensions represented as... ,in Represents the image height. The initial segmentation mask represents the image width. Used to provide prior structural constraints for the lesion region in the subsequent interactive segmentation phase.
4. The method according to claim 3, characterized in that, The interactive segmentation stage involves the following steps: using the initial segmentation mask... Under structural constraints, obtain the input image. Initial segmentation mask punctuality reminders collection With negative point hint set The above information is input into the SAM2 segmentation model to perform interactive segmentation calculations. The calculation formula is as follows: in, This represents the segmentation mapping function of the SAM2 model, used to characterize the segmentation process of the SAM2 model on the input information; This represents the preprocessed input cranial CT image; Indicates the initial segmentation mask; This represents the set of point prompts used to indicate unsegmented lesion regions; This represents the set of negative tips used to suppress oversegmentation of non-lesion regions; This represents the interactive segmentation results output by the SAM2 model.
5. The method according to claim 4, characterized in that, The interactive segmentation stage employs residual supervised learning with error region constraints. The model uses the residual correction term of the initial segmentation result as the training objective, and combined with interactive prompts, the overall prediction process of the model can be uniformly represented as follows: in, Indicates the initial segmentation mask; This represents the residual correction term obtained by the SAM2 model based on the initial segmentation error prediction, and ; This represents the predicted probability map output by the model; Sigmoid represents the activation function used to map the prediction results to a preset interval.
6. The method according to claim 5, characterized in that, The residual supervised learning process constructs an error-aware residual loss function. This is used to constrain the model to perform gradient updates and optimization learning only in the initial segmentation error region. The loss function expression is: in, This represents the error-aware residual loss function; This represents the element-wise multiplication operation, used to perform element-wise operations on corresponding positions in the feature map; This represents the binary cross-entropy loss function; This represents the probability plot predicted by the model. This represents the error region mask, used to distinguish between the initially correctly segmented region and the incorrect region; This represents the true mask, i.e., the standard labeling result of the lesion area; when When the corresponding pixel is in the initially correctly segmented region, this region does not participate in the loss calculation and does not generate a gradient; when When the corresponding pixel is the initial segmentation error region, this region participates in the loss calculation and generates the optimization gradient.
7. The method according to claim 6, characterized in that, The medical structure consistency refinement stage employs the MSCR module for structure optimization. The MSCR module first performs an element-wise addition initial fusion operation on the initial segmentation mask and residual correction terms to obtain the initial fusion features. The fusion formula is: in, This represents the initial fusion feature, used to integrate initial segmentation information with residual correction information; Indicates the initial segmentation mask; This represents the residual correction term.
8. The method according to claim 7, characterized in that, The MSCR module obtains the initial fusion features. Then, the initial fusion features Compared with the initial segmentation mask Perform feature concatenation operations along the channel dimension to obtain concatenated features. The splicing formula is: in, This indicates a channel-dimensional concatenation operation, used to fuse different feature information along the feature channel dimension; Indicates the initial fusion features; Indicates the initial segmentation mask; This represents the features after channel splicing, used to enhance structural constraint information and feature expression capabilities.
9. The method according to claim 8, characterized in that, The MSCR module provides splicing features. By sequentially performing multi-layer convolution, group normalization, and activation function processing, a structural correction term is calculated to optimize the connectivity and boundary smoothness of the lesion structure. The calculation formula is: in, This represents a convolution operation with a receptive field size of k×k, used to extract local neighborhood features; This represents the group normalization operation, used to stabilize feature distribution and accelerate model convergence. Represents the ReLU activation function, used to introduce nonlinear transformations to enhance the model's feature representation capabilities; This indicates the characteristics after the channels are spliced together; This indicates a structural modification term.
10. The method according to claim 9, characterized in that, The MSCR module will include structural correction items. Inject initial fused features as residuals with learnable weights. After processing with an activation function, the final segmentation result conforming to the characteristics of medical structures is obtained. The calculation formula is: in, This represents the Sigmoid activation function, used to output the final segmentation probability map; Indicates the initial fusion features; This represents a learnable weight parameter used to adaptively adjust the strength of structural corrections; Indicates structural modification terms; This indicates the final segmentation result.