Image generation method for multiple target domains

Through the pre-training generator and Gaussian distribution sampling technology, the problem of training complexity and poor integration of existing models in multi-objective domain conversion is solved, and an efficient and universal image generation method is realized, which is suitable for the correction of different visual defect diseases.

CN118608632APending Publication Date: 2024-09-06XIDIAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310200466.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-03
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

Existing image translation models are not suitable for conversion between multiple target domains. They need to retrain the model for each two domains, resulting in complex training and poor integration, and cannot effectively deal with different visual defect diseases.

Method used

Use a pre-trained generator to generate a Gaussian distribution by obtaining the preset mean and variance of the source image and the target image, sample the input noise, combine the source image to generate the target image, and use forward and reverse generative adversarial networks to achieve images in multiple target domains transformation, simplifying the training process and improving model generality.

Benefits of technology

It achieves high-quality multi-target domain image conversion, improving conversion efficiency and model versatility. Users can set the target domain according to needs and control the direction and field of image generation. The generated images are diverse and high-quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118608632A
    Figure CN118608632A
Patent Text Reader

Abstract

The invention discloses an image generation method for multiple target domains. The method comprises the following steps: acquiring a source image, and a preset mean value and a preset variance corresponding to a target domain to which a target image to be converted from the source image belongs; generating preset Gaussian distribution according to a preset mean value and a preset variance; sampling preset Gaussian distribution to obtain input noise; inputting the source image and the input noise into a pre-trained generator to generate a target image; the pre-trained generator corresponds to a plurality of different target domains, and preset mean values and preset variances corresponding to the different target domains are different; the pre-trained generator is obtained by training an initial generative adversarial network by adopting multiple pairs of training samples, and the initial generative adversarial network comprises a forward generative adversarial network and a reverse generative adversarial network; each of the forward generative adversarial network and the reverse generative adversarial network comprises a judgment module used for determining a target domain to which each sample target image input into the network belongs and a preset mean value and a preset variance corresponding to the target domain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer vision technology, and in particular relates to an image generation method for multiple target domains. Background Art

[0002] Nowadays, the development of the Internet has made images an important carrier of human social communication. Therefore, it is very important to be able to accurately identify colors and obtain information from images. According to surveys, about one-third of people in the world suffer from visual defects and cannot perceive colors correctly. In certain specific cases, they cannot fully distinguish colors, which brings them great potential dangers. In order to reduce the risk of patients being exposed to visual defects, it is necessary to deal with the above problems as soon as possible. Researchers have tried to improve patients' ability to identify image content by recoloring images, and a large number of experimental results have shown that the recoloring method has indeed achieved good results. In fact, this method can be understood as "converting" the input image into the corresponding output image. Similar to the concept of translating from one language to another, image translation maps the input image from its source domain to the corresponding target domain, thereby generating an image with the characteristics of the target domain while retaining content that is not related to the attributes. In other words, we can define the normal image as the source domain and the visually corrected image as the target domain, and then use the image translation method to enable patients with visual defects to obtain all the information of the image. Therefore, it is of great significance to use image translation technology to solve the visual defect problem of patients with abnormal vision.

[0003] Traditionally, in a specific task, to convert one representation of a scene into another, researchers usually need to spend a lot of effort to design special mechanisms separately, possibly redesign the model, and possibly design effective losses according to needs. Therefore, the model cannot make full use of other information of the image. In addition, it has great limitations in applicability and scalability. At present, the academic community has made progress in this regard, and generative adversarial networks have become a common method behind various image translation tasks. The paper Image-to-image translation with conditional adversarial networks / / Proceedings of the IEEE conference on computer vision and pattern recognition.2017:1125-1134. proposes a general framework for image translation: pix2pix. It takes the input image as a condition, learns the mapping from the output image, and obtains the specified output image. But the results produced lack diversity. In order to increase the diversity of generated images, the BicycleGAN proposed in the paper Toward multimodal image-to-image translation. Advances in neural information processing systems, 2017, 30. models the multiple modalities of the output by establishing bijective consistency between latent variables and output images. Finally, the trained model can generate diverse images in the target domain.

[0004] According to research, visual defects can be divided into monochromatic, dichromatic, and trichromatic. In addition, dichromaticism consists of red color blindness, green color blindness, and blue color blindness. If there is a specific model that can generate corresponding visual correction images for patients with different visual diseases, then different visual defect diseases can be dealt with more accurately. On the one hand, the efficiency of solving visual defect problems is greatly improved; on the other hand, the solution to this problem will make the model more versatile in dealing with visual correction problems. However, the above models are not suitable for this situation because these models are proposed for conversion between two domains. When faced with conversion between multiple target domains, the model must be retrained for each two domains separately. This means that it is necessary to train k or k-1 models for k domains. Obviously, this training method is complicated and poorly integrated. Summary of the invention

[0005] In order to solve the above problems existing in the related art, the present invention provides an image generation method for multiple target domains. The technical problem to be solved by the present invention is achieved by the following technical solutions:

[0006] The present invention provides an image generation method for multiple target domains, comprising:

[0007] Acquire a source image, and a preset mean and a preset variance corresponding to a target domain to which a target image to be converted belongs;

