Shape prior-based myocardial segmentation model optimization method and system, and storage medium
By constructing a multi-task collaborative segmentation optimization framework and combining shape consistency loss and image similarity loss, the myocardial segmentation model is optimized, solving the segmentation accuracy and coherence problems caused by shape variability in cardiac image segmentation in existing technologies, and achieving higher segmentation accuracy and stability.
Patent Information
- Application Number
- CN202510853429.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-24
- Publication Date
- 2025-10-21
AI Technical Summary
Existing deep learning-based image segmentation methods struggle to effectively capture global structural information when processing heart images with complex and varied shapes, resulting in insufficient segmentation accuracy and regional coherence. This is especially true in myocardial segmentation of heart images, where a single shape prior is insufficient to account for the diverse shapes of the target object.
By constructing a multi-task collaborative segmentation optimization framework, combining a pre-trained shape encoding module and a myocardial segmentation model, and introducing shape consistency constraints, the myocardial segmentation model is optimized by using joint optimization of shape consistency loss and image similarity loss. Multiple discriminative shape features are extracted as prior information to enhance the model's ability to perceive the structure of the target object's morphology.
The segmentation accuracy of the myocardial segmentation model in terms of edge detail fidelity and regional coherence has been improved. It can effectively handle heart images with different shapes and improve the stability and accuracy of the segmentation results.
Smart Images

