Image segmentation model training method, image segmentation method, terminal and medium

By constructing virtual training and testing sets during image segmentation model training and employing a synchronous gradient alignment duality optimization method, the problem of insufficient memory and generalization ability of the model during training on different platforms is solved, thereby improving the effect and efficiency of image segmentation.

CN115409864BActive Publication Date: 2026-01-13SHANGHAI TECH UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211061312.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-31
Publication Date
2026-01-13
Estimated Expiration
2042-08-31

AI Technical Summary

Technical Problem

Existing image segmentation methods based on convolutional neural networks suffer from insufficient model memory or generalization ability when training models across different platforms, which affects the image segmentation results.

Method used

By training the image segmentation model sequentially based on each dataset, virtual training and virtual test sets are obtained. The image segmentation model is then optimized using a synchronous gradient alignment duality optimization method to enhance the model's memory and generalization capabilities.

Benefits of technology

This approach balances the model's memory and generalization capabilities when training the model across different platforms, improving image segmentation performance and efficiency, reducing storage redundancy, and enhancing the efficiency of model training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115409864B_ABST
    Figure CN115409864B_ABST
Patent Text Reader

Abstract

The application provides an image segmentation model training method, an image segmentation method, a terminal and a computer storage medium, wherein when a single model training is performed, the method comprises the following steps: obtaining a virtual training set and a virtual test set based on a current data set and a current example set; the current example set is a collection of example data obtained when each model training before the current model training is performed; based on each data set, a dual element optimization method with synchronous gradient alignment is used to optimize a current image segmentation model to obtain a current optimized image segmentation model; example sample data is obtained in the current data set, and the current example set is updated based on the example sample data; the application can balance the memory capacity and the generalization capacity of the image segmentation model, thereby improving the image segmentation effect and the segmentation efficiency of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image segmentation technology, and in particular to an image segmentation model training method, an image segmentation method, a terminal, and a computer storage medium. Background Technology

[0002] Image segmentation refers to dividing an image into several non-overlapping sub-regions, such that features within the same sub-region have a certain similarity, while features between different sub-regions show significant differences. It is a key step in image processing and image analysis; the accuracy of image segmentation has a significant impact on the results of image processing and analysis.

[0003] Image segmentation methods based on convolutional neural networks have been widely used due to their high accuracy and robustness. However, these methods typically require a large amount of training data to train the model. Currently, the common approach is to centralize different training datasets on the same server before training. This consumes a significant amount of physical storage space to store the various training data and training process data, leading to increased hardware costs. Furthermore, with the rapid development and widespread adoption of the Internet of Things (IoT), data often resides on various platforms or terminals. For example, in the clinical medical field, training data is typically stored in different medical centers, and the data from these centers is streamed online.

[0004] However, existing image segmentation methods based on convolutional neural networks typically define memorization and generalization as two separate tasks during model training. Consequently, when performing cross-platform training across different platforms or sequentially training models using different datasets, they often lack the ability to memorize previous data streams (data from previous platforms) and the generalization ability to handle unknown data from subsequent platforms. Summary of the Invention

[0005] In view of the shortcomings of the prior art, the purpose of this invention is to provide an image segmentation model training method, an image segmentation method, a terminal, and a computer storage medium to solve the problems of insufficient model memory or insufficient model generalization ability when existing image segmentation models are trained on different platforms or using different datasets, i.e., model memory and generalization cannot be taken into account at the same time, which affects the image segmentation effect.

[0006] To achieve the above and other related objectives, the present invention provides, in a first aspect, an image segmentation model training method, characterized in that: the image segmentation model is trained sequentially based on each set of datasets; during a single training iteration of the model, the method includes: obtaining a virtual training set and a virtual test set based on the current dataset and the current example set; the current example set being a collection of example data obtained during previous training iterations of the model prior to the current training iteration; optimizing the current image segmentation model using a synchronous gradient alignment duality optimization method based on each dataset to obtain the optimized image segmentation model; and obtaining example sample data from the current dataset to update the current example set based on the example sample data.

[0007] In one embodiment of the present invention, obtaining a virtual training set and a virtual test set based on the current dataset and the current example set includes: merging the current dataset and the current example set to obtain the current total dataset; and using a random sampling method to divide the total dataset into the virtual training set and the virtual test set.