[0008] Generate a preset Gaussian distribution according to the preset mean and the preset variance;

[0009] Sampling the preset Gaussian distribution to obtain input noise;

[0010] The source image and the input noise are input into a pre-trained generator together to generate the target image; the pre-trained generator corresponds to multiple different target domains, and the preset means and preset variances corresponding to different target domains are different; the pre-trained generator is obtained by training an initial generative adversarial network using multiple pairs of training samples, and each pair of training samples includes a sample source image and a sample target image corresponding to the sample source image; the initial generative adversarial network includes a forward generative adversarial network and a reverse generative adversarial network, and the forward generative adversarial network and the reverse generative adversarial network both include: a judgment module for determining the target domain to which each sample target image in the input network belongs and the preset mean and preset variance corresponding to the target domain.

[0011] The present invention has the following beneficial technical effects:

[0012] 1) The image generation method provided by the present invention can effectively control the direction of image generation by inputting noise, realize image-to-image conversion in multiple target domains, and generate high-quality result images, thereby improving the image conversion efficiency in different target domains. It is a method with high performance and high efficiency. At the same time, for the selection of the target domain, the user can set the target image domain according to his own needs, thereby improving the versatility for various generation tasks.

[0013] 2) The methods provided by the present invention demonstrate that noise can be used as a condition for image-to-image translation in a wide variety of translation problems without affecting image quality, and the user is able to control the domain of image generation.

[0014] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 A flow chart of an image generation method for multiple target domains provided by an embodiment of the present invention;

[0016] Figure 2 A graph showing three exemplary Gaussian distributions corresponding to mean-variance pairs provided in an embodiment of the present invention;

[0017] Figure 3 An example diagram of an exemplary red-blindness correction data pair provided by an embodiment of the present invention;

[0018] Figure 4 An example diagram of an exemplary grayscale image data pair provided by an embodiment of the present invention;

[0019] Figure 5 An exemplary diagram of an exemplary normal visual data pair provided by an embodiment of the present invention;

[0020] Figure 6 An exemplary flowchart of determining the mean-variance pair corresponding to a sample target image provided by an embodiment of the present invention;

[0021] Figure 7 An exemplary training block diagram of cnoiseVAE-GAN provided in an embodiment of the present invention;

[0022] Figure 8 An exemplary training block diagram of cnoiseLR-GAN provided in an embodiment of the present invention;

[0023] Fig. 9 An exemplary test framework diagram provided for an embodiment of the present invention;

[0024] Fig.10 A scatter plot of the SSIM values ​​of the model provided by the embodiment of the present invention and other three image conversion models in different target domains;

[0025] Fig.11 A scatter plot comparison of PSNR values ​​of the model provided by the embodiment of the present invention and other three image conversion models in different target domains;

[0026] Fig.12 This is a test example effect diagram of the model provided by the embodiment of the present invention on some data;

[0027] Fig.13 A color blindness simulation comparison diagram of an image processed by the model provided in an embodiment of the present invention and an unprocessed image;

[0028] Fig.14 A comparison chart of the output results of the model provided in an embodiment of the present invention and three other image conversion models in three target domains. DETAILED DESCRIPTION

[0029] The present invention is further described in detail below with reference to specific embodiments, but the embodiments of the present invention are not limited thereto.

[0030] In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0031] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification.

[0032] Although the present invention is described herein in conjunction with various embodiments, in the process of implementing the claimed invention, those skilled in the art may understand and implement other variations of the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.

[0033] The inventors of the present application attempt to perform visual correction for patients with visual defects by generating adversarial networks. According to research, visual defects can be divided into monochromatic, dichromatic and trichromatic. In addition, dichromaticity consists of red blindness, green blindness and blue blindness. If there is a specific model that can generate corresponding visual correction images for patients with different visual diseases, then the present application will be able to deal with different visual defect diseases more accurately. On the one hand, the efficiency of solving visual defect problems is greatly improved; on the other hand, the solution to this problem will make the model more versatile in dealing with visual correction problems. The goal of the present application is to develop a general model based on these advantages. However, the existing models are not suitable for this situation because these models are proposed for conversion between two domains. When faced with conversion between multiple target domains, the model must be retrained for each two domains separately. This means that it is necessary to train k or k-1 models for k domains. Obviously, this training method is complex and has poor integration. Therefore, to solve this problem, the present invention proposes an image generation method for multiple target domains.

[0034] Figure 1 is a flow chart of an image generation method for multiple target domains provided by an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:

[0035] S101, obtaining a source image, and a preset mean and a preset variance corresponding to a target domain to which a target image to be converted from the source image belongs.

[0036] S102: Generate a preset Gaussian distribution according to a preset mean and a preset variance.

[0037] S103: Sampling a preset Gaussian distribution to obtain input noise.

[0038] Here, random sampling can be performed.

[0039] S104, inputting the source image and input noise into a pre-trained generator to generate a target image; the pre-trained generator corresponds to multiple different target domains, and the preset means and preset variances corresponding to different target domains are different; the pre-trained generator is obtained by training an initial generative adversarial network using multiple pairs of training samples, and each pair of training samples includes a sample source image and a sample target image corresponding to the sample source image; the initial generative adversarial network includes a forward generative adversarial network and a reverse generative adversarial network, and both the forward generative adversarial network and the reverse generative adversarial network include: a judgment module for determining the target domain to which each sample target image in the input network belongs and the preset mean and preset variance corresponding to the target domain.

