CN112598125B - Handwriting digital generation method based on dual-discriminant weighting generation countermeasure network - Google Patents
Handwriting digital generation method based on dual-discriminant weighting generation countermeasure network Download PDFInfo
- Publication number
- CN112598125B CN112598125B CN202011342015.8A CN202011342015A CN112598125B CN 112598125 B CN112598125 B CN 112598125B CN 202011342015 A CN202011342015 A CN 202011342015A CN 112598125 B CN112598125 B CN 112598125B
- Authority
- CN
- China
- Prior art keywords
- generator
- discriminator
- discriminant
- loss
- network
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 28
- 230000006870 function Effects 0.000 claims abstract description 79
- 238000012549 training Methods 0.000 claims description 35
- 238000004422 calculation algorithm Methods 0.000 claims description 12
- 238000009826 distribution Methods 0.000 claims description 10
- 230000008569 process Effects 0.000 claims description 9
- 230000009977 dual effect Effects 0.000 claims description 7
- 238000005070 sampling Methods 0.000 claims description 6
- ORILYTVJVMAKLC-UHFFFAOYSA-N Adamantane Natural products C1C(C2)CC3CC1CC2C3 ORILYTVJVMAKLC-UHFFFAOYSA-N 0.000 claims description 3
- 230000000295 complement effect Effects 0.000 claims description 3
- 230000004927 fusion Effects 0.000 claims description 3
- 230000008034 disappearance Effects 0.000 abstract description 7
- 238000013135 deep learning Methods 0.000 abstract description 3
- 238000010586 diagram Methods 0.000 description 7
- 230000000694 effects Effects 0.000 description 5
- 238000004088 simulation Methods 0.000 description 4
- 208000001613 Gambling Diseases 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000005457 optimization Methods 0.000 description 2
- 238000012360 testing method Methods 0.000 description 2
- 230000002238 attenuated effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000008094 contradictory effect Effects 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000002950 deficient Effects 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 238000013508 migration Methods 0.000 description 1
- 230000005012 migration Effects 0.000 description 1
- 230000000116 mitigating effect Effects 0.000 description 1
- 230000006641 stabilisation Effects 0.000 description 1
- 238000011105 stabilization Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/084—Backpropagation, e.g. using gradient descent
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Evolutionary Computation (AREA)
- Bioinformatics & Computational Biology (AREA)
- Computational Linguistics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Evolutionary Biology (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Character Discrimination (AREA)
Abstract
The application discloses a handwritten number generation method based on a dual-discriminant weighting generation countermeasure network, relates to the technical field of deep learning, aims at the technical problem of D2GAN, and provides the handwritten number generation method based on the dual-discriminant weighting generation countermeasure network, wherein a new objective function is built by introducing a weighting idea, and the phenomenon of gradient disappearance is avoided from the perspective of a loss function; the advantages of forward KL divergence and reverse KL divergence are combined, so that the generated modes are diversified, and the mode collapse problem of GAN is improved.
Description
Technical Field
The invention relates to the technical field of deep learning, in particular to a handwritten number generation method for generating an countermeasure network based on double-discriminant weighting.
Background
Generating a countermeasure network (GAN) is a method of countermeasure learning developed in recent years. GAN consists of a generator G and a arbiter D, both gambling with each other, using the idea of gambling theory, with the aim of finding Nash equilibrium (Nash equilibrary) in successive non-convex questions with high dimensional parameters. The GAN is proved to be capable of generating a vivid image, is helpful in the aspects of data enhancement and image complementation, and is mainly applied to the fields of image super-resolution reconstruction, migration learning, image restoration and the like.
However, given an optimal arbiter, the generator's loss function is equivalent to minimizing the JS divergence (Jensen-Shannon) JS (P data||PG) between the real data P data (x) and the generated sample P g (z). Two distributions are difficult to intersect in a high-dimensional space, even if the two distributions intersect, the intersection part is a low-dimensional manifold in the high-dimensional space, the measurement is 0, the intersection part can be ignored, the JS divergence is constant at the moment, and the problem of gradient disappearance occurs. To solve this problem, goodfellow et al redefines the loss function of the generator-log (D (G (z))). Although the gradient vanishing problem is solved, the contradiction between minimizing KL divergence and maximizing JS divergence exists in the objective function, so that the training of the generator is unstable, most of generated samples are repeated safe samples, the generated images tend to be consistent and the diversity is reduced due to lack of diversity, and the generated samples are deficient in variety, so that the problem of mode collapse occurs.
Aiming at the mode collapse problem of GAN, a D2GAN algorithm is proposed in the prior art, the idea of introducing a double discriminator is tried to comprehensively utilize KL divergence and reverse KL divergence in an objective function so as to balance the countermeasure of a generator and the discriminator. The objective function introduces super parameters alpha and beta, and has two purposes: firstly, in order to stabilize the learning of the model, the influence of-D 1 (G (z)) and-D 2 (x) on optimization is reduced by reducing alpha and beta; secondly, by increasing alpha and beta, the minimization of KL divergence and reverse KL divergence are respectively encouraged. Similar to the GAN algorithm, the introduction of the hyper-parameters, while having a mitigating effect on model stabilization and mode collapse, is contradictory with the decrease and increase of the hyper-parameters so that the two functions can cancel each other, making the generator training unstable.
D2GAN introduces a dual arbiter that attempts to solve the pattern collapse problem of GAN, but gives no explicit instructive advice on superparameters, whose generator can learn most of the distribution, but still have some of the distribution forgotten. Therefore, the application provides a handwriting digital generation method based on a dual-discriminant weighting generation countermeasure network, wherein a new objective function is constructed by introducing a weighting idea, and the phenomenon of gradient disappearance is avoided from the perspective of a loss function; the advantages of forward KL divergence and reverse KL divergence are combined, so that the generated modes are diversified, and the mode collapse problem of GAN is improved.
Disclosure of Invention
The invention aims to provide a handwritten number generation method based on a dual-discriminant weighting generation countermeasure network, which introduces a weighting idea to construct a new objective function and avoids the phenomenon of gradient disappearance from the angle of a loss function; the advantages of forward KL divergence and reverse KL divergence are combined, so that the generated modes are diversified, and the mode collapse problem of GAN is improved.
The invention provides a handwritten number generation method based on a dual-discriminant weighting generation countermeasure network, which comprises the following steps:
s1: establishing a D2WGAN network model, wherein the D2WGAN network model consists of a generator G, a discriminator D 1 and a discriminator D 2, and the D2WGAN network model is trained through back propagation;
s2: theoretical analysis is carried out on the D2WGAN network model, and the fact that the generator recovers the real data of the handwritten number by minimizing the KL divergence and the reverse KL divergence between the model and the real data under the optimal discriminant is verified.
Further, the training process in step S1 specifically includes:
S11: adopting MNIST data set as training sample;
s12: building a generator and a discriminator model;
s13: establishing a loss function of the discriminator and the generator;
S14: training a generator and a discriminant model.
Further, the input-output relationship between the generator and the arbiter in the step S12 is as follows:
The input-output expression relationship of the generator is as follows:
wherein: t (G) denotes the output of the generation network G, For sampling m samples from the noise space P z;
The input-output expression relationship of the discriminator D 1 is:
Wherein: t (D 1) represents the output of the discrimination network D 1, For sampling m samples from the real data space P data;
The input-output expression relationship of the discriminator D 2 is:
wherein: t (D 2) represents the output of the discrimination network D 2.
Further, in the step S13, inputs of a generator and a discriminator are first obtained, the input of the generator is noise z, z satisfies random noise distribution P z, the input of the discriminator includes a sample generated by the generator and a real data sample x, the noise data is input into the generator to obtain G (z), the sample G (z) generated by the generator is input into a discriminator D 1 and a discriminator D 2 to obtain D 1 (G (z) and D 2 (G (z)), and the real data x is input into a discriminator D 1 and a discriminator D 2 to obtain D 1 (x) and D 2 (x), respectively;
the loss function of the arbiter is:
Loss_D=Loss_D1+Loss_D2 (6)
Wherein: loss_d 1 is the Loss function of arbiter D 1, loss_d 2 is the Loss function of arbiter D 2, loss_d is the total arbiter Loss function, and the relationship between the two hyper-parameters is: 0.ltoreq.ω.ltoreq.1 and ρ+ω=1, the discriminator D 1 mainly focuses on the real data, the discriminator D 2 mainly focuses on the data generated by the generator, and the two discriminators are connected by weighting;
The loss function of the generator is:
Further, in the training process in step S14, an Adam optimizer is used for training, and the formula is as follows:
mt=μ*mt-1+(1-μ)*gt (8)
Further, in the step S1, the discriminator D 1 and the discriminator D 2 are both multi-layer perceptron, and the objective function of the D2WGAN network model is formed by weighting two parts of a forward objective function and a reverse objective function, and the objective function is as follows:
introducing super parameters rho and omega, wherein rho and omega are the weights of forward and reverse objective functions respectively; wherein ρ+ω=1 and 0 ρ, ω 1;
The forward objective function is:
the reverse objective function is:
When ρ=1, ω=0, the D2WGAN algorithm degenerates to a forward objective function, which is:
the optimal discriminator is as follows:
on the basis of the optimal discriminant, the optimal generator is as follows:
when ρ=0, ω=1, the D2WGAN algorithm degenerates to the inverse objective function, i.e. the objective function is:
the optimal discriminator is as follows:
on the basis of the optimal discriminant, the optimal generator is as follows:
When both forward and reverse objective functions exist, namely 0< ρ , ω < 1 and ρ+ω=1, the network is equivalent to the weighted fusion of the KL divergence and the reverse KL divergence according to different emphasis degrees of single and multiple modes, and the generation of bad samples is avoided on the basis of generating multiple modes by utilizing the complementary characteristics of the two divergences.
Further, given a fixed G, the step S2 maximizes T (G, D 1,D2) to obtain the following closed form optimal discriminant
Further, the step S2 is given byAnd/>At Nash equilibrium, if and only if P G=Pdata,Reaching global minimum;
Wherein,
Compared with the prior art, the invention has the following remarkable advantages:
(1) Compared with the D2GAN objective function, the invention has different ideas. The D2WGAN introduces a weighting thought to make the network focus on the heuristic defects of the super parameters in the D2GAN, so that the forward and reverse KL divergences are fused and complemented, the generation of bad samples is avoided on the basis of generating multiple modes, and the problem of mode collapse can be effectively solved. The purpose of introducing the super-parameters in the two objective functions is different. The D2WGAN introduction of the hyper-parameters was done to weight the forward and reverse KL divergences on a weighted basis, while the D2GAN introduction was done to stabilize the model, reduce the impact of-D 1 (G (z)) and-D 2 (x) and control the forward and reverse KL divergences on the optimization. The two constraints are different. The emphasis weighting thought is introduced into the D2WGAN algorithm, the constraint conditions are ρ=1, ω=0, ρ=0, ω=1, and the completeness of the emphasis is considered; the constraint condition in D2GAN is 0 < alpha, beta is less than or equal to 1, and the interpretation is lacking.
2) The optimized objective function of the invention can degrade to the forward and reverse KL divergence. The D2WGAN algorithm can be degraded into KL divergence and reverse KL divergence in two extreme cases of ρ=1, ω=0 and ρ=0, ω=1, which is helpful for realizing multi-mode generation or capturing single mode, and has strong interpretability; in D2GAN, only 0 < alpha, beta is less than or equal to 1, and the objective function itself determines that the objective function cannot degrade to KL and reverse KL divergence, and the interpretability is lacking.
3) The optimized results of the invention are different. When P G=Pdata is adopted, the optimal discriminant in the D2WGAN algorithm isThe optimal arbiter in D2GAN is D 1 *(x)=α,D2 * (x) =β. When optimizing the generator on the basis of the optimal discriminant, the D2WGAN result is/>And D2GAN results as J (G, D 1 *,D2 *) =αlog (α -1) +βlog (β -1). From the result, when the D2GAN judges whether the network obtains the optimal discriminator and the optimal generator, the result has super parameters alpha and beta, and along with the change of the super parameters alpha and beta, the judgment standard is changed every time, so that the method is not intuitive; the result of the D2WGAN is an integer and does not change along with the variation of the super-parameters, and the judgment result is more visual when judging whether the network reaches Nash balance.
Drawings
FIG. 1 is a schematic diagram of a handwritten numeral generation method for a dual arbiter weighted generation countermeasure network according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method for generating handwritten numbers for a dual arbiter weighted generation countermeasure network according to an embodiment of the present invention;
FIG. 3 is a block diagram of a dual arbiter weighted generation countermeasure network provided by an embodiment of the present invention;
FIG. 4 is a graph of maximum and minimum losses and non-saturation losses provided by an embodiment of the present invention;
FIG. 5 is a graph of linear loss provided by an embodiment of the present invention;
fig. 6 is a training flowchart of the arbiter network D1, D2 provided in the embodiment of the present invention;
FIG. 7 is a training flowchart of the generator network G according to an embodiment of the present invention;
Fig. 8 is a handwritten digital image effect diagram generated by using MNIST data set by GAN network according to an embodiment of the present invention;
fig. 9 is a diagram of a handwritten digital image effect generated by a D2GAN network using MNIST data sets according to an embodiment of the present invention;
Fig. 10 is a diagram showing the effect of a handwritten digital image generated by a D2WGAN network using MNIST datasets according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention, taken in conjunction with the accompanying drawings, will clearly and completely describe the embodiments of the present invention, and it is evident that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
Aiming at the problem of mode collapse of GAN, the capability of generating diversity samples is poor; the invention provides a double-discriminant weighting generation countermeasure network, a new objective function is constructed by introducing a weighting idea, and the phenomenon of gradient disappearance is avoided from the angle of a loss function; the advantages of the forward KL divergence and the reverse KL divergence are combined, so that the generated modes are diversified, and the problem of mode collapse is avoided.
Two loss functions are proposed in GAN to train the generator G. In early training, the prior art may not provide enough gradient for the generator to train well with the use of minimax loss functions, and is easy to saturate, and in practical applications, it is recommended to train the generator with unsaturated loss functions. In the experimental process, the gradient disappearance is caused by the two loss functions when the generator is trained, the result is shown in figure 1, when the input value is smaller, the output value of the discriminator tends to 0, and saturation occurs at the initial stage of training by using minimx loss functions; when the input value is large, the output value of the discriminator tends to be 1, and saturation occurs in the later stage of training by using the unsaturated loss function. As shown in FIG. 2, the derivative of the linear loss function is-1, the gradient of the linear loss function cannot be attenuated, and the phenomenon of gradient disappearance can be effectively relieved; by utilizing the linear relation, the method can quickly converge in random gradient descent and has high calculation speed. Practice has shown that the sample diversity generated by the training generator using the linear loss function-D (·) is better.
Fig. 1 is a schematic diagram of a handwritten numeral generation method for generating an countermeasure network based on a double-discriminant weighting, and fig. 2 is a flowchart of a handwritten numeral generation method for generating an countermeasure network based on a double-discriminant weighting, in which a handwritten numeral data set is prepared as a training sample, random noise is used as an input of a generator, and data generated by the generator and sampled real data are used as inputs of the discriminant. Initializing weight parameters of a generator and two discriminators, firstly fixing the weight parameters of the generator, training the D1 and D2 networks of the discriminators, wherein the model structures of the two discriminators are identical, and the weight parameters of the two discriminators are different in loss functions during training, so that the emphasis points of the two discriminators are also different; and secondly, fixing weight parameters of the two discriminators, and training the discriminator G network.
Referring to fig. 1-10, the present invention provides a handwritten numeral generation method for generating an countermeasure network based on double-discriminant weighting, comprising the steps of:
S1: establishing a D2WGAN network model, wherein the D2WGAN network model consists of a generator G, a discriminator D 1 and a discriminator D 2, and FIG. 3 is a structure diagram of a dual-discriminator weighting generation countermeasure network, and the D2WGAN network model is trained through back propagation;
s2: theoretical analysis is carried out on the D2WGAN network model, and the fact that the generator recovers the real data of the handwritten number by minimizing the KL divergence and the reverse KL divergence between the model and the real data under the optimal discriminant is verified.
Example 1
The training process in the step S1 specifically comprises the following steps:
S11: adopting MNIST data set as training sample;
s12: building a generator and a discriminator model;
s13: establishing a loss function of the discriminator and the generator;
S14: training a generator and a discriminant model.
Wherein, the step S11 prepares MNIST data set as training sample, wherein MNIST data set is composed of numbers written by 250 different persons, 50% of which are high school students, 50% of which are staff from the census bureau (the Census Bureau). The data set comprises 70000 handwritten digital pictures, wherein 60000 handwritten digital pictures are training sets, 10000 handwritten digital pictures are test sets, the data set is divided into 10 types of 0-9 handwritten digital pictures, and the data set is normalized to 28 x 28 gray scale pictures.
The input-output relationship between the generator and the arbiter in the step S12 is as follows:
in order to compare the effect of the dual arbiter weighting the generation of the challenge network with the generation of the challenge network and the generation of the handwritten numbers by the dual arbiter generation of the challenge network, the model structure of the generator and the arbiter is very simple to set and has only one hidden layer.
The input-output expression relationship of the generator is as follows:
wherein: t (G) denotes the output of the generation network G, For sampling m samples from the noise space P z;
The input-output expression relationship of the discriminator D 1 is:
Wherein: t (D 1) represents the output of the discrimination network D 1, For sampling m samples from the real data space P data;
The input-output expression relationship of the discriminator D 2 is:
wherein: t (D 2) represents the output of the discrimination network D 2.
In the step S13, firstly, inputs of a generator and a discriminator are obtained, the inputs of the generator are noise z, z meets random noise distribution P z, the inputs of the discriminator comprise samples generated by the generator and real data samples x, the noise data are input into the generator to obtain G (z), the samples G (z) generated by the generator are respectively input into a discriminator D 1 and a discriminator D 2 to obtain D 1 (z) and D 2 (G (z), and the real data x is input into a discriminator D 1 and a discriminator D 2 to obtain D 1 (x) and D 2 (x);
the loss function of the arbiter is:
Loss_D=Loss_D1+Loss_D2 (6)
Wherein: loss_d 1 is the Loss function of arbiter D 1, loss_d 2 is the Loss function of arbiter D 2, loss_d is the total arbiter Loss function, and the relationship between the two hyper-parameters is: 0.ltoreq.ω.ltoreq.1 and ρ+ω=1, the discriminator D 1 mainly focuses on the real data, the discriminator D 2 mainly focuses on the data generated by the generator, and the two discriminators are connected by weighting;
The loss function of the generator is:
in the training process in step S14, an Adam optimizer is used for training, and the formula is as follows:
mt=μ*mt-1+(1-μ)*gt (8)
Equations (8) and (9) are the first and second moment estimates of the gradient, respectively, and equations (10) and (11) are corrections to the first order second moment estimates, which can be approximated as an unbiased estimate of the desired. It can be seen that the moment estimation of the gradient directly has no additional requirement on the memory and can be dynamically adjusted according to the gradient. The last previous part is a dynamic constraint on the learning rate n and has a definite range.
Example 2
The discriminant D 1 and the discriminant D 2 in the step S1 are multi-layer perceptron, and the objective function of the D2WGAN network model is formed by weighting two parts of a forward objective function and a reverse objective function, and the form of the objective function is as follows:
introducing super parameters rho and omega, wherein rho and omega are the weights of forward and reverse objective functions respectively; wherein ρ+ω=1 and 0 ρ, ω 1;
The forward objective function is:
the reverse objective function is:
When ρ=1, ω=0, the D2WGAN algorithm degenerates to a forward objective function, which is:
the optimal discriminator is as follows:
on the basis of the optimal discriminant, the optimal generator is as follows:
In this case, the network is equivalent to optimizing the KL divergence, which is helpful for generating the multi-mode distribution, but may generate bad samples.
When ρ=0, ω=1, the D2WGAN algorithm degenerates to the inverse objective function, i.e. the objective function is:
the optimal discriminator is as follows:
on the basis of the optimal discriminant, the optimal generator is as follows:
The network now acts to optimize the reverse KL divergence, helping to better capture the single pattern, but possibly losing part of the samples.
When both forward and reverse objective functions exist, namely 0< ρ , ω < 1 and ρ+ω=1, the network is equivalent to the weighted fusion of the KL divergence and the reverse KL divergence according to different emphasis degrees of single and multiple modes, and the generation of bad samples is avoided on the basis of generating multiple modes by utilizing the complementary characteristics of the two divergences.
Example 3
Said step S2 gives a fixed G, maximizes T (G, D 1,D2), and derives the following closed form optimal discriminant
Example 4
Said step S2 givingAnd/>Under Nash equilibrium, if and only if P G=Pdata,/>Reaching global minimum;
Wherein,
Example 5
The effect of the invention is further described in connection with simulation experiments.
1. Experimental environment:
The simulation experiment environment of the invention is as follows: the processor is InterXeon E5-2620 v4, the operating system is 64-bit Windows 10, the graphics card is NVIDIA GeForce RTX 2080Ti, the pycharm editor is used, the python3.7 version is used, and the Tensorflow deep learning framework is used. Using MNIST handwritten digital images, the dataset contained 70000 handwritten digital pictures, of which 60000 are training sets and 10000 are test sets, the experiment only used 60000 training datasets.
2. Simulation experiment contents:
And generating handwritten digital pictures on the original generated countermeasure network and the double-discriminant weighted generated countermeasure network respectively. Except for the algorithm, the network structure is basically consistent, the network structure is an implicit layer, the iterative training is carried out for the same times, and the generated handwritten digital results are compared, and the results are shown in fig. 8, 9 and 10.
3. Simulation result analysis:
As can be seen from fig. 8, when the GAN generates MNIST data, most of the generated handwritten numerals are 0, 3, and 8, and the other numerals are rarely present, but the other handwritten numerals except 0, 3, and 8 are not substantially present in the later stage of training. The reason is that GAN finds a pattern that is easier to fool the arbiter during the training process, so that the probability of generating such a pattern is increasing, resulting in fewer types of handwritten numbers being generated. As can be seen from fig. 9, the D2GAN generates more types of handwritten numbers, and all other handwritten numbers are present in the later stages of operation, except for the fact that 2 is less present during training. It is explained that most of the distribution can be learned by D2GAN during the learning process, but some of the distribution is left behind. As can be seen from FIG. 10, D2WGAN generates all handwritten numbers within 0-9 and is uniformly distributed. Overall, D2WGAN can better balance the KL divergence and reverse KL divergence parameters, resulting in better diversity.
The foregoing disclosure is merely illustrative of some embodiments of the invention, but the embodiments are not limited thereto, and any variations that may be contemplated by one skilled in the art should fall within the scope of the invention.
Claims (3)
1. A handwritten number generation method for generating a countermeasure network based on double-discriminant weighting is characterized by comprising the following steps:
S1: establishing a D2WGAN network model, wherein the D2WGAN network model consists of a generator G, a discriminator D 1 and a discriminator D 2, and the D2WGAN network model is trained through back propagation; the training process in the step S1 specifically comprises the following steps:
S11: adopting MNIST data set as training sample;
s12: building a generator and a discriminator model; the input-output relationship between the generator and the arbiter in the step S12 is as follows:
The input-output expression relationship of the generator is as follows:
wherein: t (G) denotes the output of the generation network G, For sampling m samples from the noise space P z;
The input-output expression relationship of the discriminator D 1 is:
Wherein: t (D 1) represents the output of the discrimination network D 1, For sampling m samples from the real data space P data;
The input-output expression relationship of the discriminator D 2 is:
wherein: t (D 2) represents the output of the discrimination network D 2;
s13: establishing a loss function of the discriminator and the generator; in the step S13, firstly, inputs of a generator and a discriminator are obtained, the input of the generator is noise z, z meets random noise distribution P z, the input of the discriminator comprises samples generated by the generator and real data samples x, the noise data is input into the generator to obtain G (z), the samples G (z) generated by the generator are respectively input into a discriminator D 1 and a discriminator D 2 to obtain D 1 (G (z) and D 2 (G (z)), and the real data x is input into a discriminator D 1 and a discriminator D 2 to obtain D 1 (x) and D 2 (x);
the loss function of the arbiter is:
Loss_D=Loss_D1+Loss_D2 (6)
Wherein: loss_d 1 is the Loss function of the arbiter D1, loss_d 2 is the Loss function of the arbiter D 2, loss_d is the total Loss function of the arbiter, and the relationship between the two hyper-parameters is: 0.ltoreq.ω.ltoreq.1 and ρ+ω=1, the discriminator D 1 mainly focuses on the real data, the discriminator D 2 mainly focuses on the data generated by the generator, and the two discriminators are connected by weighting;
The loss function of the generator is:
s14: training a generator and a discriminant model; in the training process in step S14, an Adam optimizer is used for training, and the formula is as follows:
mt=μ*mt-1+(1-μ)*gt (8)
The discriminant D 1 and the discriminant D 2 in the step S1 are multi-layer perceptron, and the objective function of the D2WGAN network model is formed by weighting two parts of a forward objective function and a reverse objective function, and the form of the objective function is as follows:
introducing super parameters rho and omega, wherein rho and omega are the weights of forward and reverse objective functions respectively; wherein ρ+ω=1 and 0 ρ, ω 1;
The forward objective function is:
the reverse objective function is:
When ρ=1, ω=0, the D2WGAN algorithm degenerates to a forward objective function, which is:
the optimal discriminator is as follows:
on the basis of the optimal discriminant, the optimal generator is as follows:
when ρ=0, ω=1, the D2WGAN algorithm degenerates to the inverse objective function, i.e. the objective function is:
the optimal discriminator is as follows:
on the basis of the optimal discriminant, the optimal generator is as follows:
d2WGAN when both forward and reverse objective functions exist, namely 0 < ρ, ω < 1 and ρ+ω=1, the network is equivalent to the weighted fusion of KL divergence and reverse KL divergence according to different emphasis degrees of single and multiple modes, and the generation of bad samples is avoided on the basis of generating multiple modes by utilizing the complementary characteristics of the two divergences;
s2: theoretical analysis is carried out on the D2WGAN network model, and the fact that the generator recovers the real data of the handwritten number by minimizing the KL divergence and the reverse KL divergence between the model and the real data under the optimal discriminant is verified.
2. The method for generating handwritten numbers based on dual-discriminant weighting to generate an countermeasure network as recited in claim 1, wherein said step S2 is given a fixed G, and T (G, D 1,D2) is maximized to obtain an optimal discriminant in the following closed form
3. The method for generating handwritten numbers based on a dual arbiter weighting generation countermeasure network according to claim 1, wherein said step S2 is given byAnd/>Under Nash equilibrium, if and only if P G=Pdata,/>Reaching global minimum;
Wherein, at PG=Pdata。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011342015.8A CN112598125B (en) | 2020-11-25 | 2020-11-25 | Handwriting digital generation method based on dual-discriminant weighting generation countermeasure network |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011342015.8A CN112598125B (en) | 2020-11-25 | 2020-11-25 | Handwriting digital generation method based on dual-discriminant weighting generation countermeasure network |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112598125A CN112598125A (en) | 2021-04-02 |
CN112598125B true CN112598125B (en) | 2024-04-30 |
Family
ID=75183963
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011342015.8A Active CN112598125B (en) | 2020-11-25 | 2020-11-25 | Handwriting digital generation method based on dual-discriminant weighting generation countermeasure network |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112598125B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114757329A (en) * | 2021-12-23 | 2022-07-15 | 西安科技大学 | Hand-written digit generation method for generating confrontation network based on double-discriminator weighted mixing |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108470196A (en) * | 2018-02-01 | 2018-08-31 | 华南理工大学 | A method of handwritten numeral is generated based on depth convolution confrontation network model |
CN108520282A (en) * | 2018-04-13 | 2018-09-11 | 湘潭大学 | A kind of sorting technique based on Triple-GAN |
CN108711138A (en) * | 2018-06-06 | 2018-10-26 | 北京印刷学院 | A kind of gray scale picture colorization method based on generation confrontation network |
WO2019015466A1 (en) * | 2017-07-17 | 2019-01-24 | 广州广电运通金融电子股份有限公司 | Method and apparatus for verifying person and certificate |
EP3557487A1 (en) * | 2018-04-20 | 2019-10-23 | ZF Friedrichshafen AG | Generation of validation data with generative contradictory networks |
CN110598806A (en) * | 2019-07-29 | 2019-12-20 | 合肥工业大学 | Handwritten digit generation method for generating countermeasure network based on parameter optimization |
WO2020029356A1 (en) * | 2018-08-08 | 2020-02-13 | 杰创智能科技股份有限公司 | Method employing generative adversarial network for predicting face change |
WO2020172838A1 (en) * | 2019-02-26 | 2020-09-03 | 长沙理工大学 | Image classification method for improvement of auxiliary classifier gan |
-
2020
- 2020-11-25 CN CN202011342015.8A patent/CN112598125B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019015466A1 (en) * | 2017-07-17 | 2019-01-24 | 广州广电运通金融电子股份有限公司 | Method and apparatus for verifying person and certificate |
CN108470196A (en) * | 2018-02-01 | 2018-08-31 | 华南理工大学 | A method of handwritten numeral is generated based on depth convolution confrontation network model |
CN108520282A (en) * | 2018-04-13 | 2018-09-11 | 湘潭大学 | A kind of sorting technique based on Triple-GAN |
EP3557487A1 (en) * | 2018-04-20 | 2019-10-23 | ZF Friedrichshafen AG | Generation of validation data with generative contradictory networks |
CN108711138A (en) * | 2018-06-06 | 2018-10-26 | 北京印刷学院 | A kind of gray scale picture colorization method based on generation confrontation network |
WO2020029356A1 (en) * | 2018-08-08 | 2020-02-13 | 杰创智能科技股份有限公司 | Method employing generative adversarial network for predicting face change |
WO2020172838A1 (en) * | 2019-02-26 | 2020-09-03 | 长沙理工大学 | Image classification method for improvement of auxiliary classifier gan |
CN110598806A (en) * | 2019-07-29 | 2019-12-20 | 合肥工业大学 | Handwritten digit generation method for generating countermeasure network based on parameter optimization |
Non-Patent Citations (2)
Title |
---|
一种基于生成对抗网络的图像修复算法;李天成;何嘉;;计算机应用与软件(12);全文 * |
基于Wasserstein距离的双向学习推理;花强;刘轶功;张峰;董春茹;;河北大学学报(自然科学版)(03);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN112598125A (en) | 2021-04-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2019136772A1 (en) | Blurred image restoration method, apparatus and device, and storage medium | |
Bar et al. | Semi-blind image restoration via Mumford-Shah regularization | |
CN111737743A (en) | Deep learning differential privacy protection method | |
CN113723295A (en) | Face counterfeiting detection method based on image domain frequency domain double-flow network | |
CN110728636A (en) | Monte Carlo rendering image denoising model, method and device based on generative confrontation network | |
WO2021185330A1 (en) | Data enhancement method and data enhancement apparatus | |
CN112598125B (en) | Handwriting digital generation method based on dual-discriminant weighting generation countermeasure network | |
Chen et al. | A soft double regularization approach to parametric blind image deconvolution | |
CN114757329A (en) | Hand-written digit generation method for generating confrontation network based on double-discriminator weighted mixing | |
CN114925699B (en) | High-mobility countermeasure text generation method based on style transformation | |
CN113065653A (en) | Design method of lightweight convolutional neural network for mobile terminal image classification | |
Ahmad et al. | A comparative study of different denoising techniques in digital image processing | |
CN110764958B (en) | White box target attack method of brain-computer interface regression system based on EEG | |
CN112836820A (en) | Deep convolutional network training method, device and system for image classification task | |
US20220108220A1 (en) | Systems And Methods For Performing Automatic Label Smoothing Of Augmented Training Data | |
CN112927168B (en) | Image enhancement method based on longicorn stigma search and differential evolution hybrid algorithm | |
CN117079081B (en) | Multi-mode video text processing model training method and system | |
EP1939796A2 (en) | Data processing apparatus, data processing method data processing program and computer readable medium | |
Li et al. | Multi-modality ensemble distortion for spatial steganography with dynamic cost correction | |
Horváth et al. | Testing for changes in linear models using weighted residuals | |
CN116229206A (en) | Training of image translation model, image translation method, device and storage medium | |
CN111784726A (en) | Image matting method and device | |
CN114372941B (en) | Low-light image enhancement method, device, equipment and medium | |
CN113011410A (en) | Training method of character recognition model, character recognition method and device | |
Gemelos et al. | Algorithms for discrete denoising under channel uncertainty |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |