A method and system for constructing a dual discriminator generative adversarial network model
By constructing a dual-discriminator generative adversarial network model, which uses the first discriminator to determine the authenticity of images and the second discriminator to calculate similarity, the problem of long training process and poor quality of GAN is solved, achieving faster training speed and higher image generation quality.
Patent Information
- Application Number
- CN202211333154.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-28
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2042-10-28
AI Technical Summary
Traditional GAN network training is lengthy and unstable, prone to problems such as pattern collapse and gradient vanishing, resulting in poor image generation quality. Furthermore, existing similarity calculation methods are not effective in high-dimensional spaces.
A first discriminator for determining the authenticity of images and a second discriminator for calculating image similarity are constructed. A dual-discriminator generative adversarial network model is built based on the generator, the first discriminator and the second discriminator, and trained using a loss function. Random noise data and real images are used for optimization.
It improves the training speed and image generation quality of generative adversarial network models, enhances the discriminator's discrimination ability, and generates higher quality images.
Smart Images

Figure CN116091884B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image generation, and in particular to a method and system for constructing a dual-discriminator generative adversarial network model. BACKGROUND
[0002] The generative adversarial network (GAN) was proposed by Ian J. Goodfellow et al. in 2014 and has achieved great success in image generation and image enhancement. A well-trained GAN network can well fit the distribution of real data, thereby generating a large number of artificial pictures to make up for the lack of data in real deep learning applications. Therefore, GAN has great research significance and application value.
[0003] However, the GAN network also has obvious shortcomings. First, the discriminator of the traditional GAN network can only judge the authenticity of the picture and pass this information to the generator for parameter optimization. However, this information is very limited, so the training process of the GAN network is often very long. In addition, the training process of the GAN is unstable and is often prone to mode collapse and gradient disappearance problems. Second, a large number of works use image similarity calculation to constrain the GAN to generate better images and alleviate the risk of mode collapse. However, most of them measure the similarity between two images by calculating the image space distance or feature distance. The image space distance measurement method (such as Euclidean distance) is the most common method for calculating the similarity between two images, but these algorithms do not work well in calculating the distance between high-dimensional images. SUMMARY
[0004] The present application aims to at least solve one of the problems in the prior art. To this end, the present application proposes a method and system for constructing a dual-discriminator generative adversarial network model, which can improve the training speed of the generative adversarial network model and improve the quality of image generation.
[0005] In a first aspect, the present application provides a method for constructing a dual-discriminator generative adversarial network model, the method comprising:
[0006] constructing a first discriminator for discriminating the authenticity of an image;
[0007] constructing a second discriminator for calculating the similarity between images;
[0008] constructing a dual-discriminator generative adversarial network model and a loss function of the generative adversarial network model based on the generator, the first discriminator and the second discriminator;
[0009] According to the loss function, the first preset number of randomly generated noise data and the second preset number of selected real images are used to train the generative adversarial network model, and a trained generative adversarial network model is obtained.
[0010] Compared with the prior art, the first aspect of the present application has the following beneficial effects:
[0011] In order to improve the training speed of the generative adversarial network model and improve the quality of image generation, the first discriminator for judging the authenticity of the image is constructed; the second discriminator for calculating the similarity between images is constructed; the dual-discriminator generative adversarial network model and the loss function of the generative adversarial network model are constructed based on the generator, the first discriminator and the second discriminator; according to the loss function, the first preset number of randomly generated noise data and the second preset number of selected real images are used to train the generative adversarial network model, and a trained generative adversarial network model is obtained. The second discriminator for calculating the similarity between images is constructed, and the dual-discriminator is formed based on the second discriminator for calculating the similarity between images, which can improve the training speed of the generative adversarial network model and improve the quality of image generation.
[0012] According to some embodiments of the present application, the second discriminator for calculating the similarity between images is constructed, comprising:
[0013] The similarity between images is calculated using a twin neural network, and the second discriminator is constructed based on the twin neural network.
[0014] According to some embodiments of the present application, the loss function of the generative adversarial network model is constructed in the following manner:
[0015]
[0016] Wherein, G represents the generator, D represents the first discriminator, S represents the second discriminator, x represents the first real image selected from the real data domain p data , w represents the second real image selected from the real data domain p data , G(z) represents the generated image of the generator, E represents the expectation, z represents the noise data, p z (z) represents the first preset number of randomly generated noise data.
[0017] According to some embodiments of the present application, the first preset number of randomly generated noise data and the second preset number of selected real images are used to train the generative adversarial network model, and a trained generative adversarial network model is obtained, comprising:
[0018] Pre-set multiple batches of training, for each batch of training, the following operations are performed:
[0019] Randomly generate a first pre-set number of noise data, and input the noise data into the generator to obtain noise sample data;
[0020] Select a second pre-set number of first real images from the real data domain, and train the first discriminator using the first real images and the noise sample data;
[0021] Select a second real image with the same number of first real images from the real data domain, and use the first real image and the second real image as a first group of data, and use the first real image and the noise sample data as a second group of data, and train the second discriminator according to the first group of data and the second group of data;
[0022] After the first discriminator and the second discriminator are trained, the noise data is input into the generator for training, so that the generator generates images in the direction of D(G(z))→1 and S(G(z),x)→1;
[0023] After all batches of training are completed, a trained generative adversarial network model is obtained.
[0024] According to some embodiments of the present application, the objective function of the twin neural network comprises:
[0025]
[0026] Wherein, N represents the number of samples, X1, X2 represents two images, Y=1 represents that the two images are similar, Y=0 represents that the two images are not similar, E w represents the distance between the two images, and m represents a pre-set threshold.
[0027] According to some embodiments of the present application, the training of the generative adversarial network model comprises:
[0028] When training the generator, minimize log(1-D(G(z)))+1-S(G(z),x), D(G(z)) is maximum, which means that the generated image of the generator is regarded as a real image, and the larger S(G(z),x) means the more similar the generated image of the generator is to the real image;
[0029] When training the two discriminators, maximize log(1-D(G(z)))+1-S(G(z),x), D(G(z)) is minimum, which means that the generated image of the generator is regarded as a real image, and the smaller S(G(z),x) means the more similar the generated image of the generator is to the real image.
[0030] In a second aspect, the embodiments of the present application also provide a system for constructing a dual-discriminator generative adversarial network model, the system comprising:
[0031] a first discriminator constructing module configured to construct a first discriminator for discriminating the authenticity of images;
[0032] a second discriminator constructing module configured to construct a second discriminator for calculating the similarity between images;
[0033] a model constructing module configured to construct a dual-discriminator generative adversarial network model and a loss function of the generative adversarial network model based on a generator, the first discriminator and the second discriminator;
[0034] a model training module configured to train the generative adversarial network model according to the loss function, using a first preset number of randomly generated noise data and a second preset number of selected real images, and obtain a trained generative adversarial network model.
[0035] According to some embodiments of the present application, the model training module comprises a sample data acquisition unit, a first discriminator training unit, a second discriminator training unit and a generator training unit, wherein:
[0036] the sample data acquisition unit is configured to randomly generate a first preset number of noise data, and input the noise data into the generator to obtain noise sample data;
[0037] the first discriminator training unit is configured to select a second preset number of first real images from the real data domain, and train the first discriminator using the first real images and the noise sample data;
[0038] the second discriminator training unit is configured to select a second preset number of second real images from the real data domain, and train the second discriminator according to a first group of data comprising the first real images and the second real images and a second group of data comprising the first real images and the noise sample data;
[0039] the generator training unit is configured to input the noise data into the generator for training after the first discriminator and the second discriminator are trained, so that the generator generates images in the direction of D(G(z))→1 and S(G(z),x)→1.
[0040] In a third aspect, an embodiment of the present application further provides a device for constructing a dual-discriminator generative adversarial network model, comprising at least one control processor and a memory connected to the at least one control processor for communication; the memory stores instructions executable by the at least one control processor, and the instructions are executed by the at least one control processor to enable the at least one control processor to perform the method for constructing a dual-discriminator generative adversarial network model as described above.
[0041] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium storing computer-executable instructions for causing a computer to perform the method for constructing a dual-discriminator generative adversarial network model as described above.
[0042] It can be understood that the beneficial effects of the second aspect to the fourth aspect compared with the related art are the same as the beneficial effects of the first aspect compared with the related art, and reference can be made to the related description in the first aspect, which will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS
[0043] The above and / or additional aspects and advantages of the present application will become apparent and more readily appreciated from the following description of embodiments, taken in conjunction with the accompanying drawings, in which:
[0044] Figure 1 is a flowchart of a method for constructing a dual-discriminator generative adversarial network model according to an embodiment of the present application;
[0045] Figure 2 is a structure diagram of a dual-discriminator generative adversarial network model according to an embodiment of the present application;
[0046] Figure 3 is a comparison diagram of generated images of a traditional GAN network and a GAN network with similarity calculation according to an embodiment of the present application;
[0047] Figure 4 is a diagram of InceptionScore value changes of a traditional GAN network and a GAN network with similarity calculation according to an embodiment of the present application;
[0048] Figure 5 is a structure diagram of a system for constructing a dual-discriminator generative adversarial network model according to an embodiment of the present application. DETAILED DESCRIPTION
[0049] Embodiments of the present application are described in detail below with reference to the attached drawing figures, wherein the same or like component have the same or similar designations. The embodiments described below are presented by way of example only and are not intended to limit the present application as defined by the appended claims and their equivalents.
[0050] In the description of the present application, if there is a description to the first, second, etc. is only for the purpose of distinguishing technical features, and can not be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features or the order of the indicated technical features.
[0051] In the description of the present application, it is to be understood that the orientation description, such as up, down, etc. indicates the orientation or position relationship based on the orientation or position relationship shown in the drawings, only for the convenience of describing the present application and simplifying the description, and is not intended to indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, therefore, it can not be understood as a limitation of the present application.
[0052] In the description of the present application, it is to be understood that, unless otherwise explicitly limited, the words such as setting, installing, connecting, etc. should be broadly understood, and the person skilled in the art can reasonably determine the specific meaning of the above words in the present application in combination with the specific content of the technical solution.
[0053] First, the terms involved in the present application are analyzed:
[0054] Siamese neural network: a deep learning network proposed by Chopra S et al. in 2005, the input of which is two pictures with the same size, and the output is the similarity of the two pictures. The structure of the Siamese neural network is shown in Figure 2 The two input pictures of the Siamese neural network are first passed through the convolution layer, and the weights are shared in the convolution layer. After the convolution layer, the outputs of the two pictures will be connected using a fully connected layer respectively to extract the features of the pictures. The distance between the pictures (such as Euclidean distance) is calculated through the features of the images, and finally a fully connected layer is used to judge the similarity between the two pictures through the sigmoid activation function. Through the Siamese neural network, the similarity between the two pictures can be well calculated.
[0055] Generative adversarial network (GAN) was proposed by Ian J. Goodfellow et al. in 2014 and applied in image generation and image enhancement, etc. It has achieved great success. The trained GAN network can well fit the distribution of real data, so as to generate a large number of artificial pictures, making up for the problem of insufficient data in real deep learning application. Therefore, GAN has great research significance and application value.
[0056] However, the GAN network also has obvious shortcomings. First, the discriminator of the traditional GAN network can only judge the authenticity of the picture and pass the information to the generator for parameter optimization. However, this information is very limited, so the training process of the GAN network is often very long. In addition, the training process of the GAN is unstable and is often prone to mode collapse and gradient disappearance problems. Second, a large number of works use image similarity calculation to constrain the GAN so that the generator generates better images and alleviates the risk of mode collapse. However, most of them measure the similarity between two images by calculating the image space distance or feature distance. The image space distance measurement method (such as Euclidean distance) is the most common method for calculating the similarity between two images, but these algorithms are not good at calculating the distance between images in high-dimensional space.
[0057] To solve the above problems, the present application is to improve the training speed of the generative adversarial network model and improve the quality of image generation. A first discriminator for discriminating the authenticity of an image is constructed. A second discriminator for calculating the similarity between images is constructed. Based on the generator, the first discriminator and the second discriminator, a dual-discriminator generative adversarial network model and a loss function of the generative adversarial network model are constructed. According to the loss function, the first preset number of noise data randomly generated and the second preset number of real images selected are used to train the generative adversarial network model to obtain a trained generative adversarial network model. The present application constructs a second discriminator for calculating the similarity between images, and forms a dual discriminator based on the second discriminator for calculating the similarity between images, which can improve the training speed of the generative adversarial network model and improve the quality of image generation.
[0058] Reference Figures 1-2 The embodiment of the present application provides a construction method of a dual-discriminator generative adversarial network model. The construction method of the dual-discriminator generative adversarial network comprises the following steps:
[0059] Step S100, constructing a first discriminator for discriminating the authenticity of an image.
[0060] Specifically, the first discriminator for discriminating the authenticity of an image is constructed. The first discriminator is a discriminator for discriminating the authenticity of an image, which is the same as the traditional GAN network. Referring to Figure 2 , the first discriminator is marked as D discriminator (i.e. Figure 2 Discriminator in
[0061] Step S200, constructing a second discriminator for calculating the similarity between images.
[0062] Specifically, a second discriminator for calculating the similarity between images is constructed. The second discriminator calculates the similarity between images by using a Siamese neural network. Based on the Siamese neural network, the second discriminator is constructed, which is referred to as Discriminator S (i.e., Discriminator S in Figure 2 Figure 2 ).
[0063] The objective function of the Siamese neural network is as follows:
[0064]
[0065] where N represents the number of samples, X1 and X2 represent two images, Y = 1 represents that the two images are similar, Y = 0 represents that the two images are not similar, E w represents the distance between the two images, and m represents a preset threshold.
[0066] When Y = 1, it indicates that the two images X1 and X2 belong to the same category. At this time, the loss function of the Siamese neural network is:
[0067]
[0068] The optimization direction is to minimize the loss function, that is, to minimize , which is equivalent to optimizing in the direction of minimizing the distance between the two images.
[0069] When Y = 0, it indicates that the two images X1 and X2 do not belong to the same category. At this time, the loss function of the Siamese neural network is:
[0070]
[0071] The optimization direction is to minimize the loss function, that is, to maximize E w , which is equivalent to optimizing in the direction of increasing the distance between the two images. After the training of the Siamese neural network is completed, it can well judge whether the two images belong to the same category, that is, whether the two images are similar.
[0072] Step S300, based on the generator (i.e., Generator in Figure 2 ), the first discriminator and the second discriminator, a generative adversarial network model with double discriminators and a loss function of the generative adversarial network model are constructed.
[0073] Specifically, based on the generator, the first discriminator and the second discriminator, a generative adversarial network model with double discriminators and a loss function of the generative adversarial network model are constructed. In this embodiment, the loss function of the generative adversarial network model is constructed in the following manner:
[0074]
[0075] Where G represents the generator, D represents the first discriminator, S represents the second discriminator, and x represents the value from the real data domain p. data The first real image selected from the data, w, represents the image from the real data domain p. data The second real image selected in the image, G(z) represents the generated image by the generator, E represents the expectation, z represents the noise data, and p z (z) represents a first preset number of noise data generated randomly.
[0076] In this embodiment, during the training process of the generative adversarial network model, the loss function of the generative adversarial network model tends towards... Optimize in terms of direction. Specifically:
[0077] When training the generator, the goal is to minimize the loss function of the generative adversarial network (GAN) model. In this case, the GAN model aims to maximize D(G(z)) and S(G(z),x) in its loss function. Maximizing D(G(z)) indicates that the generator's generated image is considered a real image (i.e., ...). Figure 2 In the Trueness parameter, a larger S(G(z),x) indicates that the generated image is more similar to the real image (i.e., ...). Figure 2 Similarity in (the context).
[0078] When training two discriminators, the goal is to maximize the loss function of the generative adversarial network (GAN) model. At this time, the GAN model wants D(x) in the loss function to be as large as possible, and D(G(z)) and S(G(z),x) to be as small as possible. When D(G(z)) is minimized, it means that the generated image is regarded as a real image. The smaller S(G(z),x) is, the more similar the generated image is to the real image.
[0079] Step S400: Based on the loss function, the generative adversarial network model is trained using a first preset number of randomly generated noise data and a second preset number of selected real images to obtain a trained generative adversarial network model.
[0080] Specifically, multiple training batches are preset, and the following operations are performed for each training batch:
[0081] Randomly generate a first preset number of noise data (i.e., Figure 2 The noise data is input into the generator to obtain noise sample data (i.e., noise in the generator). Figure 2 (gen imgs);
[0082] Select a second preset number of first real images from the real data domain (i.e.,Figure 2 the first real images (i.e., ture imgs1), and the first discriminator is trained using the first real images and the noise sample data;
[0083] second real images (i.e., ture imgs2) are selected from the real data domain p Figure 2 , and the first real images and the second real images are used as a first group of data, and the first real images and the noise sample data are used as a second group of data, and the second discriminator is trained according to the first group of data and the second group of data;
[0084] After the training of the first discriminator and the second discriminator is completed, the noise data is input into the generator for training, so that the generator generates images in the direction of D(G(z))→1 and S(G(z), x)→1.
[0085] After the training of all batches is completed, a trained generative adversarial network model is obtained. For example:
[0086] The training of the generative adversarial network model is performed in the form of small batches of samples, and it is assumed that the batch size is n each time.
[0087] In the training process of each batch, first, the two discriminators are trained. m randomly generated noise data {z1,..., z m} are input into the generator to generate m noise sample data G(z) through a neural network;
[0088] m first real images {x1,..., x data} are selected from the real data domain p m , and G(z) is input into the first discriminator D and is optimized in the direction of maximizing the loss function, until the loss function of the generative adversarial network model is maximized, and the training of the first discriminator is completed;
[0089] Then, m second real images {w1,..., w data} are selected from the real data domain p m , and {w, x} and {w, G(z)} are input into the second discriminator S for training, until the loss function of the generative adversarial network model is maximized, and the training of the second discriminator is completed;
[0090] After the training of the two discriminators is completed, the generator is trained. The goal of the generator training is to input noise data z into the generator G, so that D(G(z))→1 and S(G(z), x)→1.
[0091] After the above-mentioned round of training, the generator will generate better quality pictures, and the first discriminator D and the second discriminator S will have better discrimination ability for images. In this way, the discriminators and the generator learn from each other and grow together, and finally the generator can generate very realistic images after training is completed.
[0092] It should be noted that the first preset number, the second preset number and the preset plurality of batches of training in the embodiment can be changed according to actual needs, and the embodiment is not specifically limited.
[0093] In the embodiment, the second discriminator for calculating the similarity between images is constructed, and the double discriminators are constituted based on the second discriminator for calculating the similarity between images, which can improve the training speed of the generative adversarial network model and improve the quality of image generation.
[0094] For better illustration, the following experimental analysis is performed in the embodiment.
[0095] Since the method proposed in the embodiment is a general method, the technical solution of the embodiment can be introduced into almost all mainstream GAN networks. The baseline and the most advanced method used in the comparison are introduced in the experimental process of the embodiment. The embodiment selects five kinds of models, traditional GAN, DCGAN (Deep Convolutional Generative Adversarial Networks), CGAN (Conditional Generative Adversarial Nets), ACGAN (auxiliary class GAN) and LSGAN (Least Squares Generative Adversarial Networks) as the benchmark method for experiment. In addition, the SCGAN (shape-consistent generative adversarial network) and DEGAN (A Conditional Generative Adversarial Network for Document Enhancement) methods are introduced as SOTA (state-of-the-art) methods for comparative experiments. The algorithm of SCGAN is used in semi-supervised learning, and the similarity constraint algorithm part of SCGAN is referenced in the embodiment and added to the SOTA model for comparison experiment with the technical solution of the embodiment. The experimental group is the technical solution of the embodiment, and the control group is the GAN without introducing the similarity calculation.
[0096] The embodiment proves that the technical scheme of the embodiment has obvious improvement in convergence speed and generated image quality compared with the traditional single discriminator GAN through a large number of experiments. Before training, the hyperparameters (such as learning rate, batch size, etc.) of the neural network are uniformly set to ensure a single variable.
[0097] In order to compare the performance between the two networks, during the experiment, the model parameters are saved once every 500 batches of training, and the Inception Score (IS) of the current model is calculated. The IS index is a standard for measuring the quality of GAN generated images. It measures the quality and diversity of GAN generated images, and the higher the IS score represents the better quality of GAN generated images. After training is completed, the IS scores of the two networks are compared, the quality of the generated images of the networks is compared, and the IS score change graph is drawn to observe the change of the network score during the training process.
[0098] Table 1 is the IS score of the traditional GAN and its variants and the GAN after introducing similarity calculation after training is completed. All hyperparameters are the same during network training, wherein Datasets represents the data set, and Epoch represents the number of training batch iterations in training. It can be found that the GAN after introducing similarity analysis (the technical scheme of the embodiment) has better performance, and the generated image quality is better than that of the traditional GAN.
[0099] Table 1
[0100]
[0101] Reference Figure 2 , Figure 3 Figures (a) and (b) are images generated after 30000 batches of learning of the GAN and the traditional GAN after introducing the technical scheme of the embodiment, figures (c) and (d) are images generated after 100 batches of learning of the DCGAN and the original DCGAN after introducing the technical scheme of the embodiment, figures (e) and (f) are result images of the LSGAN network and the original LSGAN network on the CIFAR-10 data set after 50 batches of training, and figures (g) and (h) are images generated after 50 batches of training of the ACGAN and the original DCGAN after introducing the technical scheme of the embodiment.
[0102] Compared to traditional GAN training methods, the GAN with similarity calculation (the technical solution in this embodiment) converges faster during training, and the generator can learn the distribution domain of real images more quickly. This embodiment represents the network's convergence speed by observing changes in the network's IS Score, referring to... Figure 3 , Figure 4 This demonstrates the convergence speed of each network during training, where epchos represents the number of training batch iterations. Blue: Raw GAN model (i.e. Figure 4 The darker lines in the diagram represent network models that do not incorporate the technical solutions of this embodiment, namely, Yello:New GANmodel. Figure 4 The light-colored lines in the diagram represent the network model of the technical solution introduced in this embodiment. Specifically:
[0103] Figure 4 The diagram illustrates the changes in the Inception Score (IS) during training for a traditional GAN network and a GAN network incorporating similarity calculation (the technical solution of this embodiment). Figure a shows a comparison of the IS scores between the traditional GAN network and the GAN network incorporating the technical solution of this embodiment; Figure b shows a comparison of the IS scores between the traditional GAN network and the GAN network incorporating the technical solution of this embodiment; and Figure c shows a comparison of the IS scores between the DCGAN network and the DCGAN network incorporating the technical solution of this embodiment. Figure 4 As can be seen, the technical solution in this embodiment can bring better results.
[0104] Reference Figure 4 This invention also provides a system for constructing a dual-discriminator generative adversarial network (GAN) model. This system includes a first discriminator construction module 100, a second discriminator construction module 200, a model construction module 300, and a model training module 400, wherein:
[0105] First discriminator construction module 100 is used to construct a first discriminator for judging the authenticity of an image;
[0106] Second discriminant construction module 200 is used to construct a second discriminant for calculating the similarity between images;
[0107] Model building module 300 is used to build a dual-discriminator generative adversarial network model and a loss function for the generative adversarial network model based on a generator, a first discriminator, and a second discriminator.
[0108] The model training module 400 is configured to train the generative adversarial network model according to a loss function, the first preset number of randomly generated noise data, and the second preset number of selected real images, and obtain the trained generative adversarial network model.
[0109] In some embodiments, the model training module comprises a sample data acquisition unit, a first discriminator training unit, a second discriminator training unit, and a generator training unit, wherein:
[0110] The sample data acquisition unit is configured to randomly generate a first preset number of noise data, and input the noise data into the generator to obtain noise sample data.
[0111] The first discriminator training unit is configured to select a second preset number of first real images from a real data domain, and train the first discriminator using the first real images and the noise sample data.
[0112] The second discriminator training unit is configured to select a second preset number of second real images from the real data domain, and train the second discriminator using the first real images and the second real images as a first group of data, and the first real images and the noise sample data as a second group of data.
[0113] The generator training unit is configured to input the noise data into the generator for training after the first discriminator and the second discriminator are trained, so that the generator generates images in the direction of D(G(z))→1 and S(G(z),x)→1.
[0114] It should be noted that, since the construction system of the dual-discriminator generative adversarial network model in the embodiment and the construction method of the dual-discriminator generative adversarial network model described above are based on the same inventive concept, the corresponding contents in the method embodiment are also applicable to the system embodiment, and will not be described in detail here.
[0115] The embodiment of the application further provides a construction device of a dual-discriminator generative adversarial network model, comprising at least one control processor and a memory in communication connection with the at least one control processor.
[0116] The memory, as a non-transitory computer readable storage medium, can be used to store non-transitory software programs and non-transitory computer executable programs. In addition, the memory can include high-speed random access memory, and can also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state memory device. In some embodiments, the memory can optionally include remote memory that is disposed remotely relative to the processor, and the remote memory can be connected to the processor through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0117] The non-transitory software programs and instructions required for implementing the construction method of the dual discriminator generative adversarial network model of the above-mentioned embodiments are stored in the memory, and when executed by the processor, the construction method of the dual discriminator generative adversarial network model of the above-mentioned embodiments is executed, for example, the method steps S100 to S400 in the above description are executed. Figure 5
[0118] The system embodiments described above are only illustrative, and the units described as separate components can or can not be physically separated, that is, they can be located in one place, or can be distributed on multiple network units. According to actual needs, part or all of the units can be selected to achieve the purpose of the present embodiment.
[0119] The embodiment of the present application also provides a computer readable storage medium, which stores computer executable instructions, and the computer executable instructions are executed by one or more control processors, so that the above-mentioned one or more control processors execute the construction method of the dual discriminator generative adversarial network model of the above-mentioned method embodiments, for example, execute the functions of the method steps S100 to S400 in the above description. Figure 1 Figure 1
[0120] As will be appreciated by one of ordinary skill in the art, all or some steps, systems of the above-disclosed methods can be implemented as software, firmware, hardware, or any suitable combination thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application- specific integrated circuit. Such software can be distributed on computer readable media, which can comprise computer storage media (or non-transitory media), and communication media (or transitory media). As is well known to those of ordinary skill in the art, the term computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by a computer. Further, as is well known to those of ordinary skill in the art, communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal, such as a carrier wave or other transport mechanism, and includes any information delivery media.
[0121] The above is the specific description of the preferred implementation of the embodiments of the present application, but the embodiments of the present application are not limited to the above implementation, and those skilled in the art can make various equivalent modifications or replacements without departing from the spirit of the embodiments of the present application, and these equivalent modifications or replacements are all included in the scope defined by the claims of the embodiments of the present application.
Claims
1. A method for constructing a dual discriminator generative adversarial network model, characterized in that, The method for constructing the dual-discriminator generative adversarial network comprises the following steps: a first discriminator for discriminating the authenticity of an image is constructed; a second discriminator for calculating the similarity between images is constructed; a dual-discriminator generative adversarial network model and a loss function of the generative adversarial network model are constructed based on the generator, the first discriminator and the second discriminator; the generative adversarial network model is trained according to the loss function by using randomly generated first preset noise data and selected second preset real images, and a trained generative adversarial network model is obtained, specifically comprising the following steps: the loss function of the generative adversarial network model is constructed in the following manner: in, This refers to the generator. This represents the first discriminator. This represents the second discriminator. Indicates from the real data domain The first real image selected from the data. Indicates from the real data domain The second real image selected from the data. This represents the image generated by the generator. Expressing expectations, Represents noise data. This represents a first preset number of randomly generated noise data; a plurality of preset batches of training are performed, and for each batch of training, the following operations are performed: first preset noise data are randomly generated, and the noise data are input into the generator to obtain noise sample data; second preset first real images are selected from the real data domain, and the first real images and the noise sample data are used to train the first discriminator; second real images with the same number of the first real images are selected from the real data domain, the first real images and the second real images are taken as a first group of data, and the first real images and the noise sample data are taken as a second group of data, and the second discriminator is trained according to the first group of data and the second group of data; After the first discriminator and the second discriminator are trained, the noise data is input into the generator for training, so that the generator generates images in the direction of and after all batches of training are completed, the trained generative adversarial network model is obtained.
2. The method of claim 1, wherein the method further comprises: The second discriminator for calculating the similarity between images comprises the following steps: a similarity between images is calculated by using a twin neural network, and the second discriminator is constructed based on the twin neural network.
3. The method of claim 2, wherein the method further comprises: The objective function of the twin neural network comprises the following steps: wherein, denotes the number of samples, denotes two images, denotes that the two images are similar, denotes that the two images are not similar, denotes a distance between the two images, denotes a preset threshold value.
4. The method of claim 1, wherein the dual discriminator generative adversarial network model is constructed by, The training of the generative adversarial network model comprises the following steps: In training the generator, minimizing , maximizing indicates that the generated image of the generator is more similar to the real image. In training two discriminators, maximizing , minimizing indicates that the generated images of the generator are more similar to the real images. 5.A system for constructing a dual discriminator generative adversarial network model, characterized in that, The construction system of the dual-discriminator generative adversarial network model comprises the following steps: a first discriminator construction module for constructing a first discriminator for discriminating the authenticity of an image; a second discriminator construction module for constructing a second discriminator for calculating the similarity between images; a model construction module for constructing a dual-discriminator generative adversarial network model and a loss function of the generative adversarial network model based on the generator, the first discriminator and the second discriminator; a model training module for training the generative adversarial network model according to the loss function by using randomly generated first preset noise data and selected second preset real images, and obtaining a trained generative adversarial network model, specifically comprising the following steps: the loss function of the generative adversarial network model is constructed in the following manner: in, This refers to the generator. This represents the first discriminator. This represents the second discriminator. Indicates from the real data domain The first real image selected from the data. Indicates from the real data domain The second real image selected from the data. This represents the image generated by the generator. Expressing expectations, Represents noise data. This represents a first preset number of randomly generated noise data; a plurality of preset batches of training are performed, and for each batch of training, the following operations are performed: first preset noise data are randomly generated, and the noise data are input into the generator to obtain noise sample data; second preset first real images are selected from the real data domain, and the first real images and the noise sample data are used to train the first discriminator; selecting, from the real data domain, second real images same in number as the first real images, and taking the first real images and the second real images as a first group of data, and taking the first real images and the noise sample data as a second group of data, and training the second discriminator according to the first group of data and the second group of data; After the first discriminator and the second discriminator are trained, the noise data is input into the generator for training, so that the generator generates images in the direction of and until all batches of training are completed, a trained generative adversarial network model is obtained. 6.A device for constructing a dual discriminator generative adversarial network model, characterized in that, The method comprises the steps of: providing at least one control processor and a memory connected in communication with the at least one control processor; the memory storing instructions executable by the at least one control processor, the instructions being executed by the at least one control processor to enable the at least one control processor to perform the method for constructing a dual-discriminator generative adversarial network model according to any one of claims 1 to 4.
7. A computer readable storage medium characterized by, The computer-readable storage medium stores computer-executable instructions for causing a computer to perform the method for constructing a dual-discriminator generative adversarial network model according to any one of claims 1 to 4.
Citation Information
Patent Citations
Image super-resolution method of generative adversarial network based on double discriminators
CN111028146A
Method for training a generative adversarial network (GAN), generative adversarial network, computer program, machine-readable memory medium, and device
US20200372297A1