[0040] Exemplarily, the target domain can be the visual correction image domain of red-eye blind patients, the grayscale image domain, the normal visual image domain, or other domains, which can be specifically determined according to the generator used for training pre-training, etc. Each target domain corresponds to a preset mean (μ) and variance (σ), and different target domains correspond to different μ and σ. For example, the mean-variance pair of the red-eye blindness correction image target domain is (-1.0, 0.01), the mean-variance of the normal visual image target domain is (1.0, 0.01), and the mean-variance of the grayscale image target domain is (0.0, 0.01). The Gaussian distribution curves corresponding to the three mean-variance pairs are shown in the figure below. Figure 2 As shown in the figure, it can be seen that the overlapping parts between the three distributions are almost negligible compared to the non-overlapping parts. Therefore, the sampling of each distribution is independent of each other. By training the network, the potential vectors sampled by the network from different distributions can be forced to correspond to different target domains, thereby achieving the control generation of the output image.

[0041] Here, both the forward generative adversarial network (cnoiseVAE-GAN) and the reverse generative adversarial network (cnoiseLR-GAN) include: an encoder, a judgment module, a generator, and a discriminator; wherein the Gaussian distribution generated by the preset mean and preset variance determined by the judgment module is used to supervise the training of the encoder, the generator, and the discriminator; the forward generative adversarial network and the reverse generative adversarial network share network parameters. Specifically, cnoiseVAE-GAN includes: a first encoder, a judgment module, a first generator, and a first discriminator, and cnoiseLR-GAN includes: a second encoder, a judgment module, a second generator, and a second discriminator, and the parameters are shared between the first encoder and the second encoder, the first generator and the second generator, and the first discriminator and the second discriminator.

[0042] In some embodiments, before the above S104, the following may be included:

[0043] S201. Obtain multiple pairs of training samples for multiple different target domains.

[0044] Here, in order to realize the constraint control of image attributes, the present application starts from the perspective of the data set, and divides the data set used for model training and testing into multiple sub-data sets respectively. Each type of sub-data set has commonalities and characteristics with other sub-data sets. The present application refers to the image domain represented by the image attributes of each sub-data set as the target domain. The network learns the image attributes of each target domain by learning the distribution of various types of images, so that it can better identify the characteristics of different sub-data sets, which is also the premise for the subsequent network to realize the constraint control of image attributes. Therefore, the present application wants to control which attribute of the image, and the present application realizes it by setting the attribute characteristics of several sub-data sets of the data set (that is, the target domain). In order to better evaluate the network model, the present invention has produced a visual data set. For the visual data set, the present application exemplarily sets three target domains in advance, namely, the visual correction image domain of red-blind patients, the grayscale image domain and the normal visual image domain. In the visual data set, for the visual correction image domain, the present application introduces the CVD data set, which is provided by Color vision deficiency datasets & recoloring evaluation using GANs. The main content of the data set includes natural scenes, people, objects, etc. In the CVD dataset, each data is composed of the original image and the corrected image, and the pixels between the images are corresponding. This dataset is a data pair specially designed for the generative adversarial network to convert color blind data, such as Figure 3 As shown, the left side is the original image and the right side is the corrected image. For the grayscale image domain, this application extracts the original data from the color blindness data, and then uses the traditional algorithm to convert it into a grayscale image, and finally obtains the grayscale image data, such as Figure 4 As shown in the figure, the left side is the original image and the right side is the grayscale image. The original data will be used as the data in the normal visual image domain, such as Figure 5 As shown, both the left and right sides are original images. Finally, the three types of target domain data obtained are sorted for model training and testing. Each set of data in each type of data set consists of data pairs containing original images and target images. After filtering and processing the data set, this application obtains 1463 pairs of training sets and 790 pairs of training sets for each data set, a total of 4389 pairs of training sets and 2370 pairs of test sets.

[0045] Exemplarily, the training set for training the network may include multiple pairs of samples, and the multiple pairs of samples may include: Figure 3 , Figure 4 and Figure 5 The sample pairs shown are composed, and, in Figure 3 , Figure 4 and Figure 5In , the left side is the sample source image, and the right side is the sample target image corresponding to the sample source image.

[0046] S202. Select at least one pair of training samples each time, and input the sample source image and the sample target image in the training samples selected this time into the forward generative adversarial network trained last and the reverse generative adversarial network trained last, respectively, to obtain the output data of the forward generative adversarial network trained last and the reverse generative adversarial network trained last, respectively.

[0047] For example, during the i-th training, the cnoiseVAE-GAN trained for the i-1th time and the cnoiseLR-GAN trained for the i-1th time can be used for training to obtain the i-th trained cnoiseVAE-GAN and the i-th trained cnoiseLR-GAN; and, when i is equal to 1, the cnoiseVAE-GAN trained for the i-1th time is the initial cnoiseVAE-GAN, and the cnoiseLR-GAN trained for the i-1th time is the initial cnoiseLR-GAN.

[0048] Exemplarily, when a pair of training samples is selected each time, the above S202 inputs the sample source image and the sample target image in the training sample selected this time into the forward generative adversarial network trained last and the reverse generative adversarial network trained last, respectively, to obtain the output data of the forward generative adversarial network trained last and the reverse generative adversarial network trained last, respectively, which can be achieved by the following steps:

[0049] S2021. After inputting the sample source image and sample target image in the training samples selected this time into the forward generative adversarial network trained last time, the encoder encodes the sample target image to obtain a first latent space vector, and after sampling the first distribution where the first latent space vector is located, obtains the first input noise.

[0050] S2022. The judgment module determines a preset mean and a preset variance corresponding to the sample target image, and generates a second Gaussian distribution according to the determined preset mean and preset variance.

[0051] Here, the sample target image carries storage location information, and the storage directory of the sample target image can be obtained based on the storage location information of the sample target image; the target domain to which the sample target image belongs can be obtained based on the preset correspondence between the storage directory and the target domain; and the preset mean and preset variance corresponding to the target domain to which the sample target image belongs can be determined based on the preset correspondence between the target domain and the preset mean and preset variance.

[0052] Specifically, in the process of image training, according to the produced data set, the data will be stored in the format of "datasets / train or test / target domain name / image name" (storage location information), that is, the sample pairs of different target domains are stored in their respective folders. In this way, when a sample target image is input into the network, the judgment module will obtain the storage location information of the image, and then the target domain name (storage directory) where the image is located can be obtained by interception. Next, the obtained target domains are judged in turn according to the correspondence between the pre-stored target domains and the target domain names, and the correspondence between the target domains and the variances. For example, when the target domain is target domain A, the corresponding mean A and variance A are output, and then the judgment is ended. Otherwise, the judgment of the next target domain is entered, and this mode is repeated until the corresponding target domain is found. The overall judgment process is as follows. Figure 6 shown.

[0053] S2023. The generator generates a first pseudo image of the sample target image according to the first input noise and the sample source image.

[0054] S2024: The discriminator generates discriminant values ​​of the sample target image and the first pseudo image respectively.

[0055] Specifically, Figure 7 This is the training diagram for cnoiseVAE-GAN, such as Figure 7 As shown, in the i-th training, after a pair of training samples is selected, the sample target image B in the pair of training samples i (i=1,2,…,N) (N is the number of target domains in the training set, i is the target domain to which the sample target image belongs) and the sample target image B i After the corresponding sample source image A is passed to the i-th trained cnoiseVAE-GAN, the discriminator generates a sample target image B i The discriminant value of i Encode and get the first latent space vector z i , for the first latent space vector z i The first distribution Q(z i |B i ) is randomly sampled to obtain the first input noise z' i Meanwhile, B i It is also sent to the judgment module, which will output B i The corresponding set of value pairs (μ i ,σ i ), then, according to (μ i ,σ i ) generates the second Gaussian distribution N(μ i,σ i ). Next, the first input noise z' i With sample target image B i The corresponding sample source image A is fed into the generator G together to generate the image corresponding to the target domain That is, we get the sample target image B i The first pseudo image Afterwards, the discriminator D generates the first pseudo image That is, in cnoiseVAE-GAN, the network model learns By learning this mapping, the network model can reconstruct the latent vector space according to the image information, so that the latent space vector carries the characteristic attributes of different target domains.

[0056] S2025. After inputting the sample source image and the sample target image in the training samples selected this time into the backward generative adversarial network trained last time, the judgment module determines the preset mean and preset variance corresponding to the sample target image, generates a second Gaussian distribution according to the determined preset mean and preset variance, and obtains the second input noise after sampling the second Gaussian distribution.

[0057] S2026. The generator generates a second pseudo image of the sample target image according to the second input noise and the sample source image.

[0058] S2027: The discriminator generates a discriminant value of the second fake image.

[0059] S2028. The encoder generates a second latent space vector according to the second pseudo image.

[0060] Specifically, Figure 8 This is the training diagram for cnoiseLR-GAN, such as Figure 8 As shown, the sample target image B i After the sample source image A is passed to the i-th trained cnoiseLR-GAN, B i are sent to the discriminator D and the judgment module respectively, and the discriminator D generates the sample target image B i The judgment module will output B i The corresponding set of value pairs (μ i ,σ i ), then, according to (μ i ,σ i ) generates the second Gaussian distribution N(μ i ,σ i ), for N(μ i ,σ i ) is randomly sampled to obtain the second input noise z" i Next, the second input noise z”i Together with the sample source image A, it is fed into the generator G to generate an image corresponding to the target domain. That is, we get the sample target image B i The second pseudo image Afterwards, the second pseudo image They are sent to the encoder E and the discriminator D respectively, and the discriminator D generates the second pseudo image The encoder E uses the second pseudo image Reconstruct the second latent space vector That is, the addition of cnoiseLR-GAN, on the one hand, the network is Based on the mapping, a new mapping is learned Such a mapping loop allows the network's latent space vector to be directly obtained from a simple distribution, greatly simplifying the training process. On the other hand, with the support of the bidirectional mapping loop mechanism, the overall network establishes a more robust and effective mapping relationship between the image space and the latent space, allowing each target domain to have a closer connection with its corresponding space, further enhancing the control of the conditional vector (input noise) over the generated image.

