Single-source Domain Generalization Medical Image Segmentation Method and Device Based on Shape Dictionary

By using shape dictionary and random feature enhancement methods in medical image segmentation, the problem of large domain differences in single-source domain generalization is solved, the generalization ability and segmentation accuracy of the model are improved, and the resource efficiency is high.

CN119672346BActive Publication Date: 2025-06-03THE FIRST AFFILIATED HOSPITAL OF XIAMEN UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510186671.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-20
Publication Date
2025-06-03
Estimated Expiration
2045-02-20

AI Technical Summary

Technical Problem

In the field of single-source domain generalization medical image segmentation, existing methods are difficult to effectively process medical images with large domain differences, and model training and inference require a large amount of resources.

Method used

The unsupervised domain adaptation method based on shape dictionary is adopted, combined with the domain-invariant shape reference segmentation model and random feature enhancement, and the model's learning ability of domain-invariant features and unknown domain-specific features is improved through dictionary learning and random low-level feature enhancement modules.

Benefits of technology

Under single source domain data training, the generalization ability and segmentation accuracy of the model are improved, the demand for resources is reduced, and the shape dictionary and random feature enhancement are effectively utilized to enhance the generalization ability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119672346B_ABST
    Figure CN119672346B_ABST
Patent Text Reader

Abstract

The present invention discloses a single-source domain generalization medical image segmentation method and device based on a shape dictionary, which relates to the field of computer technology. The method includes: a shape dictionary learning step, an overall segmentation network construction step, an overall segmentation network training step, and a medical image segmentation step. By combining a domain-invariant shape reference segmentation model and randomly-feature-enhanced domain-specific generalization information learning, the present invention improves the learning ability of the network model for domain-invariant features and simulated unknown-domain domain-specific features on the premise of training with single-source domain data, and maximizes the generalization ability and segmentation accuracy of the model in various unknown target domains. The method proposed by the present invention only needs to use single-source domain data, and can well alleviate the single-source domain generalization (SDG) problem of the medical image segmentation task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and particularly to a single-source domain generalization medical image segmentation method and device based on a shape dictionary. Background Art

[0002] Most of the existing medical image methods require access to target domain data. However, in the single-source domain generalization (SDG) problem, the target domain data cannot be accessed, and the only available data is a single source domain dataset. From existing research, it is known that generalization ability needs to be enhanced by learning domain-invariant features and reducing the influence of domain-specific features. Currently, most SDG methods use the method of generating adversarial data augmentation to synthesize fictional samples from a single-domain dataset to simulate the data distribution of the unknown domain. However, in the field of medical image segmentation, the domain differences may be very large due to various complex factors, so it is extremely difficult to predict the distribution from the source domain data to the unknown domain data. In addition, medical data is usually high-dimensional and has a large amount of tissue details, and the model required for the process of synthesizing fictional samples is very large and requires a large amount of resources. Summary of the Invention

[0003] The purpose of this application is to propose an unsupervised domain adaptation medical image segmentation method and device based on multi-scale features for the above-mentioned technical problems. By combining a domain-invariant shape reference segmentation model and domain-specific generalization information learning with random feature augmentation, under the premise of training with a single source domain data, the learning ability of the network model for domain-invariant features and simulated unknown domain domain-specific features is improved, and the generalization ability and segmentation accuracy of the model in various unknown target domains are maximally improved.

[0004] On the one hand, a single-source domain generalization medical image segmentation method based on a shape dictionary, comprising:

[0005] S1, a shape dictionary learning step, in which a shape dictionary that can effectively represent the source domain segmentation anatomical shape and the corresponding true shape coefficient vector are generated from the source domain medical image dataset by a dictionary learning method;

[0006] S2. Overall segmentation network construction step: construct an overall segmentation network composed of a source domain data segmentation branch network with double consistency regularization and a random enhanced feature segmentation branch network; the source domain data segmentation branch network includes a domain-invariant shape reference segmentation model DIMD based on U-Net, add a shape reference mask generation module SRMG in DIMD to predict the first predicted shape coefficient vector of each medical image in the source domain, generate a first shape reference mask based on the first predicted shape coefficient vector and the shape dictionary, and generate a first predicted mask after cascading the first shape reference mask with the features output by the U-Net decoder; the random enhanced feature segmentation branch network adds a random low-level feature enhancement module RLFA before the first layer of DIMD, for the source domain medical image features, obtain three versions of randomly enhanced features through a random convolutional layer with random weights generated by the input noise z, input these three randomly enhanced features into the U-Net encoder, and input the features output by the U-Net encoder into the shape reference mask generation module SRMG to obtain the second predicted shape coefficient vector, the third predicted shape coefficient vector and the fourth predicted shape coefficient vector, and then combine with the shape dictionary to obtain the second shape reference mask, the third shape reference mask and the fourth shape reference mask, and output the predicted second enhanced feature prediction mask, the third enhanced feature prediction mask and the fourth enhanced feature prediction mask after cascading with the features output by the U-Net decoder respectively;

[0007] S3. Overall segmentation network training step: based on the source domain medical image dataset, train the overall segmentation network through consistency loss, adversarial domain enhancement strategy loss and overall shape coefficient loss to obtain a trained overall segmentation network;

[0008] S4. Medical image segmentation step: use the trained overall segmentation network to segment the medical image to be processed.

[0009] Preferably, the optimization function in the shape dictionary generation process is expressed as follows:

[0010]

[0011] where, ||·|| 2 2 is the square of the L2 norm, used to calculate the Euclidean distance of vectors; ∥·∥ 1 is the L1 norm, used to enforce the sparsity of α i ; D = {d 1 , d 2 , …, d k , …, d K}, represents the shape dictionary, D ∈ R K×H×W ; α = {α 1 , α 2 , …, α i,…,α N}, representing the true shape coefficient vector corresponding to the shape dictionary, α i represents the i-th true shape coefficient vector; y i represents the true segmentation mask of the i-th source domain medical image data; As a balance parameter; N represents the total number of medical image samples in the source domain medical image dataset; K represents the total number of explicit shape templates in the shape dictionary; R represents the set of real numbers; H represents height; W represents width.

[0012] Preferably, during the generation process of the shape dictionary, optimization is performed alternately, including:

[0013] S11, fixing D, and updating α through Least Angle Regression (LARS) as follows: i as follows:

[0014]

[0015] S12, fixing α i , and updating D through block coordinate descent as follows:

[0016]

[0017] S13, continuously iterating S11 and S12 until the convergence condition is met, to generate a shape dictionary that can effectively represent the segmented anatomical shapes of the source domain and the corresponding true shape coefficient vector.

[0018] Preferably, the source domain data segmentation branch network specifically includes a U-Net encoder, a Shape Reference Mask Generation Module (SRMG), a U-Net decoder, Concat(), and a 1x1 convolution; the U-Net encoder takes the source domain medical image as input and outputs features to the SRMG; the SRMG predicts a first predicted shape coefficient vector for each medical image, and the first predicted shape coefficient vector is used to generate a first shape reference mask by combining the shape dictionary of each category. After concatenating the first shape reference mask with the output of the U-Net decoder (Concat()), features containing shape reference information are obtained, and then a 1x1 convolution is used to further refine and generate the final first predicted mask.

[0019] Preferably, for each category c, the SRMG designs a separate fully connected layer to initialize the weights of the fully connected layer with the atom vectors of the shape dictionary D c of the generated category c; through the SRMG learns a specific first predicted shape coefficient vector for each category through and multiplies it with the shape dictionary D to generate the first shape reference mask M c ​c , as follows:

[0020]

[0021] Among them, represents the first predicted shape coefficient vector of the k-th explicit shape template; represents the k-th explicit shape template.