[0008] In one embodiment of the present invention, the optimization of the current image segmentation model using the synchronous gradient alignment duality optimization method includes: optimizing the current image segmentation model based on the current dataset and the virtual training set using a first loss function to obtain a first optimized model and a second optimized model; and optimizing the current image segmentation model based on the current example set and the virtual test set using a second loss function, the first optimized model, and the second optimized model to obtain an optimized image segmentation model; wherein the current image segmentation model is the optimized image segmentation model obtained in the previous model training.

[0009] In one embodiment of the present invention, optimizing the current image segmentation model based on the current dataset and the virtual training set respectively includes: calculating the loss function of the current image segmentation model based on the current dataset using a method that minimizes the first cross-entropy loss function, to obtain the dataset gradient corresponding to the first cross-entropy loss function; optimizing the current image segmentation model based on the dataset gradient to obtain the model parameters of the optimized first optimized model; and calculating the loss function of the current image segmentation model based on the virtual training set using a method that minimizes the first cross-entropy loss function, to obtain the corresponding virtual training set gradient; and optimizing the current image segmentation model based on the virtual training set gradient to obtain the model parameters of the optimized second optimized model.

[0010] In one embodiment of the present invention, the first cross-entropy loss function includes:

[0011] L ce1 =y i log p i +(1-y i log(1-p) i )

[0012] Where, p i y represents the probability that pixel i in the current dataset or the virtual training set is identified as a segmented foreground. i This indicates the probability that image pixel i in the current dataset or the virtual training set is a foreground pixel in the label data corresponding to the image.

[0013] In one embodiment of the present invention, the image segmentation model includes a convolutional neural network, comprising an encoder, a decoder, and a segmenter; the step of calculating the loss function of the current image segmentation model based on the current dataset includes: encoding each image sample data based on the encoder to obtain feature codes for each image sample data; decoding the feature codes based on the decoder to obtain new image sample data; segmenting the new image sample data based on the segmenter to obtain corresponding segmentation results; and calculating the loss function value of the current image segmentation model based on the segmentation results of each image sample data and the corresponding label information.

[0014] In one embodiment of the present invention, optimizing the current image segmentation model based on the current example set and the virtual test set includes: calculating the loss function of the first optimized model based on the current example set using a method that minimizes the second cross-entropy loss function to obtain the corresponding example set gradient; and calculating the loss function of the second optimized model based on the virtual test set using a method that minimizes the second cross-entropy loss function to obtain the corresponding virtual test set gradient; and optimizing the current image segmentation model based on the example set gradient and the virtual test set gradient to obtain the model parameters of the optimized image segmentation model.

[0015] In one embodiment of the present invention, the second cross-entropy loss function includes:

[0016] L ce2 =w i log q i +(1-w i log(1-q) i )

[0017] Where, q i y represents the probability that image pixel i in the current example set or the virtual test set is identified as a segmented foreground. iThe table represents the probability that image pixel i in the current example set or the virtual test set is a foreground pixel in the label data corresponding to the image.

[0018] In one embodiment of the present invention, the example sample data is sample data used to characterize the data distribution characteristics in the current dataset; the step of obtaining the example sample data includes: obtaining the image feature values ​​of each image sample data in the current dataset, and obtaining the mean of the image feature values ​​corresponding to the current dataset, and calculating the feature distance between the image feature values ​​of each image sample data and the mean of the feature values; obtaining the center points of each previous example set respectively; wherein, the previous example set is the current example set obtained by performing each previous model training; calculating the mean of the dispersion between each image sample data and each center point in the current dataset; obtaining the distribution characteristics of each image sample data based on the feature distance and the mean of dispersion of each image sample data; sorting the distribution characteristic values ​​corresponding to each image sample data according to their numerical values, and extracting the M image sample data with the largest distribution characteristic values ​​from each image sample data as the example sample data.

[0019] The present invention provides an image segmentation method in a second aspect, comprising: constructing datasets based on various groups of image sample data; training a preset image segmentation model using any of the image segmentation model training methods described above based on each dataset to obtain a trained image segmentation model; and performing image segmentation using the trained image segmentation model on an input image to obtain a segmentation result of the input image.