[0061] S203, based on the sample source image, the sample target image, and the output data, determine the first L1 loss, the second L1 loss, the third L1 loss, the first discriminant loss, the second discriminant loss, and the divergence loss of this time.

[0062] Specifically, Figure 7 As shown, a first L1 loss value can be generated based on the sample target image and the first pseudo image, a first discriminant loss can be generated based on the discriminant value of the sample target image and the discriminant value of the first pseudo image, and a divergence loss (KL divergence loss) can be generated based on the first distribution and the second Gaussian distribution; as shown in Figure 8 As shown, a second L1 loss value can be generated based on the sample target image and the second pseudo image, a third L1 loss can be generated based on the second Gaussian distribution and the second latent space vector, and a second discriminant loss can be generated based on the discriminant value of the sample target image and the discriminant value of the second pseudo image.

[0063] Specifically, the first discriminant loss can be calculated by the following formula:

[0064]

[0065] Among them, p(A,B i ) is the distribution of image pairs, indicating that from AB i A randomly selected AB from the dataset of image pairs i Image pair, E(B i ) is the encoder E that converts multiple different B iA distribution obtained after encoding, D(A,B i ) is the input AB i When the image is paired, the discriminator D generates AB i B i The discriminant value of B i score value), G(A,z' i ) is the first pseudo image.

[0066] Since for cnoiseVAE-GAN, it uses the encoder E with Gaussian assumption to directly i Encode to get the latent space vector z i , the distribution of the latent code is Q(z i |B i ), which is defined here as E(B i ), then the generator G uses the encoding z i And image A to synthesize the desired output To reflect this, the above formula is used as the discriminator loss of cnoiseVAE-GAN.

[0067] Specifically, the first L1 loss value can be calculated by the following formula:

[0068] Since in cnoiseVAE-GAN, we expect the output image of generator G to be Can be as close to the real image B as possible i , so the L1 loss that calculates the absolute error between the predicted value and the true value is used between the two.

[0069] Specifically, the divergence loss can be calculated by the following formula:

[0070]

[0071] Among them, when two distributions p and q are given, In other words, KL divergence measures the amount of additional information needed to represent distribution p using distribution q. If the KL divergence between two distributions is 0, it means that the two distributions are identical. The larger the KL divergence, the greater the difference between the two distributions; p(B i ) is image B i The distribution of i The data set (including multiple different B i ) select one B i In order to use the real output image B in the test phase i When the unknown is unknown, effective random sampling can be performed. Here, we encourage E(Bi )The latent space distribution encoded by CNN can be as close to the preset Gaussian distribution as possible. Here we use the KL divergence to measure the difference between the two distributions.

[0072] Specifically, the second discriminant loss can be calculated by the following formula:

[0073]

[0074] Among them, p(z” i ) is N(z i ), indicating that from N(z i ) is a sampled z” i , G(A,z” i ) is the second pseudo image, D(A,G(A,z” i )) is the score given by the discriminator to the second pseudo image.

[0075] Specifically, the second L1 loss value can be calculated by the following formula:

[0076]

[0077] Specifically, the third L1 loss value can be calculated by the following formula:

[0078]

[0079] S204, generating the loss value of this time based on the first L1 loss, the second L1 loss, the third L1 loss, the first discrimination loss, the second discrimination loss, the divergence loss and the preset coefficient.

[0080] Here, the preset coefficients include: a first loss coefficient, a second loss coefficient, a third loss coefficient and a divergence coefficient; based on this, the products of the first L1 loss and the first loss coefficient, the second L1 loss and the second loss coefficient, and the third L1 loss and the third loss coefficient can be calculated respectively and then summed to obtain the sum value; and the product value of the divergence loss and the divergence loss coefficient can be calculated; then, the first discrimination loss, the second discrimination loss, the sum value and the product value are summed to obtain the loss value of this time.

[0081] Exemplarily, the calculation formula of the loss value this time can be expressed by the following formula:

[0082]

[0083] in, is the first loss coefficient, is the second loss coefficient, λ latent is the third loss coefficient, λ KL is the divergence coefficient.

[0084] Then, the overall optimization goal of the network composed of cnoiseVAE-GAN and cnoiseLR-GAN is as follows:

[0085]

[0086] For example, λ latent =1.0,λ KL =0.01. The reason is as follows: In the training process of the neural network, the iterative update of the network parameters is a key step to adjust the model to obtain better prediction results. First, we need to initialize the parameters of the neural network to random values. Then, select a sample from the training data set and pass it as input to the neural network. The neural network calculates the predicted output based on the initialized parameters by applying the activation function and the forward propagation algorithm. Next, the difference between the predicted output and the true output is calculated by the loss function. Then, we use the backpropagation algorithm to calculate the gradient of each parameter using the gradient descent method in order to update the parameters. The gradient descent method is one of the most commonly used optimization algorithms. Its purpose is to reduce the value of the loss function through continuous iterations and make the predicted results closer to the true results. In each iteration, we use the current parameter values ​​to update the parameter values ​​through the update formula of the gradient descent method. This cycle is repeated many times during the training process until the value of the loss function reaches a satisfactory level, or the training is stopped when the maximum number of iterations is exceeded. As the training progresses, the parameters of the model will be continuously adjusted to make the value of the loss function smaller and smaller, and the predicted results will be closer and closer to the true results. From the above description of the iterative update method of network parameters, we can see that the loss function plays an important role in evaluating the difference between the model's predicted results and the actual results during the training process of the neural network. It provides a clear direction and evaluation criteria for the iterative update of the model's parameters, thereby helping us train a better model. λ latent ,λ KL , They represent the weights of each loss function on the network training process. The first and second items in the above formula for calculating the loss value each time represent the discriminator loss of cnoiseVAE-GAN and cnoiseLR-GAN respectively; in the third and sixth items, It refers to the difference between the real target image and the network generated image. (L1) distance, whether the random vector can output a good image in the test phase, these two items account for a large proportion; the fourth item measures the absolute difference between the real latent vector and the reconstructed latent vector, which plays a big role in whether the encoder E can map the target image to the corresponding latent space; for the fifth item, it represents the i) is the difference between the latent space distribution encoded by and the Gaussian distribution we set in advance. This item helps us to directly perform random sampling in the subsequent testing phase. Based on the above description and combined with our practical experience, we set λ latent =1.0,λ KL =0.01.