[0022] Preferably, before the source domain medical image is input into the U-Net encoder by the random low-level feature enhancement module RLFA, the source domain medical image is first input into the random weight generation module RWGM; the random weight generation module RWGM has a convolutional layer with random weights, and this convolutional layer realizes the random enhancement of the domain-specific low-level features of the image while keeping the domain-invariant global shape features unchanged by applying random filters.

[0023] Preferably, the enhanced feature vector obtained through the convolutional layer is combined with the original feature vector to obtain the final randomly enhanced feature as follows:

[0024]

[0025] Among them, β is the feature combination weight; i represents the i-th source domain medical image; f i represents the original feature vector; represents the enhanced feature vector; j ∈ [1, 3].

[0026] Preferably, the enhanced feature vector is represented as follows:

[0027]

[0028] Among them, Θ is the random convolution kernel.

[0029] Preferably, the overall segmentation loss L total is represented as follows:

[0030] L total = γ 2 L cons + γ 3 L ada + γ 4 L sft ;

[0031]

[0032] Among them, L cons represents the consistency loss; L ada represents the adversarial domain enhancement strategy loss; L sft represents the overall shape coefficient loss; γ2 , γ 3 and γ 4 are custom weight coefficients; respectively represent the second enhanced feature prediction mask, the third enhanced feature prediction mask, and the fourth enhanced feature prediction mask; represents the first prediction mask; respectively represent the second shape reference mask, the third shape reference mask, and the fourth shape reference mask; represents the first shape reference mask; y represents the true segmentation mask of the source domain medical image data; α represents the true shape coefficient vector corresponding to the shape dictionary.

[0033] On the other hand, a single-source domain generalization medical image segmentation device based on a shape dictionary includes:

[0034] A shape dictionary learning module for generating a shape dictionary that can effectively represent the source domain segmentation anatomical shape and the corresponding true shape coefficient vector from the source domain medical image dataset through a dictionary learning method;

[0035] An overall segmentation network construction module for constructing an overall segmentation network composed of a source domain data segmentation branch network with double consistency regularization and a random enhanced feature segmentation branch network; the source domain data segmentation branch network includes a domain-invariant shape reference segmentation model DIMD based on U-Net, and a shape reference mask generation module SRMG is added in DIMD to predict the first predicted shape coefficient vector of each medical image in the source domain, generate the first shape reference mask based on the first predicted shape coefficient vector and the shape dictionary, and generate the first prediction mask after cascading the features output by the U-Net decoder; the random enhanced feature segmentation branch network adds a random low-level feature enhancement module RLFA before the first layer of DIMD, obtains three versions of random enhanced features for the source domain medical image features through a random convolution layer with random weights generated by the input noise z, inputs these three random enhanced features into the U-Net encoder, and inputs the features output by the U-Net encoder into the shape reference mask generation module SRMG to obtain the second predicted shape coefficient vector, the third predicted shape coefficient vector, and the fourth predicted shape coefficient vector, and then combines them with the shape dictionary to obtain the second shape reference mask, the third shape reference mask, and the fourth shape reference mask, and respectively output the predicted second enhanced feature prediction mask, the third enhanced feature prediction mask, and the fourth enhanced feature prediction mask after cascading with the features output by the U-Net decoder;

[0036] An overall segmentation network training module for training the overall segmentation network based on the source domain medical image dataset through consistency loss, adversarial domain enhancement strategy loss, and overall shape coefficient loss to obtain a trained overall segmentation network;

[0037] A medical image segmentation module for segmenting a to-be-processed medical image using a trained overall segmentation network.

[0038] Compared with the prior art, the present invention has the following beneficial effects:

[0039] (1) Based on the feature that the anatomical structure shape in medical images does not change due to domain shift, the present invention introduces dictionary learning. By extracting a general semantic shape dictionary from a single-source domain dataset as prior knowledge, these prior information can be further effectively utilized in unknown domain data, generalizing the trained single-domain model to unknown domain data. By this method, domain-invariant features of source domain data are learned, which is not only lightweight and efficient but also can well enhance the generalization ability of the network model;

[0040] (2) Since domain-specific features are mainly in low-level features, the present invention introduces a random feature enhancement method to enhance low-level features, thereby simulating the domain-specific information of the unknown domain. By this method, the network model can learn domain-specific information from the features of the simulated unknown domain, so as to effectively resist the influence of domain shift caused by the domain-specific information of unknown domain data in the segmentation of unknown domain data, thereby improving the generalization ability of the network model. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0042] Figure 1 It is a schematic flowchart of a single-source domain generalization medical image segmentation method based on a shape dictionary according to an embodiment of the present application;

[0043] Figure 2 It is a schematic structural diagram of a source domain data segmentation branch network according to an embodiment of the present application;

[0044] Figure 3 It is a schematic structural diagram of a random low-level feature enhancement module RLFA according to an embodiment of the present application;

[0045] Figure 4 It is a random convolution enhanced feature map according to an embodiment of the present application, where the upper part is the convolution kernel size and the lower part is the convolution kernel stack;

[0046] Figure 5 It is a schematic structural diagram of a random weight generation module RWGM according to an embodiment of the present application;

[0047] Figure 6Schematic diagram of the overall segmentation network SDRA of the embodiments of the present application;

[0048] Figure 7 Schematic diagram of the segmentation results of different algorithms on fundus images;

[0049] Figure 8 Schematic diagram of the segmentation results of different algorithms on prostate images;

[0050] Figure 9 Schematic diagram of the single-source domain generalization medical image segmentation device based on shape dictionary of the embodiments of the present application. Detailed implementation manners

[0051] In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part rather than all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0052] As Figure 1 shown, a single-source domain generalization medical image segmentation method (Single-source Domain Generalization Medical Image Segmentation Method Based on Shape Dictionary and Random Augmentation, SDRA) provided in this embodiment includes the following steps.

[0053] S1. Shape dictionary learning step: Through the dictionary learning method, a shape dictionary that can effectively represent the source domain segmentation anatomical shape and the corresponding true shape coefficient vector are generated from the source domain medical image dataset.

[0054] In the field of medical image segmentation, the segmentation of medical images requires a deep model to accurately analyze the anatomical structures in medical images. The effect of this analysis process should not be limited by the type or performance of the scanning device, and the generality of the deep model in different application scenarios should be demonstrated. However, due to domain shift, the performance of the deep model on data from different domains will deteriorate because of different feature distributions. Although there is domain shift between different domains, it is recognized that the anatomical structure shapes of medical images do not change due to domain shift. Based on this objective fact, the main purpose of this step is to capture the commonly existing shape information in medical images to enhance the model's adaptability to data in new domains. Through dictionary learning technology, representative shape prior knowledge is explicitly extracted from the medical image data in the source domain, and this key shape information is integrated into the deep segmentation model to obtain a domain-invariant shape reference segmentation model based on dictionary learning (DIMD). This not only promotes the model's ability to maintain high-precision segmentation when encountering previously unseen data but also significantly improves the model's generalization ability. Dictionary learning is a powerful machine learning method that aims to learn a compact and representative set of basis elements (i.e., a dictionary) from a large amount of data so that any data can be approximately represented by a sparse linear combination of these basis elements. In this embodiment, dictionary learning can extract a set of powerful shape templates from the data in a single source domain, and this set of templates is sufficient to represent the basic anatomical structures of all images in the source domain. Through this dictionary, the model in this embodiment can recognize and understand these commonly existing anatomical structure shapes, and thus can rely on the learned shape prior to perform accurate segmentation when facing new and unknown image data.

[0055] Specifically, dictionary learning technology is used to construct a set of basis elements (i.e., a dictionary) such that any given input can be represented as a sparse linear combination of these elements. In this framework, for a source domain dataset composed of N samples where each sample includes data and the corresponding segmentation mask a dictionary D = {d 1 , d 2 , …, d k , …, d K} containing K explicit shape templates is defined. This dictionary can combine the segmentation masks of each sample in the source domain dataset through linear combination coefficients

[0056] In the process of constructing this shape dictionary, two principles must be followed to ensure its applicability to unknown fields: First, the number of templates in the dictionary should be much smaller than the number of samples in the dataset (K << N) to avoid overfitting; second, to maximize the expressiveness of each template, the number of linear combination coefficients used to represent the shape dictionary should be minimized, that is, these coefficients should be sparse.

[0057] Since medical image segmentation involves multiple anatomical structures, for simplicity, the segmentation mask of each structure is regarded as an independent binary segmentation mask, and a shape dictionary is constructed and optimized for each anatomical structure separately. Since the steps of constructing and optimizing the shape dictionary for each anatomical structure are the same, the following takes y i to uniformly represent the segmentation mask for constructing and optimizing the shape dictionary (i.e., the ground truth segmentation mask of the source domain medical image data). The process of generating the dictionary is equivalent to solving the optimization problem regarding the dictionary D ∈ R K×H×w and the coefficients α = {α 1 , α 2 , …, α i , …, α N}, and this optimization problem is shown as follows.

[0058]

[0059] Among them, is the square of the L2 norm, used to calculate the Euclidean distance of vectors; ||·|| 1 is the L1 norm, used to measure the number of non-zero elements in a vector, and here it is used to enforce the sparsity of α i ; D = {d 1 , d 2 , …, d k , …, d K}, represents the shape dictionary, D ∈ R K×H×W ; α = {α 1 , α 2 , …, α i , …, α N}, represents the ground truth shape coefficient vector corresponding to the shape dictionary, α i represents the i-th ground truth shape coefficient vector; y i represents the ground truth segmentation mask of the i-th source domain medical image data; As a balancing parameter, it is used to normalize the coefficients obtained in the learning process; N represents the total number of medical image samples in the source domain medical image dataset; K represents the total number of explicit shape templates in the shape dictionary; R represents the set of real numbers; H represents the height; W represents the width.

[0060] Through this optimization problem, the optimal shape dictionary D and coefficients α can be found, which can combine most accurately to represent the segmentation masks of N sample images in the source domain while ensuring that the coefficient α i remains sparse. The sparse representation of α i helps improve the generalization ability of the dictionary for unseen samples, as it restricts the model from overfitting to specific features of the training data.

[0061] For the optimization problem of dictionary generation, in this embodiment, each segmentation mask y is iteratively i updated with the Least Angle Regression (LARS) to obtain the sparse coefficient α i , and then the dictionary D is updated using the Block Coordinate Descent (BCD) method. The process of updating the sparse coefficient α i is, for a given image mask y i , to find a sparse coefficient vector α i such that y i can be approximately represented as a linear combination of the column vectors of the dictionary D. Mathematically, this can be achieved through the following optimization formula.

[0062]

[0063] This optimization problem is solved by the LARS algorithm, which finds the sparse linear combination that can best reconstruct the segmentation mask y i through an iterative process. This process starts by setting the residual to the target segmentation mask y i , and the coefficient vector is initialized to zero. The algorithm first identifies the dictionary atom d k most correlated with the residual and adds it to the model. Subsequently, the algorithm proceeds along the atom direction while keeping the correlations of all selected atoms with the residual equal. During this process, the residual is continuously updated to reflect the difference between the current model's prediction and the actual segmentation mask y i . As the iteration progresses, LARS selects new atoms or updates the coefficients of existing atoms to maintain the maximum correlation and reduce the residual. The process stops when the coefficient vector reaches a predetermined sparse level or the residual is reduced to a certain extent. Once the sparse coefficients α i for all image masks are obtained, the dictionary D needs to be updated to better fit the data. This can be achieved through the following optimization formula.

[0064]

[0065] This optimization problem is solved by the BCD algorithm. In the update loop, the algorithm iterates through each atom d in the dictionary D k)。For each atom, the algorithm first calculates the remaining segmentation mask, i.e., the reconstruction error when the current atom is excluded. This involves subtracting the contributions of all other atoms from the reconstruction of each segmentation mask, resulting in a residual matrix R i = Y - D -i α -i , where Y represents the matrix of the entire segmentation mask, D -i and α -i are the dictionary and sparse coding after removing the i-th column. Then, using this residual, the optimization problem is solved by linear regression to find the best updated atom d i , which can minimize the reconstruction error related to R i . Once the optimal solution is found, the atom d i is updated into the dictionary and usually normalized to avoid numerical problems. The update is performed for each atom in turn until the representation error of the entire dictionary D for all signals y i is minimized.

[0066] The entire dictionary learning process is carried out alternately. First, D is fixed to update α i , then α i is fixed to update D. These two steps are iterated continuously until the convergence condition is met, and then the dictionary D and coefficients α that can effectively represent the segmented anatomical shapes in the source domain can be obtained i .

[0067] S2. Overall segmentation network construction step: construct an overall segmentation network composed of a source domain data segmentation branch network with double consistency regularization and a random augmented feature segmentation branch network; the source domain data segmentation branch network includes a domain-invariant shape reference segmentation model DIMD based on U-Net, and a shape reference mask generation module SRMG is added to DIMD to predict the first predicted shape coefficient vector of each medical image in the source domain. Based on the first predicted shape coefficient vector and the shape dictionary, a first shape reference mask is generated. After the first shape reference mask is cascaded with the features output by the U-Net decoder, a first predicted mask is generated; for the random augmented feature segmentation branch network, a random low-level feature augmentation module RLFA is added before the first layer of DIMD. For the features of the source domain medical images, three versions of randomly augmented features are obtained through a random convolutional layer with random weights generated by the input noise z. These three randomly augmented features are input into the U-Net encoder, and the features output by the U-Net encoder are input into the shape reference mask generation module SRMG to obtain the second predicted shape coefficient vector, the third predicted shape coefficient vector, and the fourth predicted shape coefficient vector. Then, in combination with the shape dictionary, a second shape reference mask, a third shape reference mask, and a fourth shape reference mask are obtained. After being cascaded with the features output by the U-Net decoder respectively, the predicted second augmented feature prediction mask, the third augmented feature prediction mask, and the fourth augmented feature prediction mask are output.

[0068] Once the dictionary D is trained, it can be integrated into the deep learning model, that is, the DIMD model proposed in this embodiment. When training the DIMD model, the shape dictionary is used as the prior of the shape, and the shape information obtained by dictionary learning is used to enhance the generalization ability of the model to the data in the unknown domain. The structure of the DIMD model is as Figure 2 shown.

[0069] Specifically, the DIMD model is designed based on U-Net. By adding a shape reference mask generation module (Shape reference mask generation module, SRMG), the shape coefficient vector of each medical image is predicted. Figure 2 Take the first predicted shape coefficient vector as an example in . SRMG takes the output of the U-Net encoder as the input, predicts the shape coefficient vector for each medical image. The shape coefficient vector is used to combine the shape dictionary of each category to generate the first shape reference mask. Finally, after the first shape reference mask is concatenated with the output of the U-Net decoder (Concat()), the features containing shape reference information are obtained, and then a 1x1 convolution is used to further refine and generate the final first predicted mask (segmentation mask). Specifically, the final layer of the U-Net encoder converts the deep features received through the global average pooling layer (GAP) to capture the global context information into a one-dimensional feature vector f. d, the SRMG receives f d , and then passes it through f d and the shape dictionary D c to predict the shape coefficient vectors for each anatomical category. For each category c, the SRMG designs a separate fully-connected layer to initialize the weights of the fully-connected layer with the atomic vectors c of the learned shape dictionary D , and sets the output size to the coefficient K of the same size as α i . By the SRMG learns specific shape features for each category By multiplying with the shape dictionary D c the shape reference mask M c can be generated, as shown in the following equation.