Figure CN120823385A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to an optimization method and system for a myocardial segmentation model based on shape prior. Background Art
[0002] Image segmentation, a key task in computer vision and medical image analysis, is extremely important in practical applications, especially myocardial segmentation in cardiac images. Although deep learning-based image segmentation methods have made significant progress in pixel-level prediction, they still face many challenges when dealing with objects with complex and varied shapes. This is because in real-world scenarios, the shapes of target objects are often highly diverse and unstable due to interference from factors such as perspective, scale, deformation, and background noise. This makes it difficult for image segmentation methods that rely solely on pixel-level supervision to fully capture global structural information, which in turn affects segmentation accuracy and regional coherence.
[0003] To address these issues, shape priors, as an effective auxiliary information, have gradually attracted academic attention. Shape priors can provide segmentation models with constraints on the global geometric structure of the target object, thereby improving the accuracy of segmentation results. However, current research on shape priors is largely limited to using a single target shape (such as a ring) for image segmentation. The variability of target object shapes makes it difficult for a single feature map to account for all possible structural patterns.
[0004] For cardiac images to be segmented, how to automatically extract multiple discriminative shape features from massive and diverse target objects as prior information to assist image segmentation is one of the key issues that needs to be solved urgently. Summary of the Invention
[0005] In view of this, an embodiment of the present invention provides an optimization method and system for a myocardial segmentation model based on shape prior, which enhances the structural perception ability of the myocardial segmentation model of the target object morphology, and can automatically extract multiple discriminative shape features from massive and morphologically diverse cardiac images to be segmented as prior information to assist image segmentation.
[0006] One aspect of the present invention provides a method for optimizing a myocardial segmentation model based on shape prior, the method comprising the following steps:
[0007] Acquire an original cardiac image to be segmented, perform a mask operation on the acquired original cardiac image to obtain a true myocardial mask map, and input the acquired original cardiac image into a myocardial segmentation model to be optimized, and output a myocardial prediction probability map;
[0008] The true myocardial mask map and the myocardial prediction probability map are respectively input into the pre-trained shape encoding module, and the shape features corresponding to the true myocardial mask map and the myocardial prediction probability map are output. The shape consistency loss is calculated using the output shape features;
[0009] The myocardial segmentation model to be optimized is updated based on the shape consistency loss to obtain an optimized myocardial segmentation model.
[0010] In some embodiments of the present invention, the pre-trained shape coding module is obtained by training the encoding and decoding model through a low-dimensional encoding operation to obtain an initial shape coding module, and training the initial shape coding module through an alternating optimization operation to obtain a pre-trained shape coding module;
[0011] The alternating optimization operation performs the following steps:
[0012] Obtaining shape features: inputting multiple myocardial mask image training samples into the shape encoding module currently being trained, and outputting the shape features corresponding to each myocardial mask image training sample;
[0013] Shape feature clustering: clustering the shape features corresponding to each myocardial mask training sample to obtain cluster assignment results, so that the shape encoding module currently being trained can be updated based on the cluster assignment results and the pre-set cluster optimization target;
[0014] The steps of obtaining shape features and clustering shape features are repeated until a clustering stop condition is reached, and the shape encoding module in current training is used as a pre-trained shape encoding module.
[0015] In some embodiments of the present invention, clustering the shape features corresponding to each myocardial mask image training sample includes: clustering the shape features corresponding to each myocardial mask image training sample once using a K-means clustering algorithm;
[0016] The preset clustering optimization objective is to minimize the sum of the Euclidean distances between the shape features corresponding to all myocardial mask training samples and the cluster centers of the clusters to which they belong; and
[0017] The number of cluster centers included in the cluster assignment result is determined by the elbow method.
[0018] In some embodiments of the present invention, the myocardial segmentation model to be optimized is updated based on the shape consistency loss, including: calculating a joint loss based on image similarity loss and shape consistency loss, and updating the myocardial segmentation model to be optimized according to the joint loss; wherein the image similarity loss is obtained by comparing the similarity between the true myocardial mask map and the myocardial prediction probability map.
[0019] In some embodiments of the present invention, calculating the joint loss based on the image similarity loss and the shape consistency loss includes: obtaining the joint loss by performing weighted calculation on the image similarity loss and the shape consistency loss.
[0020] In some embodiments of the present invention, the initial shape encoding module is an encoder included in a pre-trained autoencoder; wherein the autoencoder is an encoding-decoding model;
[0021] The autoencoder is trained by performing the following low-dimensional encoding operation:
[0022] Inputting the myocardial mask image training sample into the encoder of the autoencoder to be trained, outputting the shape features corresponding to the myocardial mask image training sample, and using the shape features output by the encoder of the autoencoder to be trained as the input of the decoder of the autoencoder to be trained, outputting the reconstructed mask image corresponding to the myocardial mask image training sample;
[0023] An image reconstruction loss is calculated based on the myocardial mask training samples and the corresponding reconstructed mask image, so that the autoencoder to be trained is updated based on the image reconstruction loss, thereby obtaining a pre-trained autoencoder.
[0024] In some embodiments of the present invention, the myocardial segmentation model adopts a U-Net architecture;
[0025] Image similarity loss is mean square error loss, cross entropy loss or Dice loss;
[0026] The original cardiac image is a cardiac CT image that has been preprocessed by windowing and normalization.
[0027] Another aspect of the present invention provides an optimization system for a myocardial segmentation model based on shape prior, comprising a processor, a memory, and a computer program / instruction stored in the memory, wherein the processor is used to execute the computer program / instruction, and when the computer program / instruction is executed, the system implements the steps of the method described in any of the above embodiments.
[0028] Another aspect of the present invention provides a computer-readable storage medium having a computer program / instruction stored thereon, which implements the steps of the method described in any of the above embodiments when executed by a processor.
[0029] Another aspect of the present invention provides a computer program product, comprising a computer program / instruction, which implements the steps of the method described in any one of the above embodiments when executed by a processor.
[0030] The present invention proposes a method and system for optimizing a myocardial segmentation model based on shape priors. This system combines a pre-trained shape encoding module that can output shape prior information with a myocardial segmentation model to construct a multi-task collaborative segmentation optimization framework. In this framework, in addition to conventional losses, shape consistency constraints are introduced into the optimization of the myocardial segmentation model. By designing an appropriate feature alignment loss, the hidden representation of the myocardial segmentation model can be matched with the global shape distribution reflected by the shape encoding module. The method proposed in this application can automatically extract multiple discriminative shape features from a large number of morphologically diverse cardiac images to be segmented as prior information to assist in image segmentation. This allows the optimized myocardial segmentation model to have significant advantages in terms of edge detail fidelity and regional coherence.
[0031] Additional advantages, objects, and features of the present invention will be set forth in part in the following description and will become apparent to those skilled in the art upon examination of the following or may be learned from practice of the present invention. The objects and other advantages of the present invention may be realized and obtained by the structures particularly pointed out in the description and drawings.
[0032] Those skilled in the art will understand that the purposes and advantages that can be achieved by the present invention are not limited to the above specific descriptions, and the above and other purposes that can be achieved by the present invention will be more clearly understood based on the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of this application, and do not constitute a limitation of the present invention. In the drawings:
[0034] Figure 1 4 is a flow chart of a method for optimizing a myocardial segmentation model based on shape priors in one embodiment of the present invention.
[0035] Figure 2 FIG. 4 is a flow chart of a method for optimizing a myocardial segmentation model based on shape prior in another embodiment of the present invention.
[0036] Figure 3 FIG. 1 is a schematic diagram of a typical encoder-decoder architecture according to an embodiment of the present invention.
[0037] Figure 4 Schematic diagram of an alternating optimization framework for learning and clustering in one embodiment of the present invention.
[0038] Figure 5 Schematic diagram of comparison between the original input image and the reconstructed image of the autoencoder in one embodiment of the present invention.
[0039] Figure 6 FIG. 4 is a graph showing how the sum of squared errors changes with the number of clusters in one embodiment of the present invention.
[0040] Figure 7 This is a diagram showing the effect of K-Means clustering of low-dimensional features extracted from the initial encoding module in the alternating optimization stage in one embodiment of the present invention.
[0041] Figure 8 The figure is a histogram of the Dice similarity coefficient of the myocardial segmentation model on the test set under different hyperparameters α in one embodiment of the present invention.
[0042] Figure 9 Schematic diagram of a loss curve in one embodiment of the present invention.
[0043] Figure 10 Schematic diagram comparing the true mask image of the myocardium, the segmentation result of the baseline model, and the segmentation result of the optimized model in one embodiment of the present invention. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments and the accompanying drawings. Here, the exemplary embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0045] It should also be noted that, in order to avoid obscuring the present invention due to unnecessary details, the accompanying drawings only show structures and / or processing steps closely related to the solutions according to the present invention, while other details that are not closely related to the present invention are omitted.
[0046] It should be emphasized that the term "include / comprises" when used herein refers to the existence of features, elements, steps or components, but does not exclude the existence or addition of one or more other features, elements, steps or components.
[0047] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. In the accompanying drawings, the same reference numerals represent the same or similar components, or the same or similar steps.
[0048] Shape prior has gradually received attention in the field of image segmentation, but current research on cardiac image segmentation based on shape prior is mostly limited to a single shape, and it is difficult to take into account all possible structural patterns. In order to solve the challenges brought by the shape variability of the target object in the image to be segmented, this application proposes an optimization method for a myocardial segmentation model based on shape prior (hereinafter the myocardial segmentation model may also be referred to as the segmentation model). Low-dimensional feature learning is performed in the pre-training stage, and a pre-trained shape encoding module that can generate shape prior information is constructed in combination with a clustering algorithm. Furthermore, in the model optimization stage, the shape prior information output by the pre-trained shape encoding module is introduced into the segmentation model through shape consistency constraints, thereby realizing the effective fusion of global structural information and pixel-level prediction through multi-task collaborative optimization. This application aims to solve the problems of insufficient shape fidelity and blurred boundaries of existing segmentation models in scenarios where the shape structure of the target object is complex and the diversity is significant.
[0049] The initial shape coding module and pre-trained shape coding module mentioned in this application refer to coding modules with different model parameters obtained at different training stages under the same network architecture. Specifically, in the low-dimensional coding training stage, low-dimensional coding operations are performed to obtain the initial shape coding module by training a complete coding-decoding model (also referred to as the coding-decoding model, which is used to represent the model before the low-dimensional coding operation is performed); in the alternating optimization stage, alternating optimization operations are performed to iteratively train the initial shape coding module through a clustering algorithm to ultimately obtain the pre-trained shape coding module.
[0050] Figure 1 FIG. 1 is a flow chart of an optimization method for a myocardial segmentation model based on shape priors in one embodiment of the present application. Figure 1 As shown, the method includes steps S110 to S130.
[0051] Step S110: obtaining an original cardiac image to be segmented, performing a mask operation on the obtained original cardiac image to obtain a true myocardial mask map, and inputting the obtained original cardiac image into a myocardial segmentation model to be optimized to output a myocardial prediction probability map.
[0052] As an example, the original cardiac image to be segmented in the present application may be an original image obtained through imaging examinations such as a cardiac CT (Computed Tomography) image or a cardiac MRI (Magnetic Resonance Imaging) image. Moreover, the original cardiac image to be segmented must contain the target object to be segmented, that is, the original cardiac image obtained is an image containing a complete heart part (the target object in the image to be segmented in the present application refers to the myocardial part of the heart). In addition, the myocardial segmentation model can adopt an image segmentation model of any existing architecture (such as MaskR-CNN, PSPNet or U-Net architecture).
[0053] In this application, masking operation refers to covering or blocking the original cardiac image to be segmented (i.e., controlling the area of image processing); and the myocardial segmentation model can use segmentation masking technology to separate different objects in the image and generate corresponding binary or multi-valued images. Since the two have the same purpose, the performance of the myocardial segmentation model can usually be optimized by comparing the true myocardial mask image and the myocardial prediction probability map obtained by the masking operation. Among them, the myocardial prediction probability map can also be called a likelihood map, which is used to represent the probability that each pixel in the image output by the segmentation model is predicted to be the foreground, such as Figure 2 As shown, the foreground area in the likelihood map can be set to white and the background area to black. It is worth noting that in order to facilitate the calculation of the subsequent loss function, the pixel values of the image obtained by the mask operation and the image output by the myocardial segmentation model in this application must be consistent. For example, if the myocardial segmentation model is a binary segmentation model, the mask processing is a binary mask.
[0054] like Figure 2 As shown, taking the myocardial segmentation model using the U-Net architecture as an example, and setting the foreground area to white and the background area to black, this application can input the acquired original cardiac image into the myocardial segmentation model to be optimized. The myocardial segmentation model generates a pixel-level prediction probability map P through structures such as multi-layer convolution and upsampling; the true myocardial mask map G can be obtained by performing a mask operation on the acquired original cardiac image.
[0055] Step S120: Input the true myocardial mask map and the myocardial prediction probability map into the pre-trained shape coding module for encoding respectively, and output the shape features corresponding to the true myocardial mask map and the shape features corresponding to the myocardial prediction probability map. The shape consistency loss is calculated using the shape features corresponding to the true myocardial mask map and the shape features corresponding to the myocardial prediction probability map.
[0056] The present application can combine the pre-trained shape coding module and the segmentation model to construct a multi-task collaborative segmentation optimization framework, wherein the pre-trained shape coding module has a strong ability to capture the intrinsic structure of the target object shape. Therefore, the pre-trained shape coding module in the present application can stably extract discriminative shape features, and the shape features extracted by the pre-trained shape coding module can constitute shape prior information, and further introduce the shape prior information that can reflect the potential and stable morphological patterns in the data into the myocardial segmentation model to be optimized, which can improve the segmentation accuracy of the myocardial segmentation model.
[0057] More specifically, in order to organically integrate shape prior information into the myocardial segmentation model to be optimized, this application additionally designs a shape consistency loss to achieve a balance between pixel-level supervision and shape prior constraints. Figure 2 As shown in Figure 2, by inputting the predicted probability map P and the true myocardial mask map G into the pre-trained shape coding module respectively, the pre-trained shape coding module can map P and G to the same low-dimensional space respectively, thereby obtaining the corresponding low-dimensional shape feature H P and H G . Due to H P and H G It is obtained through similar processing, and the shape consistency loss is calculated using the shape features corresponding to the real myocardial mask map and the shape features corresponding to the myocardial prediction probability map, including: comparing the shape features corresponding to the real myocardial mask map and the shape features corresponding to the myocardial prediction probability map, and calculating H P and H G The shape consistency loss between them is used to provide shape prior constraints for the segmentation results.
[0058] As an example, the mean square error (MSE) can be used to measure H P and H G The gap between them, at this time the shape consistency loss L align It can be defined as follows:
[0059]
[0060] Where D is H P and H G The dimension, H P (d) and H G (d) Represents the shape feature vector H P and H G The value of the dth dimension in .
[0061] The above H P and H GThe mean square error between the two is only an example of shape consistency loss. Other indicators such as root mean square error or mean absolute error can also be used to measure H P and H G The shape consistency loss between them is not limited to this.
[0062] Step S130: updating the myocardial segmentation model to be optimized based on the shape consistency loss, and obtaining an optimized myocardial segmentation model through iterative training.
[0063] In some embodiments of the present invention, the myocardial segmentation model to be optimized is updated based on the shape consistency loss, including: calculating a joint loss based on image similarity loss and shape consistency loss, and adjusting the parameters of the myocardial segmentation model according to the joint loss, thereby updating the myocardial segmentation model to be optimized.
[0064] More specifically, to ensure that the pixel-level segmentation results of the myocardial segmentation model have a high degree of overlap with the actual annotated true myocardial mask image, an image similarity loss is usually set to measure the similarity between the true myocardial mask image and the myocardial prediction probability map, to ensure that the output of the segmentation model matches the true myocardial mask image at a local level. This is a conventional loss typically set in the optimization training of existing segmentation models. For example, the image similarity loss can be mean square error loss, cross entropy loss, or Dice loss, etc. This application does not specifically limit the function used for the image similarity loss.
[0065] As an example, a joint loss is calculated based on the image similarity loss and the shape consistency loss, including: performing weighted calculation on the image similarity loss and the shape consistency loss to obtain the joint loss. The weight of the image similarity loss and the weight of the shape consistency loss can be determined as follows:
[0066] The weight values of multiple image similarity losses and the weight values of multiple shape consistency losses are set to obtain weight value combinations of multiple image similarity losses and shape consistency losses; the image similarity loss and shape consistency loss are calculated based on the myocardial training sample (including the heart image used for training and the mask map of the corresponding myocardial part), and multiple joint losses are calculated according to the multiple weight value combinations, and the segmentation models to be optimized are trained based on the calculated joint losses, so as to obtain multiple converged segmentation models through iterative training; the heart images in the myocardial test sample (including the heart image used for testing and the mask map of the corresponding myocardial part) are input into each converged segmentation model respectively, and the corresponding myocardial prediction probability map is output, and the similarity between the mask map of the myocardial part in the myocardial test sample and the corresponding myocardial prediction probability map is calculated, and the weight value combination corresponding to the converged segmentation model with the highest similarity is used as the weight for calculating the joint loss when optimizing the myocardial segmentation model.
[0067] For example, considering the image similarity loss and shape consistency loss, the total loss function in the overall optimization process of the myocardial segmentation model can be designed as:
[0068] L total (P,G)=L Dice (P,G)+αL align (H P ,H G );
[0069] Here, α is a hyperparameter that regulates the balance between pixel-level supervision and global shape alignment constraints.
[0070] More specifically, in order to objectively determine the optimal weight α of the shape consistency loss in the total loss, the hyperparameter α can be determined in the following way: set multiple values of α, input the heart image used for training in the myocardial training sample into the multi-task collaborative segmentation optimization framework composed of the myocardial segmentation model (which can be the myocardial segmentation model to be optimized) and the pre-trained shape coding module, calculate the image similarity loss in this step based on the image output by the myocardial segmentation model and the mask image of the corresponding myocardial part in the myocardial training sample, and calculate the shape consistency loss in this step based on the shape prior features output by the pre-trained shape coding module; use the calculated image similarity loss and shape Consistency loss, by setting multiple α values to calculate the joint loss corresponding to multiple α values, and based on the calculated joint loss, respectively train the myocardial segmentation models to be optimized, thereby obtaining converged myocardial segmentation models corresponding to multiple α values; the heart images in the myocardial test sample are respectively input into each converged myocardial segmentation model, and the myocardial prediction probability map corresponding to each myocardial segmentation model is output, and based on the similarity between the mask map of the myocardial part in the myocardial test sample and the corresponding myocardial prediction probability map (for example, the Dice similarity coefficient indicator is used to evaluate the similarity), the α value corresponding to the myocardial segmentation model with the highest similarity is used as the weight for calculating the joint loss in the model optimization stage.
[0071] In the model optimization stage, this application designs a multi-task optimization strategy based on feature alignment, and the optimized myocardial segmentation model can be obtained through steps S110 to S130. Specifically, this application can use the shape prior output by the pre-trained shape encoding module as a supervisory signal and combine it with the traditional pixel-level loss (such as Dice) as the total loss function. By introducing constraints on the potential representation during the model optimization process, the myocardial segmentation model is promoted to learn the structural consistency of the anatomical morphology during the generation stage, especially in areas with complex shapes and ambiguous structures, which significantly enhances the expressiveness and robustness of the model.
[0072] In some embodiments of the present invention, before executing the model optimization stage, the present application may obtain a pre-trained shape coding module through iterative training in the pre-training stage, and the pre-training stage may be divided into a low-dimensional coding training stage and an alternating training stage. Specifically, in the low-dimensional coding training stage, the input myocardial mask map training sample (including the mask map of the myocardial part used for training) may be used to train the pre-set complete encoding and decoding model, so that the encoder in the complete encoding and decoding model learns a more comprehensive low-dimensional representation method, thereby obtaining an initial shape coding module; in the alternating training stage, the initial shape coding module is used to extract features, and the initial shape coding module is updated by clustering the low-dimensional features extracted from the initial shape coding module, and finally the pre-trained shape coding module is obtained through iterative training.
[0073] ① Low-dimensional coding training stage
[0074] The complete encoding-decoding model includes an encoding model for extracting feature representations from input data and a decoding model for reconstructing the input data using the extracted feature representations. For shape prior modeling, the role of the complete encoding-decoding model is: (1) Feature dimensionality reduction and denoising: The encoding model is used to map the target shape to a low-dimensional feature space, filtering out some noise information in the process while extracting the global structural features of the target; (2) Structure preservation: The reconstruction loss is used to ensure that the latent representation has sufficient expressive power, so that the low-dimensional features can effectively describe the shape characteristics of the input data; (3) Adaptive learning: During the unsupervised training process, the complete encoding-decoding model can adaptively learn the variable shape structures contained in the data, which is particularly critical for datasets with large morphological differences between different samples.
[0075] As an example, the initial shape encoding module can be the encoder included in a pre-trained autoencoder. An autoencoder is a typical unsupervised representation learning model consisting of an encoder and a decoder. The encoder in the autoencoder maps high-dimensional input data to a low-dimensional latent space, while the decoder in the autoencoder reconstructs the original data based on the low-dimensional representation output by the encoder. The following describes the training process of the low-dimensional encoding training phase, using the autoencoder as an example of a complete encoding-decoding model.
[0076] An autoencoder is usually composed of an encoder f θ (·) and decoder By training the autoencoder, an initial shape encoding module with strong feature learning ability can be obtained. The training goal of the autoencoder can be to minimize the error between the input data and the reconstructed data. For the input shape data X∈R d, the forward propagation process of the autoencoder can be described as:
[0077] H=f θ (X)=σ(W e X+b e );
[0078]
[0079] Where H∈R k is the encoder f θ (·) is the low-dimensional embedding representation extracted from X, k<<d; σ(·) is the activation function (such as ReLU, etc.); θ={W e ,b e}and are the encoder and decoder parameters (bias and weights) respectively; For decoder The shape data reconstructed based on feature H.
[0080] Based on the above forward propagation process, in the process of training the autoencoder, X and The mean square error is used as the reconstruction loss function To update the parameters in the autoencoder:
[0081]
[0082] Among them, N represents the number of myocardial mask training samples, X i and Represents X and Similar to the shape consistency loss, the image reconstruction loss can also be calculated using other indicators to measure the relationship between X and The gap between them is enough.
[0083] In some embodiments of the present invention, the autoencoder can be trained by performing the following low-dimensional encoding operation: inputting the myocardial mask map training sample into the encoder of the autoencoder to be trained, outputting the shape features corresponding to the myocardial mask map training sample, and using the shape features output by the encoder of the autoencoder to be trained as the input of the decoder of the autoencoder to be trained, outputting the reconstructed mask image corresponding to the myocardial mask map training sample; calculating the image reconstruction loss based on the myocardial mask map training sample and the corresponding reconstructed mask image, so that the autoencoder to be trained is updated based on the image reconstruction loss, thereby obtaining a pre-trained autoencoder through iterative training. This training method enables the model to effectively retain the global shape information of the target while reducing the dimensionality and eliminate irrelevant noise.
[0084] Further, if Figure 3As shown, the complete encoding and decoding model mentioned in this application can adopt a typical encoder-decoder architecture. In the encoding model part, a multi-layer convolutional network is first used to extract features from the input mask image. Each layer undergoes batch normalization (BatchNorm) and ReLU activation, and is combined with attention modules (including channel attention and spatial attention) to strengthen the weights of key areas and channels; then a maximum pooling operation is performed to reduce the spatial size of the input image accordingly (for example, 512×512→256×256); finally, the feature map is unified into a smaller fixed size through adaptive average pooling, and after flattening, it is mapped to a low-dimensional latent space through a fully connected layer. In the decoding model part, the low-dimensional code H is first remapped to a high-dimensional feature representation through a fully connected layer, and then gradually upsampled through multiple transposed convolutional layers until an image consistent with the original input size is reconstructed. Finally, a Sigmoid activation function is used to ensure that the output range meets the requirements of the image grayscale data.
[0085] The above-mentioned complete encoding and decoding model is an autoencoder and the complete encoding and decoding model adopts a typical encoder-decoder architecture. It is only an example that can realize the feature extraction of the encoding model and the reconstruction of the decoding model. The present invention is not limited to this.
[0086] ②Alternating training phase
[0087] The initial shape encoder obtained in the low-dimensional encoding training phase can be used to extract the low-dimensional shape features of the target object from the mask image, but the embedding space generated by the above encoding model may not have an obvious cluster structure. Therefore, in order to solve the modeling difficulty problem caused by the diverse and large changes in target shapes in real application scenarios, this application further proposes a method of alternating optimization of representation learning and unsupervised clustering, that is, based on the principle of "good representation is conducive to clustering, and clustering is representation learning", so that the global structural information of the target shape is incorporated into the segmentation model in a priori form, thereby improving the stability and accuracy of the segmentation results. Specifically, the core idea of "good representation is conducive to clustering, and clustering results promote representation learning" is that: during representation learning, a low-dimensional latent space is learned through an autoencoder or other deep network, so that the global structure and local details of the data are preserved; during clustering, the learned low-dimensional representation is used for unsupervised clustering to discover the inherent categories or patterns of the data. The alternating optimization mechanism between the two can form a positive feedback process: (1) Good representation is conducive to clustering: When the network can extract more discriminative feature representations, different categories of data will show a stronger clustering effect in the latent space, which in turn helps the clustering algorithm obtain more accurate clustering results. (2) Clustering results promote representation learning: Conversely, by clustering low-dimensional features, additional constraints can be added to representation learning based on cluster centers. For example, by designing clustering objectives, the distance between samples in the same cluster in the feature space can be as close as possible, thereby guiding the network to optimize parameters and further improve the discriminability of features.
[0088] For shape feature modeling, the core role of clustering is: (1) pattern mining. In the low-dimensional representation space extracted by the initial shape encoding module, since different target shapes have an inherent clustering tendency, the clustering algorithm can automatically discover the shape patterns contained in the data and determine the cluster center as a priori reference; (2) data discretization. The continuous low-dimensional representation is discretized into several category labels (i.e., clustering assignment results). This provides discrete prior information for the subsequent construction of shape prior constraints, so that the segmentation model can achieve feature alignment at the global level with the help of this prior; (3) consistency improvement: Through clustering, data with similar shape features are aggregated, which can alleviate the influence of local noise caused by individual differences, thereby making the structure of the entire feature space clearer.
[0089] like Figure 4As shown, the present application constructs an alternating optimization framework in combination with the initial shape coding module and clustering. This alternating optimization framework effectively combines unsupervised representation learning with cluster analysis, achieving alternating optimization of the initial shape coding module and the clustering process (i.e., in the alternating optimization stage, not only can the shape coding module be optimized based on the previous clustering results, but the clustering process can also be optimized using the shape features output by the updated shape coding module). As a result, the pre-trained shape coding module obtained in the alternating optimization stage can extract features that are both discriminative and have strong representation capabilities.
[0090] In some embodiments of the present invention, based on the principle that “good representations facilitate clustering, and clustering is representation learning,” the present application obtains a pre-trained shape coding module through an alternating optimization operation. The alternating optimization operation includes the following steps:
[0091] Step S01: obtaining shape features: inputting a plurality of myocardial mask image training samples into the shape encoding module currently being trained, and outputting shape features corresponding to each myocardial mask image training sample;
[0092] Step S02: Shape feature clustering: clustering the shape features corresponding to each myocardial mask training sample to obtain a clustering assignment result, so that the shape encoding module currently being trained is updated based on the clustering assignment result and a pre-set clustering optimization target;
[0093] Repeat steps S01 and S02 until the clustering stop condition is met, and the currently trained shape coding module (or the updated shape coding module) is used as the pre-trained shape coding module. The clustering assignment results mentioned in this application may include each cluster, each cluster center, and the shape features included in each cluster.
[0094] Table 1 Examples of alternating optimization operations
[0095]
[0096] More specifically, as shown in Table 1, the number of cluster centers, the stopping condition, and the clustering optimization target must be pre-set before clustering. During clustering, if the stopping condition is not met, the myocardial mask training sample is input into the currently trained shape coding module, causing it to output the corresponding low-dimensional shape feature H′. H′ is then clustered using the clustering algorithm and the pre-set clustering optimization target to obtain cluster assignment results. The cluster assignment results and the clustering optimization target are then used to optimize the currently trained shape coding module, thereby optimizing the low-dimensional feature H′. If the stopping condition is met, the currently trained shape coding module is used as the pre-trained shape coding module.
[0097] As an example, in this application, the stopping clustering condition can be achieved when the clustering assignment result reaches the set clustering condition or the number of iterations reaches the set iteration threshold, where the set clustering condition can be that the clusters of each shape feature do not change significantly. This application does not specifically limit the stopping clustering condition and the setting clustering condition, and can be designed according to needs. In addition, in order to adapt to the changes brought about by shape diversity, an appropriate number of iterations and initialization parameters are set during the clustering process, and low-dimensional features are further optimized to ensure alignment between different shape patterns.
[0098] By clustering the low-dimensional shape features corresponding to the myocardial mask training samples, the obtained cluster centers represent the main patterns in the shape distribution. The low-dimensional representation learned through alternating optimization can fully capture the intrinsic structure and shape information of the mask image, ensuring that samples of the same category are tightly clustered in the feature space, while different categories are clearly distinguished. This allows the subsequent introduction of the shape prior into the segmentation model to provide a strong global constraint, ensuring that the shapes generated during the segmentation process are more consistent and coherent. The alternating optimization operation not only improves the reliability of the shape prior information but also provides effective constraints for the subsequent optimization of the segmentation model.
[0099] As an example, clustering the shape features corresponding to each myocardial mask image training sample includes clustering the shape features corresponding to each myocardial mask image training sample using a K-means clustering algorithm. K-means clustering is a commonly used unsupervised clustering algorithm with good clustering effects. The main idea of K-means clustering is to divide the data into a predetermined number of clusters so that the distance between samples within a cluster is as small as possible and the distance between clusters is as large as possible.
[0100] In some embodiments of the present invention, the clustering optimization goal of the K-Means algorithm is to find K cluster centers U = {u1, u2, ..., u K}, so that the sum of the Euclidean distances between all sample points (i.e., the shape features corresponding to all myocardial mask training samples) and the cluster center (i.e., the cluster center of the cluster to which they belong) is minimized. Consider the low-dimensional representation H′∈R extracted by the initial shape encoding module k , the optimization objective of K-Means can be expressed as:
[0101]
[0102] Where h represents a sample point in the embedding space H′ (i.e., the shape feature corresponding to a myocardial mask training sample), K is the number of clusters, is the set of sample points assigned to the i-th cluster, u k represents the center of the kth cluster, defined as
[0103]
[0104] The objective function By iteratively updating the cluster centers and distribution relationships, we can gradually converge to a solution that minimizes the sum of squared errors within the class, thereby achieving pattern division of the data in the embedding space.
[0105] This application proposes a shape prior modeling method based on the combination of encoding feature extraction and clustering in the pre-training stage, and uses the prior model as a constraint to guide the optimization of the segmentation model, so as to mine the prior information reflecting different shape patterns with the help of more efficient feature dimensionality reduction and clustering methods. Specifically, a complete encoding and decoding model (such as an autoencoder based on convolution and attention mechanism) is designed and constructed. The model can map the shape of the target object to a low-dimensional latent space through the encoding-decoding process of the input data, and ensure that the learned latent representation can fully reflect the original geometric features through reconstruction; further, considering that the shape of the target object varies greatly, a clustering algorithm can be used to group the low-dimensional features extracted by the initial shape encoding module, in order to mine the cluster centers of different morphological features in the latent space, thereby forming multiple groups of shape priors with shape consistency.
[0106] In the pre-training stage, this application performs data-driven modeling on the shape prior of the target object and innovatively introduces a joint modeling strategy of "representation learning and clustering alternating optimization", thereby enhancing the segmentation model's structural perception of the target morphology, thereby executing steps S110 to S130 to optimize the myocardial segmentation model in the model optimization stage. In addition, the myocardial mask map training samples used to train the myocardial segmentation model to be optimized in the model optimization stage must be the same as the myocardial mask map training samples used to train the complete encoding and decoding model in the pre-training stage. This application also does not specifically limit the iterative conditions for iteratively training the initial shape encoding module and the pre-trained shape encoding module in the pre-training stage, and also designs them independently.
[0107] In a specific embodiment of the present invention, further experimental verification demonstrates that the optimization method proposed in this application can achieve significant advantages in edge detail preservation and regional coherence in the optimized myocardial segmentation model. The following specific embodiment provides a unified description of the data, network structure, and key hyperparameters used in each training optimization stage (for example, the number of iterations can be set during the pre-training phase to obtain a pre-trained shape coding module), ensuring repeatable results and facilitating subsequent comparative analysis.
[0108] ① Dataset and data preprocessing
[0109] A dataset of 9712 cardiac CT image slices, each 512×512 in size, was collected from 60 subjects. All CT images in the dataset were preprocessed using windowing and normalization to produce the original cardiac images to be segmented. Windowing eliminates potential interference by thresholding pixel values, while normalization unifies the intensity of all image slices.
[0110] During the pre-training phase, the dataset was divided into two subsets: a training set containing 7,744 original cardiac images from 48 subjects, and a test set containing 1,968 images from 12 subjects (the original cardiac images in the training and test sets did not overlap). During the model optimization phase, the pre-training training set was split into a training set and a validation set in a 4:1 ratio, while the test set remained unchanged.
[0111] ②In the low-dimensional coding training phase, the initial shape coding module is trained
[0112] use Figure 3 The autoencoder of the shown architecture is used as a complete encoding-decoding model and adopts X and The mean square error of is used as the reconstruction loss function to train the autoencoder. The training hyperparameters of the autoencoder are shown in Table 2.
[0113] Table 2. Training hyperparameter settings of autoencoder
[0114]
[0115] The reconstructed image is the model reconstructed output corresponding to the input myocardial mask training sample. By comparing the myocardial mask training sample input to the autoencoder with the reconstructed mask image output, the autoencoder can be trained to obtain the initial shape encoding module. Randomly select 4 corresponding input and output images for visualization, such as Figure 5 shown. Figure 5 As can be observed, although the encoder only compresses the high-dimensional label image into a 128-dimensional latent space, the reconstruction quality is still nearly lossless, fully demonstrating the effectiveness of the low-dimensional representation learned by the encoder in preserving shape integrity and richness of detail. The trained initial shape encoding module not only performs well in the reconstruction task, but the low-dimensional features it extracts can be considered a highly compressed and informative representation of the myocardial shape, laying a solid foundation for the introduction of shape priors in subsequent clustering analysis and segmentation models.
[0116] ③ In the alternating optimization stage, K-Means clustering is used to train the pre-trained shape coding module
[0117] (1) To determine the optimal number of clusters K for K-Means clustering, we first perform a clustering experiment on the low-dimensional shape features extracted by the initial shape encoding module. We then perform K-Means clustering on the training set within the range of K = [2, 100] and record the sum of squared errors (SSE) for each K. The definition of SSE is as follows:
[0118]
[0119] Among them, h represents a sample point in the embedding space, K is the number of cluster centers, and C k is the sample set of the kth cluster (i.e., the shape feature set), u k represents the kth cluster center.
[0120] The curve of SSE changing with K is as follows Figure 6 As shown in the figure, it can be observed that when K increases from 2 to about 5, the SSE decreases rapidly; around K ≈ 8 to 10, the slope of the curve slows down significantly, entering the "elbow" region; and after K > 10, the improvement in SSE with increasing K is small. According to the Elbow Method, the K corresponding to the elbow inflection point is usually used as the optimal cluster number. Therefore, in this specific embodiment, this application uses K = 10 as the cluster number for the myocardial slice mask image.
[0121] (2) The training hyperparameter settings of the initial shape encoding module in the alternating optimization stage are shown in Table 3.
[0122] Table 3 Training hyperparameter settings of the initial shape encoding module
[0123]
[0124] Figure 7 This is the visualization result after t-SNE dimensionality reduction of the low-dimensional shape features obtained by the shape encoding module in the current training and coloring according to the K-Means label. Among them, 0 to 9 represent the number of clusters in 10, and different colors are used to distinguish them. Figure 7 In the figure, the features are clearly divided into 10 categories, and the distribution and compactness of each cluster reflect the differences and similarities of myocardial slices in the latent shape space.
[0125] ④ Optimize the myocardial segmentation model in the model optimization stage
[0126] The myocardial segmentation model to be optimized adopts the U-Net structure, and its main hyperparameter configurations are shown in Table 4.
[0127] Table 4 Training hyperparameter settings of the myocardial segmentation model to be optimized
[0128]
[0129] In order to effectively prevent overfitting and ensure the generalization ability of the model on unseen samples (unseen samples refer to the validation set that has not appeared in the training set or the original heart images added after training), two additional strategies of dynamic adjustment of learning rate and preservation of the optimal model of the validation set are introduced during the training process: (1) Dynamic adjustment of learning rate, monitoring the Dice loss on the validation set (that is, Dice loss is used as the image similarity loss in this example), when it fails to decrease within 5 consecutive iterations, the current learning rate is multiplied by 0.9. This method can automatically reduce the step size in the later stage of training, helping the model to escape local oscillation and further converge to a better solution. (2) Preservation of the optimal model of the validation set, randomly select 20% of the samples in the dataset as the validation set, and evaluate the Dice loss on the validation set after each iteration. Only when the Dice loss of the validation set is lower, the current model parameters are saved; the remaining iterations are not stored to ensure that the final selected weights correspond to the optimal generalization performance. Through the above learning rate adjustment and preservation of the optimal model of the validation set strategy, it is possible to effectively suppress overfitting while maintaining sufficient training.
[0130] ⑤ Experimental results
[0131] A comprehensive analysis of the myocardial segmentation model's performance during optimization, final segmentation performance, and multiple quantitative evaluation metrics validated the advantages of the segmentation model with the introduction of a shape prior over traditional segmentation networks. Furthermore, a comparison with a baseline model trained solely using the Dice loss demonstrated the positive impact of the shape prior constraint on improving structural consistency and segmentation accuracy.
[0132] (1) Determine the loss function for myocardial segmentation model optimization
[0133] Objectively determine the shape consistency loss L through designed ablation experiments align In the joint loss L total The optimal weight α in . Fixed the network structure (U-Net) and other hyperparameters (such as the hyperparameters in Table 4), set α∈{0,0.1,0.5,1} respectively, trained the segmentation model on the same training set until convergence for each α, and evaluated the Dice similarity coefficient index on the test set. The experimental results are shown in Figure 8 As shown, it can be seen that when α=0.5, the Dice similarity coefficient is the highest, so in this example, α=0.5 can be determined.
[0134] like Figure 9 As shown in the figure, in order to verify the effectiveness of shape consistency loss and test the overall convergence during the optimization of the segmentation model, three training loss curves (Dice loss L Dice , shape consistency loss L align And the joint loss L of the weighted sum of the twoDice +0.5L align ) and the Dice loss change curve on the validation set. Figure 9 (a) in the figure shows the change curve of Dice loss during training. Figure 9 (b) in the figure shows the changing curve of shape consistency loss during training. Figure 9 (c) in the figure shows the change curve of the joint loss during training. Figure 9 (d) in the figure represents the Dice loss curve on the validation set. Figure 9 As shown in (a) and (b) in the figure, the Dice loss drops rapidly at the beginning of training and then tends to be flat, indicating that the model has rapidly improved in pixel-level segmentation accuracy; at the same time, the shape consistency loss also converges quickly to a lower value, indicating that the shape prior constraint can significantly enhance the intra-cluster compactness of low-dimensional features in the early stage of training. Figure 9 As shown in (c) and (d) of Figure 1, the total loss curve combines the trends of the two aforementioned methods, exhibiting a smooth and stable decline without significant oscillation, verifying the convergence of the joint optimization objective. Furthermore, the Dice loss on the validation set also gradually decreases to a flat level, demonstrating no overfitting. In summary, the training curves and validation metrics jointly validate the feasibility of the shape prior-driven shape consistency loss in this method.
[0135] (2) Segmentation performance comparison
[0136] The U-Net model trained only with Dice loss is used as the baseline model. Based on the method proposed in this application, the shape prior modeling of autoencoder representation learning and K-Means clustering is integrated, and the shape prior is introduced as a structural constraint into the myocardial segmentation model to obtain the optimized model. The segmentation effects of the two models on the test set are qualitatively compared. The results are shown in Figure 2. Figure 10 As shown. Figure 10 In the results, it can be observed that when the baseline model handles complex situations such as structural distortion, blurred boundaries, or partial occlusion, the segmentation contours often become broken, discontinuous, or deviate significantly from the true anatomical structure. However, the optimized model obtained according to the method of this application significantly improves the model's ability to perceive the overall structure due to the introduction of shape priors based on representation learning and clustering. Even in low-contrast or high-variance samples, it can still output structurally coherent and morphologically natural segmentation results. In other words, the optimized model that integrates the shape prior can more accurately restore the actual anatomical structure. Figure 10 The results in
[15] show that the shape prior not only effectively describes the deformation pattern of the anatomical structure in the low-dimensional feature space, but also provides a global shape constraint in the segmentation stage, thereby enhancing the shape consistency of the segmentation model output.
[0137] (3) Evaluation indicators
[0138] The segmentation model U-Net trained only with Dice loss is used as the baseline model, and the optimized model obtained according to the method of this application adds the shape prior constraint obtained by alternating optimization of representation learning and clustering. As shown in Table 5, in order to verify the effectiveness of the method proposed in this application, the evaluation indicators of the baseline model and the optimized model are compared. The evaluation indicators include Dice score, intersection over union (IoU), precision, recall, specificity, F1 score and 95% Hausdorff distance (HD95). Among them, the definitions of each indicator are as follows:
[0139] The Dice score can be defined as:
[0140]
[0141] The intersection-union ratio can be defined as:
[0142]
[0143] Precision can be defined as:
[0144]
[0145] Recall can be defined as:
[0146]
[0147] Specificity can be defined as:
[0148]
[0149] The F1 score can be defined as:
[0150]
[0151] Among them, TP represents the number of pixels that correctly predict the foreground as the foreground, FP represents the number of pixels that incorrectly predict the background as the foreground, TN represents the number of pixels that correctly predict the background as the background, and FN represents the number of pixels that incorrectly predict the foreground as the background.
[0152] In addition, the above-mentioned indicator 95% Hausdorff distance can be used to measure the maximum and minimum distance between the predicted boundary and the true boundary, that is, HD95 represents the 95% quantile distance after removing outliers. This indicator is often used to measure shape boundary consistency.
[0153] Table 5 Comparison results of evaluation indicators of baseline model and optimized model
[0154]
[0155] As shown in Table 5, the optimized model outperforms the baseline model using only the Dice loss across multiple evaluation metrics, fully validating the significant performance improvements brought about by the introduction of the shape prior. Specifically, the Dice score and IoU increase by 0.8% and 1.3%, respectively, demonstrating improved overall overlap and spatial consistency between the predicted regions and the ground-truth anatomical structures. Recall improves by 1.8%, demonstrating that the optimized model has enhanced foreground recognition and significantly reduced missed detections, particularly in regions with complex structures or blurred boundaries. Although Precision decreases slightly by 0.3%, the overall F1 score improves by 0.7%, demonstrating that the optimized model achieves a better balance while maintaining accuracy. The HD95 distance decreases from 1.526mm to 1.201mm, indicating that the predicted boundaries are closer to the ground-truth boundaries and the structure is restored more finely. Specificity remains at 99.4%, demonstrating that the optimized model improves foreground recognition without compromising background classification accuracy. Overall, the introduction of a shape prior, derived from alternating optimization via representation learning and clustering, effectively improves the structural consistency and boundary accuracy of the segmentation, providing strong support for modeling complex anatomical structures.
[0156] The optimization method of the myocardial segmentation model based on shape prior proposed in this application has the following significant advantages:
[0157] First, the complete encoding and decoding model is pre-trained separately during the low-dimensional encoding phase to initially develop a shape encoding module capable of extracting low-dimensional shape representations. This initial shape encoding module, trained during the low-dimensional encoding phase, performs latent space encoding on the myocardial structure mask, learning a low-dimensional compressed representation of shape and extracting latent features that capture global morphological variations. This representation is not only highly compact and expressive, but also possesses excellent reconstruction capabilities, preserving the original morphological information.
[0158] ② In the alternating optimization stage, clustering is used to analyze and classify the feature distribution in the latent space, obtaining cluster centers under different morphological categories, thereby constructing a set of statistically significant structural priors to describe the main geometric distribution patterns of the myocardium in real clinical images. Specifically, a clustering algorithm is used to mine the intrinsic shape patterns of the data, and the shape features output by the initial shape encoding module are aligned using the clustering assignment results as category labels, thereby optimizing the parameters of the initial shape encoding module, ultimately achieving a positive feedback mechanism of "good representation is conducive to clustering, and clustering results promote representation learning." This stage continuously strengthens the initial shape encoding module's ability to capture the intrinsic structure of the target shape, ultimately obtaining a pre-trained shape encoding module that can stably extract discriminative shape features, providing solid shape structure support for high-precision image segmentation tasks.
[0159] ③ After obtaining the pre-trained shape encoding module that can generate shape prior information in the pre-training stage, the prior information is embedded into the segmentation model through the constructed multi-task collaborative segmentation optimization framework in the model optimization stage. Specifically, when optimizing the segmentation model, in addition to relying on the traditional pixel-level segmentation loss (ie, conventional loss), this application also introduces a shape consistency constraint so that the hidden representation of the segmentation model matches the global shape distribution reflected by the clustering. This constraint mechanism plays an important role in alleviating the segmentation instability caused by the diversity of target shapes, and at the same time helps to improve the model's recognition accuracy for complex shape targets. Compared with the myocardial segmentation model before optimization, the optimization model proposed in this application shows better segmentation performance and evaluation indicators in terms of morphological consistency, boundary integrity and anatomical structure fidelity.
[0160] ④ The method proposed in this application addresses the difficulties and overhead of traditional algorithms in modeling complex shapes. It effectively integrates shape prior modeling based on representation learning and clustering with a deep learning segmentation framework. It also theoretically verifies the significant effect of introducing latent space structural constraints in improving shape consistency. This shape prior-driven segmentation strategy provides a new direction for the automated segmentation of complex shapes and has important scientific research significance and practical application potential, such as intelligent tasks such as cardiac function analysis, preoperative planning, and remote assisted diagnosis and treatment.
[0161] The optimization method proposed in this application is also applicable to other types of image segmentation besides myocardial segmentation. It can provide a novel solution for how to effectively integrate shape priors into image segmentation tasks, and has important theoretical value and practical application prospects.
[0162] Corresponding to the above method, the present invention also provides an optimization system for a myocardial segmentation model based on shape prior, the system including a computer device, the computer device including a processor and a memory, the memory storing a computer program / instructions, the processor being used to execute the computer program / instructions stored in the memory, and when the computer program / instructions are executed by the processor, the system implements the steps of the method described above.
[0163] An embodiment of the present invention further provides a computer-readable storage medium having a computer program / instruction stored thereon, which, when executed by a processor, implements the steps of the aforementioned edge computing server deployment method. The computer-readable storage medium may be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable storage disk, a CD-ROM, or any other form of storage medium known in the art.
[0164] An embodiment of the present invention further provides a computer program product having a computer program / instructions stored thereon, which, when executed by a processor, implements the steps of the aforementioned edge computing server deployment method. The computer program product can be a tangible product, such as a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, register, floppy disk, hard disk, removable storage disk, CD-ROM, or any other form of product known in the art.
[0165] It should be understood by those skilled in the art that the various exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is specifically performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.
[0166] It should be understood that the present invention is not limited to the specific configurations and processes described above and illustrated in the figures. For the sake of brevity, a detailed description of known methods is omitted. In the above embodiments, several specific steps are described and illustrated as examples. However, the method of the present invention is not limited to the specific steps described and illustrated. Those skilled in the art may make various changes, modifications, and additions, or change the order of the steps after understanding the spirit of the present invention.
[0167] In the present invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with or replace features of other embodiments.
[0168] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations to the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.
Claims
1. A method for optimizing a myocardial segmentation model based on shape prior, characterized in that: The method comprises the following steps: Acquire an original cardiac image to be segmented, perform a mask operation on the acquired original cardiac image to obtain a true myocardial mask map, and input the acquired original cardiac image into a myocardial segmentation model to be optimized, and output a myocardial prediction probability map; Inputting the true myocardial mask image and the myocardial prediction probability map into a pre-trained shape coding module respectively, outputting shape features corresponding to the true myocardial mask image and the myocardial prediction probability map, and calculating shape consistency loss using the output shape features; The myocardial segmentation model to be optimized is updated based on the shape consistency loss, thereby obtaining an optimized myocardial segmentation model.
2. The method according to claim 1, characterized in that The pre-trained shape coding module is obtained by training the encoding and decoding model through a low-dimensional encoding operation to obtain an initial shape coding module, and training the initial shape coding module through an alternating optimization operation to obtain a pre-trained shape coding module; The alternating optimization operation performs the following steps: Obtaining shape features: inputting multiple myocardial mask image training samples into the shape encoding module currently being trained, and outputting the shape features corresponding to each myocardial mask image training sample; Shape feature clustering: clustering the shape features corresponding to each myocardial mask training sample to obtain a cluster assignment result, so that the shape encoding module currently being trained is updated based on the cluster assignment result and a preset cluster optimization target; The steps of obtaining shape features and clustering shape features are repeated until a clustering stop condition is reached, and the shape coding module currently being trained is used as the pre-trained shape coding module.
3. The method according to claim 2, characterized in that The clustering of shape features corresponding to each myocardial mask image training sample comprises: clustering the shape features corresponding to each myocardial mask image training sample once using a K-means clustering algorithm; The preset clustering optimization goal is to minimize the sum of the Euclidean distances between the shape features corresponding to all myocardial mask image training samples and the cluster centers of the clusters to which they belong; and The number of cluster centers included in the cluster assignment result is determined by the elbow method.
4. The method according to claim 1, wherein The updating of the myocardial segmentation model to be optimized based on shape consistency loss includes: calculating a joint loss based on image similarity loss and shape consistency loss, and updating the myocardial segmentation model to be optimized according to the joint loss; wherein the image similarity loss is obtained by comparing the similarity between the true myocardial mask map and the myocardial prediction probability map.
5. The method according to claim 4, characterized in that The calculating of the joint loss based on the image similarity loss and the shape consistency loss includes: obtaining the joint loss by performing weighted calculation on the image similarity loss and the shape consistency loss.
6. The method according to claim 2, characterized in that The initial shape encoding module is an encoder included in a pre-trained autoencoder; wherein the autoencoder is the encoding-decoding model; The autoencoder is trained by performing the following low-dimensional encoding operation: Inputting the myocardial mask image training sample into the encoder of the autoencoder to be trained, outputting shape features corresponding to the myocardial mask image training sample, and using the shape features output by the encoder of the autoencoder to be trained as input to the decoder of the autoencoder to be trained, outputting a reconstructed mask image corresponding to the myocardial mask image training sample; An image reconstruction loss is calculated based on the myocardial mask image training samples and the corresponding reconstructed mask image, so that the autoencoder to be trained is updated based on the image reconstruction loss, thereby obtaining a pre-trained autoencoder.
7. The method according to claim 4, characterized in that The myocardial segmentation model adopts U-Net architecture; The image similarity loss is mean square error loss, cross entropy loss or Dice loss; The original cardiac image is a cardiac CT image that has been preprocessed by windowing and normalization.
8. A system for optimizing a myocardial segmentation model based on shape priors, comprising a processor, a memory, and a computer program / instruction stored in the memory, characterized in that: The processor is configured to execute the computer program / instructions. When the computer program / instructions are executed, the system implements the steps of the method according to any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.