[0087] S205. Use the loss value of this time to adjust the network parameters of the forward generative adversarial network trained last time and the reverse generative adversarial network trained last time, so as to obtain the forward generative adversarial network trained this time and the reverse generative adversarial network trained this time, and repeat this cycle until the preset training conditions are met, then stop the training and obtain the pre-trained generator.

[0088] Here, the above method can be used for each training until the number of trainings reaches a preset number or the training is stopped when the model converges, and the pre-trained cnoiseVAE-GAN and the pre-trained cnoiseLR-GAN are obtained. Since the parameters of the generators in cnoiseVAE-GAN and cnoiseLR-GAN are shared, the network parameters of the generators in the pre-trained cnoiseVAE-GAN and the pre-trained cnoiseLR-GAN can be used as the network parameters obtained by the final training, thereby obtaining the pre-trained generator.

[0089] Exemplarily, during training, the size of the input and output images of the network can be 256*256, the potential dimension |z| can be set to 18, and two pairs of training samples can be used for training at a learning rate of 0.0001 each time.

[0090] In some embodiments, after training is completed, the pre-trained generative network can also be tested to evaluate its accuracy. If the test results do not meet expectations, the generative adversarial network can be further adjusted by adjusting network parameters or selecting other algorithms to improve the quality and authenticity of the generated images. The test framework is as follows: Fig. 9 As shown. Input image A and low-dimensional latent space vector z i The input of the network is composed of the input image A from the constructed test dataset and the latent space vector z iIt is a sampling of the known latent space N(zi). According to the target domain to be generated, the corresponding distribution of the latent space set in the training stage is selected. That is, when you want a source domain image to have a specific attribute of a target domain, you need to use the source domain image as the input image in the input part, and sample it in the latent space corresponding to the target domain. The obtained latent space vector is used as the control noise vector and fed into the network together with the input image. In the network part, the pre-trained generator G is used. The evaluation criterion for the pre-trained generator is the output part of the pre-trained generator G, that is, the result image of the target domain generated by the generator G.

[0091] The beneficial effects of the present invention are further illustrated by experiments below.

[0092] 1. Experimental conditions:

[0093] The experiment in this embodiment was carried out in a 64-bit Ubuntu 16.04.5 operating system, with Python version 3.7.6, CUDA version 10.1, and the Pytorch deep learning framework used to build a generative adversarial network architecture and add various modules to the network model, with Pytorch version 1.4.0.

[0094] 2. Experimental content and results analysis:

[0095] The experiments of the present invention respectively use the network model proposed by the present invention and several existing image generation network models with superior performance to perform quantitative experimental evaluation and qualitative experimental evaluation in training data and test data.

[0096] In the quantitative evaluation experiment, we quantitatively analyzed the generated image quality and operation efficiency of Pix2pix, BicycleGAN, CycleGAN and the network proposed in this invention. Here, we use PSNR and SSIM to evaluate the image quality, where PSNR focuses on measuring the error between pixels, and SSIM measures the similarity of images in terms of brightness, contrast and structure. We conducted quantitative tests on our dataset.

[0097] SSIM: To demonstrate the excellence of the present invention, we applied the proposed network and the pix2pix, BicycleGAN, and CycleGAN networks that perform well in image conversion tasks on 790 pairs of color blindness datasets, 790 pairs of normal vision datasets, and 790 pairs of grayscale image datasets, and calculated the SSIM between the generated images and the target results in the test dataset. Fig.10The SSIM calculated by different models for each target domain in the 790 test datasets is shown. In addition, Table 1 shows the average SSIM of our network and other networks. Fig.10 It can be observed that when the target domain is a red-blindness-corrected image, the SSIM of our model is better than that of other models. When the target domain is a grayscale image, although the results of Pix2pix look better than those of our model, both our model and Pix2pix are very close to the ideal situation. When the target area is a normal image, the results of our model are mostly higher than those of other models. The results reflected in Table 1 are consistent with our analysis. This means that our model achieves comparable or even better performance than other models trained on one target domain alone while training different target domains simultaneously. It also reflects that our model has the extraordinary ability to maintain structural similarity with the target image during image translation.