[0070]

[0071] Where represents the first predicted shape coefficient vector of the k-th explicit shape template; represents the k-th explicit shape template.

[0072] In the decoder part, the U-Net converts the high-level semantic features (deep features) of the encoder back to the resolution of the original input image through step-by-step upsampling and convolution operations, while fusing the skip connection features from the corresponding encoder layers. The output features of the decoder are concatenated with the shape reference mask predicted by the SRMG and then subjected to 1x1 convolution to generate the final output. The SRMG allows the network to utilize the prior information in the shape dictionary to enhance the accuracy and robustness of segmentation, especially when dealing with domain shift problems in unknown domains.

[0073] Since the purpose of the segmentation network is to adapt to unknown target domain data rather than just to have better segmentation results in the source domain, the objective of optimizing the network is to minimize the difference between the predicted shape coefficient vector and the coefficient ground truth value α obtained and optimized during its dictionary learning phase c , and the traditional segmentation loss. During the shape dictionary learning process, the shape coefficient vector α c is regularized into a sparse vector, which means that most elements are close to zero and only a few elements have large values. To maintain the sparse nature of the predicted coefficient vector, this embodiment introduces a cosine similarity loss, which pays more attention to the direction consistency between vectors rather than the magnitude of the absolute error. By emphasizing the direction consistency of the coefficient vectors, the model learns to recognize the general patterns of shape features instead of overfitting to the specific values in the training data, which can improve the generalization ability of the model to shapes in unknown domains. The specific shape coefficient loss L sf is as follows.

[0074]

[0075] Among them, C represents the total number of categories in the shape dictionary; represents the dot product of two coefficient vectors, is the product of the lengths of two coefficient vectors. Dividing these two gives the cosine similarity. τ is a very small constant used to avoid division by zero and is set to e -8 . The more consistent the two vectors are, the greater the cosine similarity, and L sf is smaller.

[0076] Use the combination of cross-entropy loss L CE and Dice loss L Dice to design the segmentation loss. The specific segmentation loss L seg is as follows.

[0077] L seg =γ 1 L CE +(1 - γ 1 )L Dice

[0078]

[0079] Among them, γ 1 represents the user-defined weight coefficient; y i,c is the true label of the sample x i for category c, and p i,c is the predicted probability that the model assigns the medical image sample x i to category c. τ is a very small constant used to avoid division by zero.

[0080] The shape reference mask can be integrated through the DIMD-based source domain data segmentation branch network to assist in solving the generalization problem in medical image segmentation. However, since the model is learned in a single source domain data distribution, the reliability of the generated shape coefficient cannot be guaranteed when used in an unknown domain with a distribution offset, thereby limiting the effective use of the shape reference mask. As follows, the unknown domain is simulated so that the segmentation model can achieve a good fitting effect in an unseen domain through the shape reference mask with the help of shape prior knowledge to achieve domain generalization. At present, some methods simulate unknown domains through image generation technology to ensure that shape priors can be effectively used to improve generalization performance under any unknown data distribution. However, these methods are usually computationally complex and expensive. Therefore, this embodiment proposes a random low-level feature augmentation module (RLFA), which aims to enhance low-level features while retaining the semantic information of deep features as much as possible, so as to simulate the data features of unknown domains.

[0081] It should be noted that the deep features involve more abstract semantic information, such as semantic structure and deformation. In the medical image segmentation task, the deep features may include the shape, size and relative position of the segmented structure, as well as the spatial relationship between them. These deep features help the network understand the correlation between different regions in the image and convert it into semantically meaningful information, so as to better complete the segmentation task.

[0082] Specifically, the data features of the unknown domain are simulated by modifying the low-level domain-specific features of the input image, such as texture and contrast, while keeping the shape of the object unchanged. The model enhances the generalization ability by learning the simulated data features of the unknown domain. Through the RLFA module, the model can more effectively handle unknown domains with distribution shifts without relying on complex and expensive image generation techniques. It is able to improve the generalization performance of the DIMD segmentation model while maintaining the effectiveness of the shape prior. The structure of the RLFA module is as follows: Figure 3 shown.

[0083] Before inputting the input image into the segmentation network, RLFA first inputs it into a convolutional layer with random weights. This random convolutional layer achieves random enhancement of domain-specific low-level features such as local textures in the image while maintaining the global shape features invariant to the domain by applying random filters. The reason why this random convolutional layer can achieve random enhancement of domain-specific features while keeping the global shape unchanged is that in an image, adjacent pixels usually naturally aggregate due to color or texture similarity, forming basic shapes representing specific objects or backgrounds. By using a convolutional layer with shared parameters, local blocks of the image can be linearly projected to corresponding positions in the output feature map, and the introduced random filters further allow these local blocks to be projected to arbitrary positions on the output feature map. Although the projection is random, this method can generally maintain the relative similarity between the input blocks, thus ensuring that the output feature map is consistent with the input image in shape, which generates an image with random domain-specific features but invariant domain features. By randomly selecting filters of different sizes, the generated image not only maintains a consistent global shape but also presents random local texture features. This process is shown as follows:

[0084]

[0085] where, is the enhanced feature vector output by the random convolution kernel, f i is the original feature vector of the input, * is the convolution operation, and Θ is the random convolution kernel. For Θ, its size is h and w are the height and width of the random convolution kernel, C in and C out are the number of channels of the input and output features. For the random convolution kernel 0, its weights are randomly generated, and in this way, local texture features are randomly enhanced to simulate the domain-specific features of the unknown domain. The size of the random convolution kernel Θ is also randomly sampled, generally randomly sampled from k ∈ [1, 3, 5, 7, 9, 11, 13], generating random enhanced features of different scales, so as to randomize local texture features while retaining the shape features of each scale. But by Figure 4It can be seen that when the size of the convolution kernel k is larger, the more distorted the shape semantics of the enhanced feature is, which leads to the destruction of the domain invariant features, affects the model's learning of basic shape semantics, and reduces the segmentation performance. To this end, this embodiment proposes to replace the large convolution kernel with a stack of multiple small convolution kernels. Specifically, by stacking multiple small convolution kernels, it is more fine-grained than the top ten convolution kernels, reducing the impact on pixels far from the center in the theoretical receptive field, thereby alleviating the semantic distortion problem and retaining the domain invariant feature of shape semantics as much as possible. Unlike the previous random weights, the multiple small convolution kernels in this combination share weights, which can gradually increase the distortion amplitude of a single transformation of the center pixel and more effectively randomly enhance domain-specific features. Therefore, the random sampling of the size of the random convolution kernel 0 is redefined as randomly sampling a corresponding number of 3x3 convolution kernel stacks from n∈[1,2,3,4,5,6,7]. The effect of the feature map enhanced by random convolution in this way is as follows. Figure 4 shown.

[0086] Even if the semantic distortion problem is avoided as much as possible through the above methods, random convolution may still introduce noise that disturbs the domain invariant information. In order to preserve the domain invariant information as much as possible, this section combines the enhanced feature vector obtained by random convolution with the original feature vector to generate a new feature vector that expands the domain range while keeping the source domain invariant information unchanged as much as possible. The process is shown below.

[0087]