[0020] In a third aspect, the present invention provides a terminal, comprising: a processor and a memory; the memory for storing a computer program, and the processor for executing the computer program stored in the memory, so that the terminal performs any of the image segmentation model training methods described above or the image segmentation methods described above.

[0021] In a fourth aspect, the present invention provides a computer storage medium storing a computer program, the computer program being executed by a processor using any of the image segmentation model training methods described above or the image segmentation methods described above.

[0022] As described above, the image segmentation model training method, image segmentation method, device, and computer storage medium proposed in this invention construct an example set, and obtain a virtual training set and a virtual test set based on the current dataset and the current example set. Furthermore, based on each dataset, a dual-element optimization method with synchronous gradient alignment is used to train the image segmentation model. This method coordinates gradients on the current example set through directional gradient alignment, thereby enhancing the model's memory capacity. Random alignment encourages center invariance under randomly segmented data, thereby enhancing the model's generalization ability. Thus, when the image segmentation model is trained on different platforms or using different datasets, a balance between the model's memory capacity and generalization ability can be achieved, thereby improving the model's image segmentation effect and efficiency. Attached Figure Description

[0023] Figure 1 The image segmentation model training method provided by the present invention is shown to be executed in a single implementation in one step.

[0024] A schematic diagram illustrating the model training process;

[0025] Figure 2 The image segmentation method described in this invention utilizes synchronous gradient alignment for duality optimization.

[0026] A flowchart illustrating the optimization of the model in one embodiment;

[0027] Figure 3 The diagram shows a flowchart of the loss function calculation of the current image segmentation model based on the current dataset in one embodiment of the present invention.

[0028] Figure 4 The diagram shows a flowchart of an implementation of the image segmentation method provided by the present invention.

[0029] Figure 5 The diagram shown is a structural schematic of the terminal provided by the present invention in one embodiment. Detailed Implementation

[0030] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.

[0031] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Therefore, the drawings only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0032] To address the problems existing in the prior art, the present invention provides an image segmentation model training method in the first aspect, which sequentially trains the image segmentation model based on each set of datasets to obtain an image segmentation model that balances model memory ability and model generalization ability.

[0033] Each of the aforementioned datasets is an image sample dataset, including each image data and label data corresponding to the image data; the label data is the label information corresponding to each pixel in the image data.

[0034] In one specific embodiment, each set of image sample datasets is medical image sample data stored on the corresponding hospital platform / center, including medical image sample data and corresponding gold standard data, wherein the gold standard data is the label information corresponding to each pixel in the corresponding image sample data.

[0035] The image segmentation model is trained based on medical image sample data collected from a single hospital platform / center. Then, the previously trained image segmentation model is trained again based on medical image sample data collected from the next hospital platform / center. This process is repeated until the process is terminated to obtain the final trained image segmentation model.

[0036] Please see Figure 1 The diagram shows a flowchart of the image segmentation model training method described in this embodiment of the invention during a single model training iteration.

[0037] like Figure 1 As shown, the image segmentation model training method includes the following steps when performing a single model training:

[0038] S100, obtain the current dataset and the current example set; based on the current dataset and the current example set, obtain the virtual training set and the virtual test set;

[0039] Wherein, the current dataset is the sample data set D of the current batch. t ;

[0040] The current example set is the collection of example data obtained during each model training iteration prior to the current model training, and is as follows:

[0041] P = {P1, P2, ..., P}t-1};

[0042] Among them, P1, P2...P t-1 These are the example data obtained during previous model training sessions, and are subsets of the current dataset corresponding to the previous model training sessions.

[0043] The current dataset and the current example set are merged to obtain the current total dataset C = {D}. t The total dataset is divided into a virtual training set C using a random sampling method. tr and virtual test set C te ; wherein, the virtual training set C tr and virtual test set C te It is used to simulate different data distributions during the training and testing phases in actual use, thereby improving the model's generalization ability.

[0044] S200, Based on the datasets mentioned above, the current image segmentation model is optimized using the synchronous gradient alignment dual element optimization method to obtain the current optimized image segmentation model;

[0045] The current image segmentation model is the optimized image segmentation model obtained during the previous image model training process.

[0046] Specifically, the dual-element optimization method using synchronous gradient alignment is used to optimize the current image segmentation model, such as... Figure 2 As shown, it includes:

[0047] S201, using the first loss function, optimize the current image segmentation model based on the current dataset and the virtual training set respectively, so as to obtain the first optimized model and the second optimized model accordingly;

[0048] In this embodiment, the first loss function is the first cross-entropy loss function;

[0049] Specifically, by minimizing the first cross-entropy loss function, the loss function of the current image segmentation model is calculated based on the current dataset to obtain the dataset gradient corresponding to the first cross-entropy loss function. Based on dataset gradient The current image segmentation model is optimized to obtain the model parameters of the optimized first model, which are:

[0050]

[0051] Where Θ represents the model parameters of the current image segmentation model; γ is the first optimized model parameter; γ is the first learning rate hyperparameter.

[0052] Furthermore, by employing the method of minimizing the first cross-entropy loss function, based on the virtual training set, the loss function of the current image segmentation model is calculated to obtain the corresponding virtual training set gradient. Based on the gradient of the virtual training set The current image segmentation model is optimized to obtain the model parameters of the optimized second model, which are as follows:

[0053]

[0054] in, β represents the second optimized model parameter; β is the second learning rate hyperparameter.

[0055] In one specific implementation, the first cross-entropy loss function is:

[0056] L ce1 =y i log p i +(1-y i log(1-p) i )

[0057] Where, p i y represents the probability that pixel i in the current dataset or the virtual training set is identified as a segmented foreground. i This indicates the probability that image pixel i in the current dataset or the virtual training set is a foreground pixel in the label data corresponding to the image.

[0058] S202, using the second loss function, the first optimization model, and the second optimization model, the current image segmentation model is optimized based on the example set and the virtual test set, respectively, to obtain an optimized image segmentation model;

[0059] Specifically, by minimizing the second cross-entropy loss function, the first optimization model is calculated based on the example set to obtain the corresponding example set gradient G. P ;

[0060] Furthermore, by employing the method of minimizing the second cross-entropy loss function, the loss function of the second optimization model is calculated based on the virtual test set to obtain the corresponding virtual test set gradient.

[0061] Based on the gradient G of the example set P and the gradient G of the virtual test set te The current image segmentation model is optimized to obtain the model parameters of the optimized image segmentation model; that is, the model parameters are used as the optimal solution of the current image segmentation model.

[0062] In one specific implementation, the second cross-entropy loss function is:

[0063] L ce2 =w i log q i +(1-w i log(1-q) i )

[0064] Where, q i y represents the probability that image pixel i in the current example set or the virtual test set is identified as a segmented foreground. i The table represents the probability that image pixel i in the current example set or the virtual test set is a foreground pixel in the label data corresponding to the image.

[0065] S300, extract several example sample data from the current dataset; update the current example set based on the example sample data.

[0066] The example sample data refers to sample data used to characterize the data distribution characteristics in the current dataset; optionally, the data distribution characteristics include the mean and variance of each data point.

[0067] Specifically, the mean of the image feature values ​​corresponding to each sample data in the current dataset is obtained; the feature distance between the image feature value of each sample data and the mean of the feature values ​​is calculated as follows:

[0068]

[0069] in, f is the i-th sample data in the current dataset; Θ () represents the image encoder. The image features are based on the i-th sample data obtained from the graphics encoder; μ t This represents the mean of the image features corresponding to each sample in the current dataset. The feature distance between the i-th sample data and the feature mean is used to characterize the degree of similarity between the i-th sample data and the mean of the current dataset.

[0070] It should be noted that this image encoder is the same as the encoder in the image segmentation model.

[0071] Obtain the center point P of each of the previous example sets. k The previous example set refers to the current example set obtained during each previous model training process.

[0072] For each sample data in the current dataset, calculate its distance from each center point P.k The mean of the dispersion between them is:

[0073]

[0074] in, Represents the i-th sample data in the current dataset. With each center point P k The degree of dispersion; For the i-th sample data With each center point P k The mean of the dispersion is used to characterize the degree of dispersion between the i-th sample data and the center point of the previous example set.

[0075] Based on the feature distance and the mean dispersion of each image sample data, the distribution characteristics of each image sample data are obtained as follows:

[0076]

[0077] in, denoted as the distribution characteristics of the image sample data; a and b are parameter weights.

[0078] The distribution feature values ​​corresponding to each of the image sample data are sorted according to their numerical values. The M image sample data with the largest distribution feature values ​​are extracted from each of the image sample data and used as the example sample data. The extracted example sample data is stored in the current example set to obtain a new current example set, thereby updating the current example set and improving the training efficiency and training effect of the model.

[0079] Where M is a positive integer, set according to training requirements; and M is the same in each training process of the model.

[0080] Based on each dataset, repeat steps S100 to S300 until exiting, thus completing the model training process for each dataset, or exiting when the training termination condition is met, thereby obtaining the trained image segmentation model.

[0081] It should be noted that there is no limitation on the execution order between steps S200 and S300 in this invention. That is, in other embodiments, step S200 is executed after step S300.

[0082] In one specific embodiment, the image segmentation model includes a deep convolutional neural network, comprising an encoder, a decoder, and a segmenter; the loss function calculation of the current image segmentation model based on the current dataset is performed during execution, such as... Figure 3 As shown, it includes the following sub-steps:

[0083] S801, based on the encoder, each of the image sample data is encoded to obtain the feature code of each of the image sample data;

[0084] Specifically, each image sample data is subjected to three encoding operations in sequence. Each encoding operation includes four operations: Convolution, Batch Normalization, ReLU, and MaxPooling.

[0085] In a more specific implementation, in the three encoding operations, the convolution kernel size corresponding to the convolution operation is 3*3; the convolution stride is 1; and the convolution kernel depth is 64, 128, and 256 respectively. The input image sample data is a 384*384*1 image, and the final output is data with a dimension of 48*48*256.

[0086] S802, Decode the feature encoding based on the decoder to obtain new image sample data;

[0087] The 48*48*256 dimensional data obtained in step S801 is subjected to three decoding operations in sequence. Each decoding operation includes four operations: Convolution, Batch Normalization, ReLU, and DeConvolution.

[0088] The convolutional layer parameters in the decoding operation are set the same as those in the encoding operation, and the final output is data with dimensions of 384*384*64.

[0089] S803, Based on the segmenter, the new image sample data is segmented to obtain the corresponding segmentation result;

[0090] The 384*384*64 dimension data obtained in step S803 is subjected to convolution and SoftMax operations in sequence to obtain the segmentation result.

[0091] In a more specific implementation, the convolution kernel size is 3*3; the stride is 1; and the kernel depth is 2. Finally, a segmentation result of 384*384*2 is obtained; where the first channel represents the probability of each pixel being background, and the second channel represents the probability of each pixel being foreground.

[0092] S804, based on the segmentation results and corresponding label information of each image sample data, calculate the loss function value of the current image segmentation model.

[0093] It should be noted that, as those skilled in the art will know, the image segmentation model can also be other existing convolutional neural network models, which will not be elaborated here.

[0094] To address the problems existing in the prior art, the present invention provides an image segmentation method in a second aspect, for performing an image segmentation process on an input image to obtain an image segmentation result.

[0095] Please see Figure 4 The diagram illustrates a flowchart of an embodiment of the image segmentation method provided by the present invention. For ease of explanation, only the parts relevant to the embodiments of the present invention are shown; for specific technical details not disclosed, please refer to the embodiments of the image segmentation model training method of the present invention.

[0096] like Figure 4 As shown, the image segmentation method includes the following steps:

[0097] S10, construct each dataset based on the image sample data of each batch;

[0098] The graphic sample data in each batch includes each image data and the label information corresponding to the image data; the label information is the classification label information corresponding to the image data.

[0099] In one specific embodiment, the batch image sample data are medical image sample data stored on the corresponding hospital platform / center.

[0100] S20, Based on each of the datasets, the preset image segmentation model is trained to obtain the trained image segmentation model;

[0101] Specifically, adopt Figure 1 The image segmentation model training method shown herein trains a preset image segmentation model; the specific model training process is the same as the model training process described above, and will not be repeated here.

[0102] In one specific embodiment, the image segmentation model includes a deep convolutional neural network, comprising an encoder, a decoder, and a segmenter;