[0098] SSNR: Similarly, we evaluated our model based on PSNR, as Fig.11 and Table 2. It can be clearly observed that when the target domain is red-blind correction and normal vision, our model has better performance in terms of PSNR compared with pix2pix, BicycleGAN and CycleGAN. Although the PSNR calculated between the image generated by our model and the ground truth does not exceed pix2pix in the conversion of the target domain (grayscale), the gap is very small and difficult to detect by the human eye, which has met the requirements of the problem to be solved by the present invention. Therefore, it can be concluded that our model also has impressive performance in maintaining pixel-level similarity between images.

[0099]

[0100] Table 1

[0101]

[0102] Table 2

[0103] In the qualitative evaluation experiment, the present invention conducts a large number of experiments on the proposed model algorithm and visualizes the results, observing the rationality of the experimental results from the perspective of human eye perception as an indicator of qualitative evaluation. Fig.12 The paper shows some results of applying this method to the task of converting between multiple target domains. Fig.12In , the first column is the input source image, the second column is the result image generated in different target domains, and the third column is the corresponding ground truth. As we can see, the model controls the direction of output image generation according to the input latent vector and can switch flexibly at any time. In addition, the converted result image retains all the information except the attributes in the target domain, and at the same time, it also has the characteristics of the target domain. Specifically, Fig.12 The first row is the result of converting the image to the target domain of the red-blindness-corrected image. Since the significance of the red-blindness-corrected image is that the corrected image cannot lose the information of the original image, the success of the color blindness-corrected image conversion depends on whether the generated image loses image information. Fig.13 It can be clearly seen that the simulated result of the input image in the first example confuses the color of the flower and the color of the leaves, while the simulated result of its output image distinguishes the flowers from the leaves. Similarly, the simulated result of the output image in the second example separates the person from the grass. The simulated image of color blindness before colorization almost confuses the subject and background of the image, but the simulated image of color blindness of the corrected image generated by our model successfully separates the confused contents in a natural effect.

[0104] same, Fig.12 The target domain of the second row is a grayscale image. It is worth noting that the generated image is very close to the ground truth and retains the image brightness, contour and other details to a great extent. In the third row, the target domain of the image conversion is the normal vision image domain. Therefore, the ground truth is consistent with the source image. At this time, it can be seen that the generated image is indeed very similar to the source image, which is exactly the image information obtained from normal vision.

[0105] In addition, the present invention also uses other network models applied to this task as comparison, and the results are as follows Fig.14 As shown. It is obvious that in terms of image texture, image clarity and image content integrity, the network model proposed by the present invention is comparable to or even exceeds BicycleGAN, Pix2pix or CycleGAN. In addition, to obtain such results, our network only needs to be trained once, while BicycleGAN, Pix2pix or CycleGAN need to be trained three times respectively. This shows that our network also has a significant advantage in efficiency.

[0106] Time efficiency: In order to verify whether the new network proposed in this invention improves the speed when performing image conversion, we tested on 2370 pairs of test sets and compared the three training models. The results are shown in Table 3. As can be seen from Table 3, the ranking of the three networks in terms of time performance is as follows: new model > pix2pix > BicycleGAN > CycleGAN. This means that our model has a considerable advantage in execution efficiency.

[0107] Methods Pix2pix BicycleGAN CycleGAN Our model Time(ms) 71.017 81.723 151.125 54.104

[0108] Table 3

[0109] In summary, compared with the traditional image generation model algorithm, the present invention can effectively control the direction of image generation, realize the image-to-image conversion of multiple target domains, and generate high-quality result images. It is an algorithm with high performance and high efficiency. At the same time, for the selection of the target domain, the user can set the target image domain according to their own needs, which shows the versatility of our model for various tasks and also reflects the important significance of the research on this algorithm.

[0110] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.

Claims

1. An image generation method for multiple target domains, It is characterized in that include: Acquire a source image, and a preset mean and a preset variance corresponding to a target domain to which a target image to be converted belongs; Generate a preset Gaussian distribution according to the preset mean and the preset variance; Sampling the preset Gaussian distribution to obtain input noise; The source image and the input noise are input into a pre-trained generator to generate the target image; the pre-trained generator corresponds to a plurality of different target domains, and the preset means and preset variances corresponding to different target domains are different; the pre-trained generator is obtained by training an initial generative adversarial network using a plurality of pairs of training samples, and each pair of training samples includes a sample source image and a sample target image corresponding to the sample source image; The initial generative adversarial network includes a forward generative adversarial network and a reverse generative adversarial network. Both the forward generative adversarial network and the reverse generative adversarial network include: a judgment module for determining the target domain to which each sample target image in the input network belongs and a preset mean and a preset variance corresponding to the target domain.