[0088] Among them, β is the feature combination weight, and in order to maintain the randomness of RLFA, it is also randomly sampled. By combining the original feature vectors, the semantic shape features are further retained. Next, the generation process of the random weight is described. Currently, the generation of the random weight directly adopts the method of randomly sampling from the Gaussian distribution. Although this method can generate random convolution kernel weights from the Gaussian distribution, due to being random, the generated random enhanced features may still be similar to the source domain distribution, resulting in the inability to simulate the unseen target domain distribution, and the model will not only not improve the generalization ability of the model but also reduce the segmentation ability of the model. Based on this, in this embodiment, a random weight generation module (Randomweight generation module, RWGM) is embedded in the RLFA module, aiming to generate random weights by inputting a random noise, and then select high-frequency noise randomization features through gradient reversal during the training process to introduce enhanced features challenging to the model, thereby guiding the model to learn domain-invariant features from high-frequency noise and enhancing the domain generalization ability. The input noise z of RWGM is randomly sampled from the Gaussian distribution. For the input z, RWGM processes it through two stacked 3x3 transposed convolutional layers and a 3x3 convolutional layer. First, a transposed convolutional layer is used to upsample the input data to increase the size of the feature map. Then, a batch normalization layer is used to normalize the upsampled feature map, and a ReLU activation layer is connected to introduce non-linearity to help the network capture more complex patterns. Then this process is repeated again, and the feature map is continuously upsampled and its size is increased through another transposed convolutional layer, followed by a second batch normalization layer and a ReLU activation layer to further refine the features. Finally, the features are finally processed and adjusted through a 3x3 convolutional layer with a stride of 1 to generate precise 3x3 convolutional kernel random weights. Then the generated random weights are input into the random convolutional layer of the RLFA module to assign values to the random convolution kernel weights to generate randomly enhanced features. The structure of the RWGM module is as Figure 5 shown.

[0089] Then, in order to effectively improve the generalization ability of the model with the generated random augmented features, an adversarial domain augmentation strategy is proposed based on RWGM as follows to improve the generalization performance of the model on unknown domain data. The core of this strategy lies in leveraging the idea of adversarial training, enabling the model to generate and adapt to challenging samples that simulate the unknown domain during the training phase, and thus maintaining better performance and robustness when facing novel or unseen data in practical applications. Specifically, RWGM dynamically generates convolutional kernel weights from the RWGM module in each training iteration. These dynamically generated weights adjust the parameters of the convolutional layer, thereby generating data samples with new domain-specific features that are challenging and unseen for the model. This process continuously generates adversarial samples, forcing the model to learn how to effectively process these simulated unknown domain data. Then, a gradient reversal layer is added to adjust the processing loss of RWGM during backpropagation. Specifically, the gradient is multiplied by a negative constant (set to -1) and propagated to RWGM. The purpose of this step is to increase rather than decrease the loss of RWGM, thus promoting RWGM to generate augmented features that can maximize the current loss of the model during training, that is, expanding the domain-specific features of the unknown domain. These augmented features generated by the adversarial domain augmentation strategy, called challenging samples, represent possible domain variations or data distributions in unseen domains. In this way, the optimization problem is transformed into an adversarial problem, forcing the model to learn and find a feature representation that can adapt to both normal samples and adversarial samples. After generating the challenging samples, another part of the model (excluding RWGM) attempts to optimize the processing of these samples. This process is carried out through the normal training process, but the training data includes source domain samples and the generated challenging samples. In this way, the model gradually learns how to process a wider data distribution, including data in unseen domains that may be encountered in the future.

[0090] In summary, the structural diagram of the overall segmentation network in this embodiment is as Figure 6 shown. For the source domain dataset, first, a shape dictionary corresponding to it is generated through the dictionary learning method for subsequent use by the segmentation network. Then, an overall segmentation network composed of two DIMDs with double consistency regularization is proposed. For the source domain data segmentation branch network, the source domain data is segmented to obtain shape features shape reference mask M and predicted mask y. For the random augmented feature segmentation branch network, a random low-level feature augmentation module RLFA is added before the first layer of DIMD. For the input source domain image feature f i , three versions of random augmented features are obtained through a random convolutional layer with random weights generated from the input noise z: The features obtained by passing these three random augmented features through the last layer of the encoder are input into the shape reference mask generation module SRMG to obtain their respective shape features Then it is combined with the shape dictionary D to generate a shape reference mask Finally, the shape reference mask is cascaded with the features output by the decoder, and the predicted enhanced feature prediction mask is finally output In this process, gradient reversal is used to update the parameters of the random weight generation module RWGM

[0091] S3. Overall segmentation network training step: Based on the source domain medical image dataset, the overall segmentation network is trained through consistency loss, adversarial domain enhancement strategy loss, and overall shape coefficient loss to obtain a trained overall segmentation network

[0092] Specifically, the overall segmentation loss L of the single-source domain generalization medical image segmentation method based on the shape dictionary proposed in this embodiment total includes three parts, namely consistency loss L cons , adversarial domain enhancement strategy loss L ada and overall shape coefficient loss L sft , which are shown as follows

[0093] L total =γ 2 L cons +γ 3 L ada +γ 4 L sft ;

[0094]

[0095] Among them, γ 2 , γ 3 and γ 4 are custom weight coefficients respectively represent the second enhanced feature prediction mask, the third enhanced feature prediction mask, and the fourth enhanced feature prediction mask represents the first prediction mask respectively represent the second shape reference mask, the third shape reference mask, and the fourth shape reference mask represents the first shape reference mask; y represents the true segmentation mask of the source domain medical image data; α represents the true shape coefficient vector corresponding to the shape dictionary

[0096] S4. Medical image segmentation step: Use the trained overall segmentation network to segment the medical image to be processed

[0097] The single-source domain generalization medical image segmentation method based on the shape dictionary in this embodiment will be verified through experiments as follows, including the following steps

[0098] (1) Dataset

[0099] In the field of medical image segmentation, the medical image database is the cornerstone of medical image segmentation. Due to the difficulties in data acquisition and high requirements for data privacy, it is impossible to provide sufficient samples for medical image segmentation research. Therefore, the research and development in medical image segmentation are challenged by the small data samples. In this embodiment, the public fundus image dataset and prostate image dataset are mainly used for experiments. There are mainly three fundus image datasets, namely Drishti-GS, RIM-ONE_r3, and REFUGE challenge training sets, and three prostate image datasets, namely NCI, I2CVB, and PROMISE12.

[0100] (2) Data preprocessing

[0101] Specifically, there are the following problems if the whole medical image is directly used for training: The background information of the original image, such as the edge region and non-target structure, may introduce noise, affecting the model's ability to recognize key features and resulting in a decline in the model's resolution. Therefore, this paper introduces the concept of ROI (region of interest). The ROI image reduces background interference by focusing on the segmentation region, enabling the model to more attentively learn the details of these key regions, thereby improving the accuracy of segmentation.

[0102] Due to the limitation of the small data volume of the medical image dataset, the model directly trained with the medical image dataset is prone to problems such as overfitting and poor generalization ability. To improve the model training effect, this embodiment adopts a series of data augmentation strategies to simulate different visual effects and expand the training dataset. By image inversion, rotation, adjusting brightness and contrast, the diversity of samples can be artificially increased, which helps the model have better generalization ability in actual applications. After these enhancement processes, the fundus images are fixed and scaled to a size of 512×512, and for the prostate image dataset, each sample is adjusted to a size of 384×384 in the axial plane to ensure the consistency of data during the training process. At the same time, the images are randomly flipped and normalized so that the pixel values of each channel have a unified average value and standard deviation, further reducing the overfitting risk during the model training process. Through these preprocessing steps, the number of images in the training dataset increases and the quality improves, finally solving the limitation of the small data volume of the medical image dataset that causes difficulties in training the model.

[0103] (3) Evaluation metrics