[0103] S30, For the input image, perform image segmentation using the trained image segmentation model to obtain the segmentation result of the input image.

[0104] To address the technical problems existing in the prior art, this embodiment of the invention also provides a terminal. Please refer to Figure 5, which shows a structural schematic diagram of the terminal described in this invention; Figure 5As shown, the terminal 5 includes a memory 51 and a processor 52 connected to each other; the memory 51 is used to store computer programs, and the processor 52 is used to execute the computer programs stored in the memory, so that when the terminal is executed, it can implement the image segmentation model training method or the steps in the image segmentation method as described above.

[0105] Optionally, the number of memories can be one or more, and the number of processors can be one or more. Figure 5 Each example is taken as an instance.

[0106] Optionally, the processor in the terminal loads one or more instructions corresponding to the application process into the memory according to the steps of the image segmentation model training method or the image segmentation method described above, and the processor runs the application stored in the memory, thereby realizing the functions of the image segmentation model training method or the image segmentation method described above, which will not be elaborated here.

[0107] It should be noted that memory includes, but is not limited to, random access memory (RAM), and may also include non-volatile memory, such as at least one disk storage device. Similarly, processors can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0108] This invention also provides a computer-readable storage medium storing a computer program that, when called by a processor, implements the image segmentation model training method or the image segmentation method described above.

[0109] A computer-readable storage medium can be a tangible device capable of holding and storing instructions used by an instruction execution device. Computer-readable storage media can be, for example, (but not limited to) electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, and mechanical encoding devices.

[0110] The computer-readable program described herein can be downloaded from a computer-readable storage medium to various computing / processing devices, or downloaded via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network, to an external computer or external storage device. A network adapter card or network interface in each computing / processing device receives computer-readable program instructions from the network and forwards these instructions to the computer-readable storage medium in the respective computing / processing device.

[0111] In summary, the image segmentation model training method, image segmentation method, device, and computer storage medium proposed in this invention, through constructing an example set and obtaining virtual training and virtual test sets based on the current dataset and example set, and training the image segmentation model using a synchronous gradient alignment duality optimization method based on each dataset, can enhance the model's memory capacity by aligning gradients in a directional manner to coordinate gradients on the current example set, and enhance the model's generalization ability by encouraging center invariance under randomly segmented data through random alignment. This enables the image segmentation model to be executed across different platforms. During training, or when training the model using different datasets, the model's memory capacity and generalization ability can be balanced, thereby improving the model's image segmentation performance and efficiency. Furthermore, using the dual-method optimization approach to handle the synchronous gradient alignment objective allows it to be treated as a dual meta-objective function for solution, thus avoiding the second-order derivative problem caused by direct optimization, and further improving the model's optimization efficiency. In addition, using an example set configuration scheme to obtain example data allows each example data to characterize the representation and intermediate differences of the dataset, thereby reducing storage redundancy in the example set and improving the efficiency of model training.

[0112] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.

Claims

1. A method for training an image segmentation model, characterized in that, Based on each dataset, the image segmentation model is trained sequentially. During a single training iteration of the model, the following are included: Based on the current dataset and the current example set, obtain a virtual training set and a virtual test set; the current example set is the collection of example data obtained during each model training session before the current model training is performed; Based on the datasets mentioned above, the dual-element optimization method with synchronous gradient alignment is used to optimize the current image segmentation model to obtain the current optimized image segmentation model. Obtain example sample data from the current dataset, and update the current example set based on the example sample data; The method of optimizing the current image segmentation model using synchronous gradient alignment duality optimization includes: optimizing the current image segmentation model based on the current dataset and the virtual training set using a first loss function to obtain a first optimized model and a second optimized model; and optimizing the current image segmentation model based on the current example set and the virtual test set using a second loss function, the first optimized model, and the second optimized model to obtain an optimized image segmentation model; wherein the current image segmentation model is the optimized image segmentation model obtained in the previous model training. The example sample data is sample data used to characterize the data distribution characteristics in the current dataset; obtaining the example sample data includes: obtaining the image feature values ​​of each image sample data in the current dataset, obtaining the mean of the image feature values ​​corresponding to the current dataset, and calculating the feature distance between the image feature values ​​of each image sample data and the mean of the feature values; obtaining the center points of each previous example set respectively; wherein, the previous example set is the current example set obtained by performing each previous training of the model; calculating the mean of the dispersion between each image sample data and each center point in the current dataset; obtaining the distribution characteristics of each image sample data based on the feature distance and the mean of the dispersion of each image sample data; sorting the distribution characteristic values ​​corresponding to each image sample data according to their numerical values, and extracting the M image sample data with the largest distribution characteristic values ​​from each image sample data as the example sample data.