2. The image generation method for multiple target domains according to claim 1, It is characterized in that The forward generative adversarial network and the reverse generative adversarial network both include: an encoder, the judgment module, a generator and a discriminator; wherein the Gaussian distribution generated by the preset mean and preset variance determined by the judgment module is used to supervise the training of the encoder, the generator and the discriminator; the forward generative adversarial network and the reverse generative adversarial network share network parameters.

3. The image generation method for multiple target domains according to claim 1, It is characterized in that Before inputting the source image and the input noise together into a pre-trained generator to generate the target image, the method further includes: Acquire multiple pairs of training samples for the multiple different target domains; At least one pair of training samples is selected each time, and the sample source image and the sample target image in the training sample selected this time are respectively input into the forward generative adversarial network trained last time and the reverse generative adversarial network trained last time, and the output data of the forward generative adversarial network trained last time and the reverse generative adversarial network trained last time are respectively obtained; Based on the sample source image, the sample target image, and the output data, determine the first L1 loss, the second L1 loss, the third L1 loss, the first discriminant loss, the second discriminant loss, and the divergence loss; Generate the loss value based on the first L1 loss, the second L1 loss, the third L1 loss, the first discrimination loss, the second discrimination loss, the divergence loss and the preset coefficient; The loss value of this time is used to adjust the network parameters of the forward generative adversarial network trained last time and the reverse generative adversarial network trained last time, so as to obtain the forward generative adversarial network trained this time and the reverse generative adversarial network trained this time. This cycle is repeated until the preset training conditions are met, and the training is stopped to obtain the pre-trained generator.

4. The image generation method for multiple target domains according to claim 3, It is characterized in that The forward generative adversarial network and the reverse generative adversarial network both include: an encoder, the judgment module, a generator and a discriminator; when a pair of training samples are selected each time, the sample source image and the sample target image in the training sample selected this time are respectively input into the forward generative adversarial network trained last time and the reverse generative adversarial network trained last time, and the output data of the forward generative adversarial network trained last time and the reverse generative adversarial network trained last time are respectively obtained, including: After inputting the sample source image and the sample target image in the training sample selected this time into the forward generative adversarial network trained last time, the encoder encodes the sample target image to obtain a first latent space vector, and obtains a first input noise after sampling a first distribution where the first latent space vector is located; The judgment module determines a preset mean and a preset variance corresponding to the sample target image, and generates a second Gaussian distribution according to the determined preset mean and preset variance; The generator generates a first pseudo image of the sample target image according to the first input noise and the sample source image; The discriminator generates discriminant values ​​of the sample target image and the first pseudo image respectively; After inputting the sample source image and the sample target image in the training sample selected this time into the backward generative adversarial network trained last time, the judgment module determines the preset mean and the preset variance corresponding to the sample target image, generates the second Gaussian distribution according to the determined preset mean and preset variance, and obtains the second input noise after sampling the second Gaussian distribution; The generator generates a second pseudo image of the sample target image according to the second input noise and the sample source image; The discriminator generates a discriminant value of the second fake image; The encoder generates a second latent space vector based on the second pseudo image.

5. The image generation method for multiple target domains according to claim 4, It is characterized in that The determining, based on the sample source image, the sample target image, and the output data, the first L1 loss, the second L1 loss, the third L1 loss, the first discriminant loss, the second discriminant loss, and the divergence loss of this time includes: generating the first L1 loss value based on the sample target image and the first pseudo image, generating the second L1 loss value based on the sample target image and the second pseudo image, and generating the third L1 loss based on the second Gaussian distribution and the second latent space vector; generating the first discriminant loss based on the discriminant value of the sample target image and the discriminant value of the first fake image, and generating the second discriminant loss based on the discriminant value of the sample target image and the discriminant value of the second fake image; The divergence loss is generated based on the first distribution and the second Gaussian distribution.

6. The image generation method for multiple target domains according to claim 3, It is characterized in that The preset coefficients include: a first loss coefficient, a second loss coefficient, a third loss coefficient and a divergence coefficient; the loss value of this time is generated based on the first L1 loss, the second L1 loss, the third L1 loss, the first discrimination loss, the second discrimination loss, the divergence loss and the preset coefficients, including: Respectively calculating the products of the first L1 loss and the first loss coefficient, the second L1 loss and the second loss coefficient, and the third L1 loss and the third loss coefficient, and summing them up to obtain a sum value; Calculating a product value of the divergence loss and the divergence loss coefficient; The first discrimination loss, the second discrimination loss, the sum value and the product value are summed to obtain the current loss value.

7. The image generation method for multiple target domains according to claim 4, It is characterized in that The sample target image carries storage location information; The judgment module determines a preset mean and a preset variance corresponding to the sample target image, including: Obtaining a storage directory of the sample target image according to the storage location information of the sample target image; Obtaining the target domain to which the sample target image belongs according to a preset correspondence between the storage directory and the target domain; According to a preset correspondence between the target domain and the preset mean and the preset variance, a preset mean and a preset variance corresponding to the target domain to which the sample target image belongs are determined.

8. The image generation method for multiple target domains according to claim 1, It is characterized in that The pre-trained generator corresponds to three different target domains, and the preset means and preset variances corresponding to the three different target domains are: (μ:-1.0, σ:0.01), (μ:1.0, σ:0.01) and (μ:0.0, σ:0.01), respectively.