[0104] To objectively evaluate the segmentation performance of the target domain model on the medical image dataset in the experiment, this embodiment selects two widely used standard metrics in image segmentation evaluation: Dice coefficient (Dice) and Average Surface Distance (ASD). These metrics together provide a comprehensive evaluation for the quantification of the segmentation effect. The Dice coefficient (Dice) compares the similarity between the predicted segmentation result and the true segmentation label. It calculates the ratio of twice the intersection area of the predicted and true segmentations to the sum of their respective areas. The value range of the Dice coefficient is from 0 to 1, and the higher the value, the closer the segmentation result is to the true situation, that is, the better the segmentation effect. The calculation formula is as follows.

[0105]

[0106] Among them, A is the set of predicted segmentation results, B is the set of true segmentation results, |A∩B| represents the number of elements in the intersection of sets A and B, |A| represents the number of elements in set A, and |B| represents the number of elements in set B.

[0107] The Average Surface Distance (ASD) measures the average distance between the predicted segmentation and the true segmentation surface. It calculates the average shortest distance from all points on the predicted segmentation to the true segmentation surface, as well as the average shortest distance from all points on the true segmentation to the predicted segmentation surface. The smaller the ASD value, the closer the segmentation result is to the true situation, that is, the higher the segmentation quality. The calculation formula is as follows.

[0108]

[0109] Among them, X1 and Y1 respectively represent the point sets on the predicted segmentation surface and the true segmentation surface, and ||x1 - y1|| represents the Euclidean distance between point x1 and point y1. ASD calculates the average shortest distance between all point pairs from X1 to Y1 and from Y1 to X1.

[0110] (4) Experimental environment and training configuration information

[0111] The software and hardware experimental environment in this experiment is shown in Table 1.

[0112] Table 1 Experimental software and hardware environment configuration;

[0113]

[0114] The detailed training parameters of this experiment are as follows:

[0115] The number of elements K in the shape dictionary is set to 24 in the fundus image experiment and 48 in the prostate image experiment. The Adam optimizer is used for training, with momentum of 0.9 and 0.99, and the learning rate is initialized to 1e -3, a total of 100 epochs are trained, and the batch size is set to 5. In the segmentation loss, γ 1 is set to 0.5, and in the total loss, γ 2 is set to 1, γ 3 is set to 1, γ 4 is set to 1 because this embodiment believes that maintaining the shape and prediction unchanged is equally important as constraining different enhanced outputs to be consistent. The initial value of the 3x3 convolutional kernel stack pool is n ∈ [1, 2, 3, 4, 5]. β is randomly sampled from the uniform distribution U(0, 0.5), and the noise z is randomly sampled from the normal distribution N(0, 1.0).

[0116] (5) Experimental design

[0117] The experiments in this embodiment are mainly to explore the following questions:

[0118] First, in the SDG medical image segmentation scenario, what is the accuracy of the proposed SDRA method? Is there any advantage compared with other SFUDA medical image segmentation methods and SDG medical image segmentation methods, and the results can be intuitively seen through the visualized segmentation results.

[0119] Second, in the SDG medical image segmentation scenario, what is the impact of the proposed DIMD and RLFA modules on the model performance? By using the same dataset and training process, four groups of ablation experiments are designed to verify the effectiveness of each module.

[0120] Third, in the SDG medical image segmentation scenario, what is the impact of placing the proposed RLFA module in different positions in the network encoder (such as the initial layer, middle layer, and posterior layer) on the model performance, and verify the effectiveness of the strategy in this chapter.

[0121] Fourth, in the SDG medical image segmentation scenario, what is the impact of the input of the weight generation module in the proposed RLFA module under different noise distributions (such as uniform distribution, Gaussian mixture distribution, and Gaussian distribution) on the model performance.

[0122] (6) Experimental results and analysis

[0123] (6.1) Analysis of fundus image segmentation experiment

[0124] Specifically, the experiments were mainly conducted using public fundus image datasets, including Drishti-GS, RIM-ONE_r3, and REFUGE challenge training sets. The segmentation performance of the model on the target domain dataset under the condition of single-source domain generalization was verified by three fundus image datasets. In this embodiment, the proposed single-source domain generalization model was trained from the REFUGE challenge training set, and then verified on the Drishti-GS dataset and the RIM-ONE_r3 dataset. The effectiveness of the SDRA method was verified by designing comparative experiments, and compared with other advanced SDG methods in the comparative experiments. Specifically, the M-ADA method, TTT method, BigAu method, FS method, and RandConv method were used as comparative methods. Among them, M-ADA is a method for creating adversarial domain enhancement of virtual data using Wasserstein autoencoders, the TTT method is a method for transforming into self-supervised rotation prediction when testing in the target domain, the BigAug method is a method for enhancing data through deep stacking transformation, the FSR method is a method for enhancing features through style randomization, and the RandConv method is a method for enhancing features through random convolution. At the same time, adding Baseline represents the direct migration method of predicting the target domain results from the baseline U-net model trained directly from the source domain data. In this experiment, all methods are trained 5 times and the average value of all evaluation indicators is taken.

[0125] Table 2 shows the results of different algorithms on the Drishti-GS dataset for the single-source domain generalization model trained on the REFUGE challenge training set. Compared with the baseline, various SDG methods have certain improvements, among which the SDRA method has the largest improvement in various evaluation indicators. Although the BigAug method is very close to the SDRA method in performance, BigAug simulates and synthesizes images in the target domain, while SDRA generates enhanced features through random convolution, and the overhead is much smaller than BigAug. SDRA has better Dice coefficients and ASD distances of optic cup and optic disc than other SDG methods, proving that SDRA can effectively solve the domain generalization problem on the Drishti-GS dataset. SDRA has a significant improvement over the RandConv method, which also uses random convolution to enhance features, with an increase of 3.45 and 3.1 in Dice coefficients of optic cup and optic disc, and a decrease of 1.49 and 1.01 in ASD distances of optic cup and optic disc, which proves the advancedness of the random weight generation module and convolution kernel stacking strategy proposed in this chapter.

[0126] Table 2 Comparison of results of different algorithms on REFUGE challenge training set → Drishti-GS dataset;

[0127]

[0128] Table 3 shows the results of single-source domain generalization models trained with different algorithms on the REFUGE challenge training set on the RIM-ONE_r3 dataset. It can be seen from the table that the SDRA method still performs the best among all SDG methods, which further proves the ability of the SDRA method to solve the problem of fundus image domain generalization. Among them, the Dice coefficient and ASD distance of the SDRA method are better than those of other SDG methods in both optic cup segmentation and optic disc segmentation.

[0129] Table 3 Comparison of results of different algorithms on the REFUGE challenge training set → RIM-ONE_r3 dataset;

[0130]

[0131] (6.2) Experimental analysis of prostate image segmentation

[0132] To prove the effectiveness of the SDRA method, three prostate image datasets, NCI-ISBI 2013, I2CVB, and PROMISE12, were further verified. In this embodiment, a single-source domain generalization model was trained on the prostate I2CVB dataset and then evaluated on the NCI-ISBI 2013 dataset and the PROMISE12 dataset. The comparison methods are the same as above, and the M-ADA method, TTT method, BigAug method, FSR method, RandConv method, and Baseline are used as comparison algorithms. The average values of the evaluation metrics for five training runs were also statistically analyzed.

[0133] Table 4 shows the results of single-source domain generalization models trained with different algorithms on the prostate I2CVB dataset on the NCI-ISBI2013 dataset. It can be seen that the Dice coefficient of the SDRA method performs the best among the SDG methods, 0.79 higher than the sub-optimal FSR method and 3.51 higher than the worst RandConv method. At the same time, the ASD of the SDRA method also performs the best among the SDG methods, 0.65 lower than the sub-optimal TTT. This proves the effectiveness of the SDRA method when generalized to the NCI-ISBI 2013 dataset.

[0134] Table 4 Comparison of results of different algorithms on the I2CVB dataset → NCI-ISBI 2013 dataset;