2. The image segmentation model training method according to claim 1, characterized in that, The process of obtaining virtual training and virtual test sets based on the current dataset and current example set includes: The current dataset and the current example set are merged to obtain the current total dataset; The total dataset is divided into the virtual training set and the virtual test set using a random sampling method.

3. The image segmentation model training method according to claim 1, characterized in that, The optimization of the current image segmentation model based on the current dataset and the virtual training set includes: The method of minimizing the first cross-entropy loss function is adopted. Based on the current dataset, the loss function of the current image segmentation model is calculated to obtain the dataset gradient corresponding to the first cross-entropy loss function. Based on the dataset gradient, the current image segmentation model is optimized to obtain the model parameters of the optimized first model. The loss function of the current image segmentation model is calculated based on the virtual training set by minimizing the first cross-entropy loss function to obtain the corresponding virtual training set gradient. The current image segmentation model is then optimized based on the virtual training set gradient to obtain the model parameters of the optimized second model.

4. The image segmentation model training method according to claim 3, characterized in that, The first cross-entropy loss function, include: L ce1 =y i logp i +(1-y i )log(1-p i ) Where, p i y represents the probability that pixel i in the current dataset or the virtual training set is identified as a segmented foreground. i This indicates the probability that image pixel i in the current dataset or the virtual training set is a foreground pixel in the label data corresponding to the image.

5. The image segmentation model training method according to claim 3, characterized in that, The image segmentation model includes a convolutional neural network, comprising an encoder, a decoder, and a segmenter; the loss function calculation for the current image segmentation model based on the current dataset includes: The encoder encodes each image sample data to obtain the feature code of each image sample data; The feature encoding is decoded based on the decoder to obtain new image sample data; The new image sample data is segmented based on the segmenter to obtain the corresponding segmentation result; Based on the segmentation results and corresponding label information of each image sample data, the loss function value of the current image segmentation model is calculated.

6. The image segmentation model training method according to claim 1, characterized in that, The optimization of the current image segmentation model based on the current example set and the virtual test set includes: The method of minimizing the second cross-entropy loss function is used to calculate the loss function of the first optimization model based on the current example set to obtain the corresponding example set gradient; and the method of minimizing the second cross-entropy loss function is used to calculate the loss function of the second optimization model based on the virtual test set to obtain the corresponding virtual test set gradient. Based on the gradients of the example set and the gradients of the virtual test set, the current image segmentation model is optimized to obtain the model parameters of the optimized image segmentation model.

7. The image segmentation model training method according to claim 6, characterized in that, The second cross-entropy loss function, include: L ce2 =w i logq i +(1-w i )log(1-q i ) Where, q i w represents the probability that image pixel i in the current example set or the virtual test set is identified as a segmented foreground. i The table represents the probability that image pixel i in the current example set or the virtual test set is a foreground pixel in the label data corresponding to the image.

8. An image segmentation method, characterized in that, include: Each dataset is constructed based on the image sample data of each group; Based on each of the datasets, the image segmentation model is trained using the image segmentation model training method as described in any one of claims 1 to 7 to obtain the trained image segmentation model; For the input image, the trained image segmentation model is used to perform image segmentation to obtain the segmentation result of the input image.

9. An electronic device, characterized in that, include: Processor and memory; The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to cause the electronic device to perform the image segmentation model training method as described in any one of claims 1 to 7, or the image segmentation method as described in claim 8.

10. A computer storage medium storing a computer program, characterized in that, The computer program is executed by a processor using the image segmentation model training method as described in any one of claims 1 to 7, or the image segmentation method as described in claim 8.

Citation Information

Patent Citations

  • Model training method and device and storage medium

    CN110163234A

  • Domain adaptive model training method and device, image detection method and device, equipment and medium

    CN111860670A