[0135] Method Dice ASD Baseline 77.72 9.42 M-ADA 81.76 6.84 TTT 83.18 6.12 BigAug 82.75 7.17 FSR 83.47 6.41 RandConv 80.75 7.82 SDRA 84.26 5.47

[0136] Table 5 Comparison of results of different algorithms on the I2CVB dataset → ROMISE12 dataset;

[0137] Method Dice ASD Baseline 75.42 11.14 M-ADA 81.21 6.89 TTT 81.92 7.92 Method Dice ASD BigAug 81.54 7.56 FSR 82.42 7.08 RandConv 80.14 8.24 SDRA 82.55 6.43

[0138] As shown in Table 5 above, the experimental results of the single-source domain generalization model trained by different algorithms on the prostate I2CVB dataset on the PROMISE12 dataset are presented. It can be seen that the SDRA method also performs the best among the SDG methods, with its Dice coefficient increased by 0.13 compared to FSR and the ASD distance decreased by 0.65 compared to FSR. This further proves the effectiveness of the SDRA method.

[0139] Figure 7 and Figure 8 respectively show the experimental results of different algorithms in the case of domain adaptation of fundus images and prostate images. It can be seen from the figure that if direct migration without using single-source domain generalization is performed, very poor segmentation results will be obtained, and the experimental results of other single-source domain generalization methods in the target domain are much worse than those of the SFUDA method that uses target domain data. The SDRA method of the embodiment provides domain generalization ability through domain-invariant feature and domain-specific feature learning, and it performs very well in terms of segmentation shape and boundary, and the prediction results are already close to the true labels.

[0140] From the above, the SDRA method proposed in this embodiment not only shows good generalization ability in the SDG scenario of the fundus image dataset, but also performs well on the prostate image dataset. This proves that the SDRA method can well enhance the generalization ability of the model through shape dictionary and random feature enhancement. Among them, shape dictionary learning enables the model to fully learn domain-invariant features, and random feature enhancement enables the model to learn invisible domain-specific features of unknown domains. The two together enhance the generalization ability of the model and achieve good performance in the above experiments.

[0141] (6.3) Ablation experiment

[0142] In this experiment, an ablation model was trained on the prostate I2CVB dataset and then evaluated on the NCI-ISBI 2013 dataset and the PROMISE12 dataset. As can be seen from Table 6, each module has a great improvement on the two unseen target domain data. The SDRA method can not only combine DIMD for accurate segmentation of the segmentation shape, but also combine RFLA to simulate low-level features of unseen domains through random data augmentation, which strengthens the segmentation ability of SDRA for boundaries. Therefore, SDRA can grasp both the segmentation shape and the boundary and achieve good domain generalization performance. Among them, DIMD and RFLA are both essential and provide essential support for the improvement of model performance.

[0143] Table 6 Comparison of results on the NCI-ISBI2013 dataset and the PROMISE12 dataset in the ablation experiment;

[0144]

[0145] (6.4) Other experiments

[0146] Verify the improvement effect of the proposed RLFA module on the model at different positions in the network architecture as follows. Design to place RLFA in different layers of Unet to train the model on the prostate I2CVB dataset, and then evaluate it on the NCI-ISBI 2013 dataset and the PROMISE12 dataset. As shown in Table 7, the results show that using the RLFA module in the initial layer can most improve the generalization ability of the model. On the contrary, placing RLFA in the middle layer and the subsequent layers will reduce the performance. Moreover, placing it in the middle layer will produce worse results than placing it in the subsequent layers, because the features in the subsequent layers are advanced and more resistant to random interference, so it is more difficult to simulate the feature distribution of data in the unknown domain. Therefore, in this embodiment, RLFA is placed in the initial layer before the first layer of the encoder to maximize the generalization performance of the model.

[0147] Table 7 Comparison of results of different embedding strategies on the NCI-ISBI2013 and PROMISE12 datasets;

[0148]

[0149] Explore the influence of noise distribution on the generalization performance of RLFA as follows. The noise distribution is used to generate input noise in the weight generation module of RLFA. Design three groups of comparative experiments, sampling noise from uniform distribution, Gaussian distribution, and Gaussian mixture distribution respectively. Also train the model on the prostate I2CVB dataset, and then evaluate it on the NCI-ISBI 2013 dataset and the PROMISE12 dataset. Table 8 shows the results, from which it can be seen that the Gaussian distribution can most improve the generalization ability of the model. And the simpler uniform distribution and Gaussian distribution have better effects than the complex Gaussian mixture distribution, which indicates that a complex distribution does not necessarily improve the performance. Although the performance of RLFA varies due to different noise distributions, it can all improve the generalization ability well, which proves the effectiveness of the RLFA module. In summary, in this embodiment, a simple Gaussian distribution is used as the input distribution of noise, which is not only simple enough but also can effectively improve the generalization ability of the model.

[0150] Table 8 Comparison of results of different noise distributions on the NCI-ISBI2013 and PROMISE12 datasets;

[0151]

[0152] As Figure 9 shown, this embodiment also discloses a single-source domain generalization medical image segmentation device based on a shape dictionary, including:

[0153] A shape dictionary learning module 901, which is used to generate a shape dictionary that can effectively represent the source domain segmentation anatomical shape and the corresponding true shape coefficient vector from the source domain medical image dataset through a dictionary learning method;

[0154] An overall segmentation network construction module 902, which is used to construct an overall segmentation network composed of a source domain data segmentation branch network and a randomly enhanced feature segmentation branch network with double consistency regularization; the source domain data segmentation branch network includes a domain-invariant shape reference segmentation model DIMD based on U-Net, and a shape reference mask generation module SRMG is added to DIMD to predict the first predicted shape coefficient vector of each medical image in the source domain. Based on the first predicted shape coefficient vector and the shape dictionary, a first shape reference mask is generated. After the first shape reference mask is cascaded with the features output by the U-Net decoder, a first predicted mask is generated; in the randomly enhanced feature segmentation branch network, a random low-level feature enhancement module RLFA is added before the first layer of DIMD. For the source domain medical image features, three versions of randomly enhanced features are obtained through a random convolution layer with random weights generated by the input noise z. These three randomly enhanced features are input into the U-Net encoder, and the features output by the U-Net encoder are input into the shape reference mask generation module SRMG to obtain the second predicted shape coefficient vector, the third predicted shape coefficient vector, and the fourth predicted shape coefficient vector. Then, they are combined with the shape dictionary to obtain the second shape reference mask, the third shape reference mask, and the fourth shape reference mask, which are cascaded with the features output by the U-Net decoder respectively to output the predicted second enhanced feature prediction mask, the third enhanced feature prediction mask, and the fourth enhanced feature prediction mask;

[0155] An overall segmentation network training module 903, which is used to train the overall segmentation network based on the source domain medical image dataset through consistency loss, adversarial domain enhancement strategy loss, and overall shape coefficient loss to obtain a trained overall segmentation network;

[0156] A medical image segmentation module 904, which is used to segment the medical image to be processed using the trained overall segmentation network.

[0157] The specific implementation of each module of a single-source domain generalization medical image segmentation device based on a shape dictionary is the same as that of a single-source domain generalization medical image segmentation method based on a shape dictionary, and will not be repeated in this embodiment.

[0158] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A single-source domain generalized medical image segmentation method based on shape dictionary, characterized in that: include: S1, shape dictionary learning step, generates a shape dictionary and a corresponding true shape coefficient vector that can effectively represent the source domain segmented anatomical shape from the source domain medical image dataset through a dictionary learning method; S2, an overall segmentation network construction step, constructing an overall segmentation network consisting of a source domain data segmentation branch network with dual consistency regularization and a random enhanced feature segmentation branch network; the source domain data segmentation branch network includes a domain invariant shape reference segmentation model DIMD based on U-Net, a shape reference mask generation module SRMG is added to DIMD to predict a first predicted shape coefficient vector of each medical image in the source domain, a first shape reference mask is generated based on the first predicted shape coefficient vector and a shape dictionary, and the first shape reference mask is cascaded with the features output by the U-Net decoder to generate a first prediction mask; The random enhanced feature segmentation branch network adds a random low-level feature enhancement module RLFA before the first layer of DIMD, obtains three versions of random enhanced features for source domain medical image features through a random convolution layer with random weights generated by input noise z, inputs the three random enhanced features into a U-Net encoder, and inputs the features output by the U-Net encoder into a shape reference mask generation module SRMG to obtain a second predicted shape coefficient vector, a third predicted shape coefficient vector, and a fourth predicted shape coefficient vector, which are then combined with a shape dictionary to obtain a second shape reference mask, a third shape reference mask, and a fourth shape reference mask, which are respectively cascaded with the features output by the U-Net decoder to output predicted second enhanced feature prediction masks, third enhanced feature prediction masks, and fourth enhanced feature prediction masks; S3, overall segmentation network training step, based on the source domain medical image dataset, the overall segmentation network is trained through consistency loss, adversarial domain enhancement strategy loss and overall shape coefficient loss to obtain a trained overall segmentation network; S4, the medical image segmentation step, uses the trained overall segmentation network to segment the medical image to be processed.

2. The single-source domain generalized medical image segmentation method based on shape dictionary according to claim 1, characterized in that: The optimization function in the shape dictionary generation process is expressed as follows: in, is the square of the L2 norm, used to calculate the Euclidean distance of the vector; ||·||1 is the L1 norm, used to force α i Sparsity; D = {d1, d2, …, d k ,…,d K }, represents the shape dictionary, D∈R K×H×W ; α={α1,α2,…,α i ,…,α N }, represents the true shape coefficient vector corresponding to the shape dictionary, α i represents the i-th true shape coefficient vector; y i represents the true segmentation mask of the i-th source domain medical image data; as a balancing parameter; N represents the total number of medical image samples in the source domain medical image dataset; K represents the total number of explicit shape templates in the shape dictionary; R represents a real number; H represents height; and W represents width.

3. The single-source domain generalized medical image segmentation method based on shape dictionary according to claim 2 is characterized in that: The shape dictionary generation process is optimized by alternation, including: S11, fix D, update α by minimum angle regression LARS i ,as follows: S12, fixed α i , update D by block coordinate descent as follows: S13, continuously iterate S11 and S12 until the convergence condition is met, and generate a shape dictionary that can effectively represent the segmented anatomical shape of the source domain and the corresponding true shape coefficient vector.

4. The single-source domain generalized medical image segmentation method based on shape dictionary according to claim 1, characterized in that: The source domain data segmentation branch network specifically includes a U-Net encoder, a shape reference mask generation module SRMG, a U-Net decoder, Concat() and a 1x1 convolution; the U-Net encoder takes the source domain medical image as input and outputs features to SRMG; SRMG predicts a first predicted shape coefficient vector for each medical image, the first predicted shape coefficient vector is used to generate a first shape reference mask in combination with a shape dictionary of each category, the first shape reference mask is Concat()ed with the output of the U-Net decoder to obtain features containing shape reference information, and then further refined through a 1x1 convolution to generate a final first predicted mask.

5. The single-source domain generalized medical image segmentation method based on shape dictionary according to claim 2, characterized in that: SRMG designs a separate fully connected layer for each category c The shape dictionary D of the generated category c c The atomic vector As the weight initialization of the fully connected layer; SRMG learns a specific first prediction shape coefficient vector for each class pass With shape dictionary D c Multiply to generate the first shape reference mask M c ,as follows: in, represents the first predicted shape coefficient vector of the kth explicit shape template; represents the k-th explicit shape template.

6. The single-source domain generalized medical image segmentation method based on shape dictionary according to claim 1, characterized in that: The random low-level feature enhancement module RLFA first inputs the source domain medical image into the random weight generation module RWGM before inputting the source domain medical image into the U-Net encoder; the random weight generation module RWGM has a convolutional layer with random weights, which realizes random enhancement of domain-specific low-level features of the image on the basis of keeping the domain-invariant global shape features unchanged by applying random filters.

7. The single-source domain generalized medical image segmentation method based on shape dictionary according to claim 6, characterized in that: Combine the enhanced feature vector obtained through the convolution layer with the original feature vector to obtain the final random enhanced feature as follows: Among them, β is the feature combination weight; i represents the i-th source domain medical image; f i represents the original feature vector; Represents the enhanced feature vector; j∈[1,3].

8. The single-source domain generalized medical image segmentation method based on shape dictionary according to claim 7, characterized in that: Enhanced feature vector It is expressed as follows: Among them, Θ is the random convolution kernel.

9. The single-source domain generalized medical image segmentation method based on shape dictionary according to claim 1, characterized in that: The overall segmentation loss L total It is expressed as follows: L total =γ2L cons +γ3L ada +γ4L sft ; Among them, L cons represents the consistency loss; L ada represents the adversarial domain enhancement strategy loss; L sft represents the overall shape factor loss; L sf Represents shape factor loss; L seg represents the segmentation loss combining cross entropy loss and Dice loss; γ2, γ3 and γ4 are custom weight coefficients; represent the second enhanced feature prediction mask, the third enhanced feature prediction mask and the fourth enhanced feature prediction mask respectively; represents the first prediction mask; denote a second shape reference mask, a third shape reference mask, and a fourth shape reference mask, respectively; represents the first shape reference mask; y represents the true segmentation mask of the source domain medical image data; α represents the true shape coefficient vector corresponding to the shape dictionary.

10. A single-source domain generalized medical image segmentation device based on shape dictionary, characterized in that: include: A shape dictionary learning module is used to generate a shape dictionary and a corresponding true shape coefficient vector that can effectively represent the source domain segmented anatomical shape from a source domain medical image dataset through a dictionary learning method; An overall segmentation network construction module is used to construct an overall segmentation network composed of a source domain data segmentation branch network with dual consistency regularization and a random enhanced feature segmentation branch network; the source domain data segmentation branch network includes a domain invariant shape reference segmentation model DIMD based on U-Net, a shape reference mask generation module SRMG is added to DIMD to predict a first predicted shape coefficient vector of each medical image in the source domain, a first shape reference mask is generated based on the first predicted shape coefficient vector and a shape dictionary, and the first shape reference mask is cascaded with the features output by the U-Net decoder to generate a first prediction mask; The random enhanced feature segmentation branch network adds a random low-level feature enhancement module RLFA before the first layer of DIMD, obtains three versions of random enhanced features for source domain medical image features through a random convolution layer with random weights generated by input noise z, inputs the three random enhanced features into a U-Net encoder, and inputs the features output by the U-Net encoder into a shape reference mask generation module SRMG to obtain a second predicted shape coefficient vector, a third predicted shape coefficient vector, and a fourth predicted shape coefficient vector, which are then combined with a shape dictionary to obtain a second shape reference mask, a third shape reference mask, and a fourth shape reference mask, which are respectively cascaded with the features output by the U-Net decoder to output predicted second enhanced feature prediction masks, third enhanced feature prediction masks, and fourth enhanced feature prediction masks; The overall segmentation network training module is used to train the overall segmentation network based on the source domain medical image dataset through consistency loss, adversarial domain enhancement strategy loss and overall shape coefficient loss to obtain a trained overall segmentation network; The medical image segmentation module is used to segment the medical image to be processed using the trained overall segmentation network.

Citation Information

Patent Citations

  • Medical image segmentation model training method, medical image segmentation method and medical image segmentation device

    CN113205528A

  • Fundus image semantic segmentation method based on domain generalization

    CN115601751A