Embodiments described herein relate to a data discriminator training method, a data discriminator training apparatus, and a training method.
Generative Adversarial Networks (GAN: Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio, "Generative adversarial networks," arXiv preprint arXiv: 1406.2661, 10 Jun 2014
) are widely studied as a framework of a generative model and applied to various datasets in recent years. The GAN is a framework for generating a model distribution obtained by modeling a given target distribution, and is configured by a generator which generates the model distribution and a discriminator which discriminates the model distribution from a target. In each step, the best discriminator is continuously trained so as to reduce a difference between the model distribution and the target distribution measured by the discriminator with respect thereto.
In the training of the GAN, control of performance of the discriminator becomes a problem. In high-dimensional space, density ratio estimation by using the discriminator is often inaccurate and unstable during the training. As a result, a generator network cannot learn a multimodal structure of the target distribution. Moreover, when a support for the model distribution and a support for the target distribution are separated, a discriminator capable of completely discriminating the model distribution from the target distribution is present. In this situation, when such a discriminator is generated, a derivative of the discriminator with respect to an input becomes "0" (zero), which stops the training of the generator.
PROBLEM TO SOLVE
The embodiments of the present invention propose data discriminator training method and apparatus, and a program which stabilize training of a discriminator network.
According to one embodiment, a data discriminator training method of training a data discriminator including a neural network model which discriminates between correct answer data and false data, the data discriminator training method includes: a step of inputting the correct answer data to the data discriminator, and acquiring a first inference result; a step of inputting the false data to the data discriminator, and acquiring a second inference result; a step of calculating an error based on the acquired first inference result and the acquired second inference result; and a step of updating, based on the error and a singular value of a weight matrix of each layer of the neural network model, the weight matrix.
According to the embodiment, it becomes possible to perform stabilization of training of a discriminator in GAN.
BRIEF DESCRIPTION OF THE DRAWINGS
Fig. 1 is a flowchart illustrating a flow of learning of a data discriminator according to this embodiment;
Fig. 2 is a block diagram illustrating a function of a data discrimination apparatus according to this embodiment;
Fig. 3 is a chart illustrating setting examples of parameters in a comparative experiment;
Fig. 4A is a graph illustrating inception scores in the comparative experiment;
Fig. 4B is a graph illustrating inception scores in the comparative experiment;
Fig. 5A is a chart illustrating inception scores in the comparative experiment;
Fig. 5B is a chart illustrating inception scores in the comparative experiment;
Fig. 6 is charts illustrating examples of output results in the comparative experiment;
Fig. 7 is charts illustrating examples of output results in the comparative experiment;
Fig. 8 is a chart illustrating theoretical values of sizes of singular values of weight matrices in the comparative experiment;
Fig. 9A is charts illustrating sizes of singular values of weight matrices in the comparative experiment;
Fig. 9B is charts illustrating sizes of singular values of weight matrices in the comparative experiment;
Fig. 10A is a chart illustrating processing times in the comparative experiment;
Fig. 10B is a chart illustrating processing times in the comparative experiment;
Fig. 11 is a chart illustrating inception scores in the comparative experiment;
Fig. 12A is a chart illustrating losses in the comparative experiment;
Fig. 12B is a chart illustrating losses in the comparative experiment; and
Fig. 13 is a chart illustrating inception scores in the comparative experiment.
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, in an explanatory text, a bar denoted at an upper portion of a variable or a function in a mathematical expression is represented as "/", and a hat is represented as "^" and a tilde is represented as "∼
" the same as the above. For example, x is represented as "x/", "x^", and "x∼
" respectively when denoted by the above ones. Further, "T
" represents each transposition of a vector or a matrix when written with respect to the vector or the matrix on the right side thereof.
(Generative adversarial networks)
First, generative adversarial networks (hereinafter, mentioned as GAN.) which become a base of this embodiment are briefly explained. The GAN includes a generator and a discriminator, and is a kind of a training method of a generative model which cocurrently learns the generator and the discriminator.
The generator (data generator) performs the learning of training data (correct answer data) being target data to generate similar data (false data) to the training data. This generator is learned as a model which outputs the false data when noise data is inputted. The discriminator (data discriminator) discriminates between the false data generated by the generator and the correct answer data. That is, the generator is learned so that a distribution of the target data (a distribution of the training data) and a distribution of the generated model coincide with each other, and on the other hand, the discriminator is learned so as to discriminate between the correct answer data and the false data.
In this learning, two of a generator network and a discriminator network are present. As the network, for example, a multi-layer perceptron (MLP), a convolutional neural network (CNN), or the like is used.
For example, a network of the discriminator by using the MLP represented by the following expression is explained. Note that, also in the CNN, for example, the following expression can also be used regarding each weight matrix in convolution layers, and normalization of a weight matrix according to this embodiment can be similarly applied.
A vector hl
indicates an output of an l-th layer, a matrix Wl
indicates a weighting matrix between an (l - 1)-th layer and the l-th layer, a vector bl
indicates a bias in the l-th layer, and al
indicates a nonlinear activation function for each element. Here, when dim(l) is set to represent a dimension of l, and R is set to represent a real number field, Wl
∈ Rdim(l) × dim(l-1)
, and h0
(x) = x are obtained. By construing the above-described expressions as a series of configurations, an output of a final layer of a network having an input vector x becomes hL
. In the following explanation, for simplicity, mention is made as f(x) = hL
By such a definition, A is set as the activation function corresponding to divergence of distance measurement which a user has selected, and an output of the discriminator is given as D(x) = A(f(x). A standard format of the GAN is represented as in the following expression.
Here, G is set as an output of the generator. A maximum value and a minimum value of G and D are each handed over to a set of the generator and the discriminator. A general expression of V(G, D) is given as follows.
Here, E[•] represents an expected value, q is a distribution of the target data, pG
is a distribution in the generator of the model to be learned via adversarial minimum maximum optimization, and x' is the false data generated by the generator. The activation function A to be used in D of this format is, for example, a continuous function in a range of [0,1] such as a sigmoid function. With respect to the fixed generator G, the optimum discriminator of this format of V(G, V) is known to be given by DG
* = q(x)/(q(x) + pG
A function space in which the discriminator has been selected is considered to decisively affect performance of the GAN. In many studies, for the purpose of ensuring boundedness of statistics, importance of Lipschitz continuity is indicated. In consideration of the above, for example, the optimum discriminator of the GAN is represented as follows.
This differential is represented as follows, and this can be unbound or incomputable.
Thus, in this array, there is a method of controlling a Lipschitz constant of the discriminator by adding a defined normalization term to an input sample x. As in the following expression, a discriminator D is searched from a set of a Lipschitz continuous function.
≤ K means ∥f(x) - f(x')∥/∥x - x'∥ ≤ K with respect to any x and x'. However, a norm (∥•∥) represents an L2
For example, when the activation function al
is set as ReLU (Rectified Linear Unit) and leakyReLU, ∥al
= 1 is obtained. In a case where each activation function al
= 1, an inequality ∥g1∗
is obtained, which makes it possible to constrain ∥f∥Lip
from above as follows. However, in the above-described inequality, g1∗
means a composite function of g1
Here, σ(W) is a spectral norm being an L2
norm of a matrix W, and is represented as the one equal to a maximum singular value of W as follows.
The spectral normalization can normalize a spectral norm of a weight matrix W and set a Lipschitz constant to be 1, as follows.
When each Wl
is normalized by using [eq. 9], ∥f∥Lip
is constrained from above by 1, to therefore establish the inequality of [eq. 7], which allows σ(W/SN
(W)) = 1.
A gradient of W/SN
(W) with respect to Wij
is represented as follows.
represents a matrix in which a (i, j) element is 1 and the other elements are "0" (zero), u1
is a first left singular vector of W, and v1
is a first right singular vector of W. The first left singular vector and the first right singular vector indicate, in a case of performing a singular value decomposition on W, in a singular value matrix obtained by sorting singular value components in descending order from the upper left toward the lower right, a left singular vector and a right singular vector each corresponding to a singular value being the upper left component (a first singular value).
If h is a hidden node to be converted by the weight matrix W in the network, a derivative of V(G, V) calculated on a mini batch regarding W of the discriminator D is given as follows.
Here, E^[•] represents an empirical expected value in the mini batch, and is δ = (∂V(G, V)/∂(W/SN
and λ = E^[∂T
In the lower equation of [eq. 11], E^[δhT
] of a first term is equal to a derivative of a non-normalized weight. From this viewpoint, a second term can be regarded as a normalization term which penalizes the first singular value component by using a compensation normalization factor λ. As long as δ and W/SN
h indicate the same direction, λ becomes a positive value, which prevents a column of W from concentrating at one direction during the training. In other words, the spectral normalization prevents a conversion in each layer from becoming sensitive in one direction.
By utilizing this effect of the normalization, various versions of algorithms can be studied. It is also possible to consider different parameterization of the weight matrix of the discriminator given as follows.
Here, γ is a scalar variable to be learned. This parameterization includes a 1-Lipschitz constraint in a target layer, but prevents the model from degenerating, and allows flexibility to be imparted to the model. In order to perform this reparameterization, a Lipschitz condition is controlled by another means such as a gradient penalty.
As described above, the spectral norm σ(W) normalized in each layer of the network of the discriminator becomes the maximum singular value of W. In each round of the algorithm in this manner, simple application of the singular value decomposition causes a huge cost of calculation. Thus, a power iteration method may be used for evaluating σ(W).
This method is started from vectors u∼
initiated by a random number. If a dominant singular value does not become multiple, and u∼
are not orthogonal to the first singular vector, u∼
converge on the first left singular vector u and the first right singular vector v respectively based on the following update rule.
Moreover, as follows, the spectral norm of W can be approximated by a pair of approximate singular vectors as described above.
If a stochastic gradient descent (SDG) is used for an update, a change in W in each update is small, and accordingly, the maximum singular value is changed. In implementation, by utilizing this fact, u∼
calculated in each step of the algorithm is reused as an initial vector in the next step. By this recycle procedure, one or more-round power iterations are performed.
Hereinafter, a method of the GAN based on the spectral normalization according to this embodiment is explained based on a flowchart. Fig. 1 is a flowchart illustrating a flow of processing of this embodiment.
Note that, in the following explanation, an explanation regarding generator generation is omitted, but a method of the generator generation is not particularly limited. In this embodiment, generation of the discriminator is explained. Further, regarding processing similar to generation of a typical neural network model, for example, detailed explanations and the like of setting of hyperparameters, forward propagation, backward propagation, and the like are sometimes omitted. The learning of the discriminator may be performed by using the mini batch as described above, or as another example, performing the learning by batch learning or online learning also makes it possible to perform the processing similarly to the following.
First, neural network models of the generator and the discriminator are set (S100). The set models are each, for example, a neural network model such as the MLP or the CNN as described above.
Next, regarding the weight matrix Wl
connecting the layers of the discriminator, initialization of a left singular vector u∼l
) is performed (S102). The initialization is performed by using a random number based on an isotropic normal distribution, for example.
After ending the initialization of the models and the variables, a transition to the learning of the generator and the discriminator is made. As described above, the optimization of the generator and the discriminator is executed cocurrently, or alternately in the steps by evaluating the respective output results based on the expression of [eq. 3] or the like.
Explanations from S104 to S110 in the following describe that processing with respect to the weight matrix W for each layer is performed. For example, there is explained processing of the weight matrix Wl
connecting the I - 1-th layer and the l-th layer.
In the backward propagation, for the update of the weight matrix, the spectral normalization is used. For that reason, in back-propagation processing, first, the respective right and left singular vectors are updated (S104). The update of the first singular vector is executed based on the below-indicated expressions, for example.
indicates the left singular vector of the weight matrix Wl
, indicates the right singular vector of the weight matrix Wl
respectively. That is, by using the left singular vector u∼l
initiated by the random number and the weight matrix Wl
, the right singular vector v∼l
is updated. By using the updated right singular vector v∼l
and the weight matrix Wl
, the left singular vector u∼l
is updated. By performing a convergence operation in which alternate updates are performed based on the power iteration method in this manner, the first right singular vector and the first left singular vector are calculated. This step may be optionally repeated predetermined several times.
Next, based on the updated left singular vector u∼
and right singular vector v∼
, the weight matrix is normalized (S106). This normalization is executed by the above-described spectral normalization based on a spectral norm of Wl
. By using the spectral norm σ(Wl
) of Wl
, for example, there is calculated a weight matrix W/SNl
spectral normalized by the below-indicated mathematical formula.
Next, based on the spectral normalized weight matrix W/SNl
, an error is calculated (S108). The correct answer data being the training data and the false data being an output result of the generator are inputted to the discriminator and propagated forward. In an output layer, for example, in the result outputted from the discriminator, based on labels in which the output result of the generator is false and the output result of the correct answer data is true, the error in the output layer is calculated.
As a more specific example, this step (S108) includes the next three steps. First, a first inference result of whether or not to determine that the correct answer data is correct answer data is acquired. Next, a second inference result of whether or not to determine that the false data is not correct answer data is acquired. Then, by such a loss function as represented by [eq. 3], based on these first inference result and second inference result, the error is calculated. By propagating this error backward, as explained below, the weight matrix is updated.
Next, based on the calculated error, the weight matrix Wl
is updated (S110). For example, based on the following expression, the weight matrix Wl
) indicates the spectral normalized weight matrix, and DM
indicates a value based on a predetermined dataset. For example, when mini batch processing is performed, DM
indicates the update of the weight matrix Wl
based on a dataset in a mini batch. Further, I indicates the loss function, and is the function based on [eq. 3] or the like, for example, the function represented by the later-described [eq. 18], the later-described [eq. 21] depending on the algorithm, or the like. These expressions calculate an overall error (loss) based on an error between the first inference result when the correct answer data is inputted to the data discriminator and a true value (a first partial error) and an error between the second inference result when the false data is inputted to the data discriminator and a false value (a second partial error). For example, a first term of [eq. 3] indicates the error between the first inference result and the true value, and a second term thereof indicates the error between the second inference result and the false value, and the loss is calculated by finding the sum of these. The update indicated by [eq. 17] is based on an update by a typical SGD excluding use of the spectral normalized weight matrix W/SNl
. When the learning is performed by mini batch learning or the like, the weight matrix may be further updated based on an output from each mini batch. The update of the weight matrix based on the output from each mini batch is performed by a general method.
Next, whether or not to end the optimization is judged (S112). The end of the optimization is judged based on, for example, updating weight matrices in all layers, ending a predetermined number of epochs, an evaluation function satisfying a predetermined condition, the loss function satisfying a predetermined condition, and the like. When the learning such as the batch learning or the mini batch learning is performed, whether or not to end the learning with respect to required data may be judged.
For example, when the weight matrices are not updated in all the layers, the update of the weight matrix in the previous layer is continued by propagating the calculated error backward. In a case after updating the weight matrices in all the layers with respect to all mini batches in an epoch, whether or not the number of epochs reaches the predetermined number of times is judged, and the training is ended or continued. In S112 in Fig. 1, end conditions at different levels are collectively mentioned, but as a matter of course, the end conditions of the optimization may be set in more details, and the flowchart can be construed as a nested loop.
When the optimization is not ended (S112: No), the processing from S104 to S110 is repeated. As described above, for example, when the weight matrices are not updated in all the layers, by propagating a loss backward to the layer previous to the layer in which the weight matrix has been updated in S110, the update processing of the weight matrix in the previous layer is performed. When the predetermined number of epochs is not ended, the processing is performed until the predetermined number of times is obtained. When the evaluation function, the loss function, or the like does not satisfy the predetermined condition, the processing is performed until satisfying the predetermined condition. In the batch learning, the mini batch learning, or the like, the processing is performed until ending the learning with respect to required data, and thereafter, the processing is repeated until satisfying the above-described number of epochs and the conditions of the evaluation function and the loss function. Note that, in the above-described processing, in particular, as an initial value of the left singular vector, a vector optimized by the power iteration method in the previous step may be used.
When the optimization is ended (S112: Yes), a learned model is outputted (S114), to end the processing.
Fig. 2 is a block diagram illustrating a function of a data discriminator generating apparatus according to this embodiment. A data discriminator generating apparatus 1 includes a data discriminator initializer 10, a data discriminator storage 12, an input accepter 14, a forward propagator 16, an error calculator 18, and a backward propagation block 20.
The data discriminator initializer 10 initializes the model of the discriminator (data discriminator) in the GAN. For example, selection of the neural network model to be used as the model, the number of hidden layers, the weight matrix connecting the layers, and the like are initialized. The selection of the neural network model and the number of hidden layers may accept designation by a user. The initialization of the weight matrix may accept the designation by the user, or may be automatically generated by the random number or the like. By the data discriminator initializer 10, the above-described processing in S100 is performed. Further, together with the generation of the model, the initialization of the left singular vector of the weight matrix between the layers illustrated in S102 may be performed.
Note that the data discriminator initializer 10 is not an essential configuration for the data discriminator generating apparatus 1. For example, the user inputs the model generated in advance in the data discriminator storage 12, thereby allowing the model of the discriminator to be stored. As another example, the model generated by automatic processing in the outside of the data discriminator generating apparatus 1 may be inputted to the data discriminator storage 12, to be stored as the model of the discriminator.
The data discriminator storage 12 stores the model initialized by the data discriminator initializer 10, the model obtained by optimizing the above model, and the like. In the middle of learning, the model in which the weight matrix or the like has been updated may be stored. The forward propagator 16 and the backward propagation block 20 perform the forward propagation and the backward propagation by using the model stored in this data discriminator storage 12, to update the above model.
The input accepter 14 inputs the false data being data generated by the generator (data generator) and being similar to the correct answer data (training data) and the correct answer data to the forward propagator 16. The discriminator is optimized so as to discriminate between the false data generated by the generator and the correct answer data.
The forward propagator 16 inputs the above-described false data or correct answer data to the data discriminator stored in the data discriminator storage 12, to perform the forward propagation.
The forward propagator 16 inputs the data to an input layer of the data discriminator, and acquires a discrimination result from the output layer. As the data discriminator, the model stored in the data discriminator storage 12 is used.
The error calculator 18 compares the output when the false data is inputted to the data discriminator and the output when the correct answer data is inputted to the data discriminator, to calculate an error. For the calculation of the error, for example, the mathematical expression represented by [eq. 3] is used. This error calculator 18 performs the processing of S104. The error calculated by the error calculator 18 is inputted to the backward propagation block 20, and the back-propagation processing is executed. Further, the error calculator 18 calculates the error during the back propagation. By using the calculated error, the backward propagation block 20 performs the backward propagation of the error and the update of the weight matrix.
The backward propagation block 20 updates the model of the data discriminator stored in the data discriminator storage 12 by the back propagation. For example, the weight matrix (parameter) in the model is updated. The backward propagation block 20 includes a backward propagator 200 and an updater 202.
The backward propagator 200 performs the back-propagation processing based on the model of the data discriminator stored in the data discriminator storage 12 and the error calculated by the error calculator 18.
The updater 202 particularly performs the processing to update the weight matrix in backward propagation processing. For example, this updater 202 performs the processing from S104 to S110. As illustrated in the flowchart, at timing of propagating backward, by the update of the singular vectors in S106 and the processing of the normalization of the weight matrix in S108, the update of the weight matrix is performed.
In a case of a model having L-layer hidden layers, first, the backward propagator 200 propagates the error backward from the output layer to an L-th layer, and the updater 202 updates the weight matrix in the L-th layer. In a case of the mini batch learning, the weight matrix in the L-th layer is updated in a mini batch. Next, the error is propagated backward from the L-th layer to an L - 1-th layer, to update the weight matrix in a similar manner. Thus, by successively propagating the error backward, the weight matrix in each layer is updated. In the case of the mini batch learning, after ending the updates of the weight matrices of the hidden layers, and ending learning steps in the mini batch, for example, learning steps based on the evaluation values and the like as described above, the next mini batch is generated, to update the weight matrices in the same manner. The processing of the mini batch is performed by a general method.
In the above description, although an example of applying the spectral normalization to basic GAN has been explained, it is possible to apply the spectral normalization to not only the GAN but also algorithms of other GAN such as Wesserstein GAN (WGAN), Wesserstein GAN with Gradient Penalty (WGAN-GP), Deep Convolutional GAN (DCGAN), and Deep Regret Analytic GAN (DRAGAN).
The stability of the learning of the GAN including the data discriminator generating apparatus 1 according to this embodiment is explained while citing an example of image generation by the generator generated by the GAN. In the following example, both the generator and the discriminator each perform the learning of a model based on the CNN.
In the following explanation, as the SGD in the back propagation, adaptive moment estimation (Adam) was used to perform simulations. Note that a SGD method other than the Adam or other methods such as Momentum, AdaGrad, RMSProp, and AdaDelta may be used. As the loss function to be used for the update of the discriminator in this embodiment, the following expression was used.
Further, as a cost function to be used for the update of the generator, the below-indicated expression was used.
As evaluation of pieces of false data generated by generators in this embodiment and comparative examples, an inception score defined as follows was used.
[•] represents a KL divergence (Kullback-Leibler Divergence). Further, p(y) can be calculated as a marginal probability by (1/N)∑n = 1N
Fig. 3 cites parameter examples of the simulations. Set terms indicate the respective parameter names. α, β1
, and β2
are each a hyperparameter in the Adam. α indicates a learning rate, β1
indicates a primary momentum, and β2
indicates a secondary momentum, respectively. ndis
indicates the number of times at each of which the discriminator is updated for each one-time update of the generator. A combination of these parameters is indicated as one example for describing simulation results, and is not an important point but a point allowing arbitrary changes in the GAN method of using the spectral normalization according to this embodiment.
The set A is a parameter indicated by a thesis of the WGAN-GP method (I. Gulrajani, et.al, "Improved training of Wasserstein gans." arXiv preprint, arXiv: 1704.00028, 2017
). The set B is a parameter indicated by a thesis (D. Warde-Farley, et.al, "Improving generative adversarial networks with denoising feature matching," ICLR, Nov. 6, 2016). The set C is a parameter indicated by a thesis of a DCGAN (Deep Convolutional GAN) method (A. Radford, et.al, "Unsupervised representation learning with deep convolutional generative adversarial networks," arXiv preprint, arXiv: 1611.06624, 2016
The set A to the set C are examples each cited for comparison with the result reported already as the thesis. On the other hand, the set D to the set F are parameter sets each set for evaluating improvement in algorithm in a situation in which active learning is further performed. In each of these sets, 100,000-time updata of the generator was learned.
Fig. 4A, in which images of a dataset CIFAR-10 are used, and Fig. 4B, in which images of a dataset STL-10 are used, are graphs illustrating results of performing the simulations in the respective settings illustrated in Fig. 3. A vertical axis indicates the above-described inception score.
Based on these charts, it can be read that the SN is robuster than Comparative example 1 and Comparative example 2 with respect to active learning rate and momentum parameters. Comparative example 2 fails in obtaining good output results by the GAN with respect to a high learning rate and a high momentum parameter. Comparative example 1 can ensure less effectiveness of optimization than that of the SN and Comparative example 2 in the STL-10 configured by more various examples than those of the CIFAR-10. The SN is more excellent than other methods in both the other CIFAR-10 and STL-10.
Fig. 5A, in which the images of the dataset CIFAR-10 are used, and Fig. 5B, in which the images of the dataset STL-10 are used, are tables illustrating results of the inception scores obtained by using the SN, Comparative example 1, Comparative example 2, and other methods. Real data indicates the inception score acquired by using data in each of the datasets.
As illustrated in Fig. 5A, it is found that the SN scores a better inception score except the Warde-Farley (a method of the thesis described in the set B in Fig. 3). In the STL-10 configured by the images having more variety than that of the CIFAR-10, the SN has a better inception score than any other method.
Fig. 6 illustrates images generated by the generators learned by using an image of the dataset CIFAR-10, and Fig. 7 illustrates images generated by the generators learned by using an image of STL-10.
A 48 × 48-pixel image depicted in the upper portion in each of Fig. 6 and Fig. 7 and divided into 8 × 8 blocks is an image provided for the learning as the dataset. Images depicted in the lower portion in each of Fig. 6 and Fig. 7 are images generated by the generators learned by the GAN using the SN, Comparative example 1, and Comparative example 2 in order from above. Thus, when the generated images are seen, the images generated by the generator by the SN are seen as relatively good results.
In particular, in a case of citing the learning rate, good results are outputted in contrast with those in Comparative example 1 and Comparative example 2. In the set D to the set F, in Comparative example 1, for example, the images each having a low contrast overall such that the whole image is almost the same color are outputted, and in Comparative example 2, most of the outputted data is noise data. On the other hand, based on the SN according to this embodiment, data having a relatively high contrast is generated.
Fig. 8 is a chart illustrating theoretical values indicating a region where square values of singular values of weight matrices in the SN and Comparative example 1 are present. In Fig. 8 and Fig. 9, the singular values of the weight matrices are lined in ascending order, and the index is set as a horizontal axis and the one obtained by normalizing the square value of each of the singular values by using a maximum singular value is set as a vertical axis. A graph in Fig. 8 illustrates a distribution of the theoretical values likely to be taken in various situations with respect to the weight matrices. Solid lines indicate the theoretical values in the SN, and broken lines indicate the theoretical values in Comparative example 1. As illustrated in this Fig. 8, in the SN, a width in which the singular values are present is found to be wider than that in Comparative example 1.
In Comparative example 1, due to an asymmetric distribution of the singular values, column space of the weight matrix becomes low-dimensional vector space. On the other hand, in the SN, the number of dimensions of features to be used by the discriminator can be utilized without compromise. In order to keep the norm of the output of the hidden layer which has been multiplied by the weight matrix as much as possible, and make accuracy of the discriminator higher, it is desired to make this (normalized) norm large.
For example, in Comparative example 1, in order to make the norm large, a rank is lowered, but lowering the rank results in a reduction in the number of feature amounts being a judgment material in the discriminator. In more details, the judgment based on each feature amount depends on a size of the norm of the singular value. That is, as in Comparative example 1, when only a part of the singular values take a large value, and the other singular values become about "0" (zero), the emphasis is on the feature amount having a large norm of the singular value, which reduces an effect which the feature amount having a small norm of the singular value has on the judgment. However, in order to learn the discriminator having higher accuracy, to reduce the number of feature amounts is not a good idea. In Comparative example 1 as described above, in order to learn the discriminator having higher accuracy, it is difficult to achieve both to make the norm large (many norms can be acquired) and to prevent the number of feature amounts from being reduced.
As illustrated in Fig. 8, the SN can keep the normalized norm larger than that in Comparative example 1. That is, the SN can achieve both to keep the norm large and to prevent the number of feature amounts from being reduced. This is based on a Lipschitz constant in a linear operation being evaluated only by a maximum singular value. That is, the spectral norm is based on being independent of the rank of the matrix.
Each of Fig. 9A and Fig. 9B is graphs illustrating the square values of singular values of weight matrices in the respective layers when the learning is performed by using the SN and Comparative example 1 being different methods. In Fig. 9A, the dataset of CIFAR-10 is used, and in Fig. 9B, the dataset of STL-10 is used. Similarly to Fig. 8, solid lines indicate results obtained by the SN, and broken lines indicate results obtained by Comparative example 1.
As illustrated in Fig. 9A and Fig. 9B, according to the SN, it is found that the norms of the singular values are larger in almost all ranges than those in Comparative example 1. Thus, it becomes possible to make the norm of the singular value large and prevent the rank from being lowered, and when the normalization is performed, rank stability can be ensured.
In a first layer to a fifth layer, in Comparative example 1, there are concentrations at some values. That is, in Comparative example 1, the ranks of the weight matrices in these layers are short. On the other hand, in the SN, there is a wide distribution. In a case of targeting discrimination of a pair of probability distributions of various powers of low-dimensional nonlinear data embedded in high-dimensional space, there is a probability that the shortage of the rank in a lower layer is particularly fatal. An output of the lower layer is an output via a set having a small number of linear transformations, and most of the output exhibits a deflection to a space being linear. The undervaluation of many features of an input distribution in such a space causes an excessively simplified discriminator to be generated.
According to simulation results illustrated in Fig. 7, an effect which the excessively simplified discriminator has as described above can be actually confirmed. The images generated by using the spectral normalization have more variety, and are more complicated images than the images obtained by Comparative example 1.
Fig. 10A and Fig. 10B are charts each illustrating operation times in a case of updating the generator 100 times. A vertical axis indicates the operation time [second] in a case of updating the generators in the various methods 100 times. Fig. 10A illustrates results obtained by using the dataset CIFAR-10, and Fig. 10B illustrates results obtained by using the dataset STL-10. In Comparative example 2, as an error function, ∥∇ × D∥2
being the gradient penalty (GP) is required to be additionally found, which requires longer time than the other methods.
These charts illustrate that the SN can perform the operation in a time almost equal to that in Comparative example 1. This is because a relative calculation cost required for the power iteration method is negligibly smaller than costs of the forward propagation and the backward propagation.
As described above, based on the SN method according to this embodiment, in the update of the weight matrix of each layer in the GAN, by using the spectral normalized weight matrix, it becomes possible to achieve stable learning of the discriminator. As read from the results, more variety than that in the comparative examples allows the generation of the complicated images. Moreover, regarding the processing time, it does not take as long time as that in Comparative example 1, and for example, the case of using the dataset of STL-10, or the like allows processing in an almost equal time.
In the above-described embodiment, the example of applying the spectral normalization to the method of the GAN has been described, but this is not restrictive. That is, the spectral normalization may be applied to the method of the WGAN-GP (Comparative example 2). Hereinafter, the one applying the SN to Comparative example 2 is represented as Comparative example 2 + SN, or the like. In this case, as the error function, the following expression is used.
Simulation results are as illustrated in Fig. 11. Fig. 11 is a table illustrating inception scores regarding Comparative example 2 + SN. The application of the SN regarding a standard CNN and the application of the SN regarding the CNN using a residual network (ResNet) are illustrated. As comparisons, results of Comparative example 2 + Comparative example 1 and Comparative example 2 are also illustrated. In the simulation, all functions represented by [eq. 12] in the learning of the discriminator were normalized by the methods of the SN and Comparative example 1. Based on Fig. 11, the inception score is improved more than those in Comparative example 2 and Comparative example 2 + Comparative example 1.
Fig. 12A is a chart illustrating losses as evaluation, and Fig. 12B is a chart illustrating losses of validation. Solid lines indicate results obtained by Comparative example 2 + SN, broken lines indicate results obtained by Comparative example 2 + Comparative example 1, and dotted lines indicate results obtained by Comparative example 2. These charts each illustrate that the learning performed by Comparative example 2 + SN is less overtraining than the learning performed by Comparative example 2 and Comparative example 2 + Comparative example 1. Fig. 12B particularly illustrates that the learning performed by Comparative example 2 + SN is less overtraining than the learning performed by the other methods because an evaluation value thereof does not fall also with respect to validation data.
Fig. 13 is a chart illustrating inception scores in the same simulation situation. A solid line indicates a result obtained by Comparative example 2 + SN, a broken line indicates a result obtained by Comparative example 2 + Comparative example 1, and a dotted line indicates a result obtained by Comparative example 2. This Fig. 13 also illustrates the respective cases of degrees of overtraining. Not final results but even the optimum ones sampled during the learning indicate that the method according to Comparative example 2 + SN (7.28) has the inception score better than those in the other methods (7.04, 6.69).
As described above, in not only the standard GAN but also the method of WGAN-GP, the spectral normalization according to this embodiment can provide more stable learning of the discriminator.
Note that, in the above-described example, there is described the training as the data discriminator which discriminates data based on training data provided with a label of whether or not to be correct answer data, but this is not restrictive. Without being limited to the GAN, for example, by using training data labeled with a category, the above-described weight matrix is updated, thereby also allowing training as a classifier. Moreover, other than these, a neural network model which performs training by updating a typical weight matrix makes it possible to apply a training method using the above-described spectral normalization to the update of the weight matrix. Performing the normalization represented by [eq. 9] makes it possible to perform the normalization of these weighting matrices and update the weighting matrices. Furthermore, by using training data labeled with a plurality of labels, such training as can output continuous values or discrete values with respect to an input may be performed.
In the above-described entire description, at least a part of the data discriminator generating apparatus 1 may be configured by hardware, or may be configured by software and a CPU and the like may perform the operation based on information processing of the software. When it is configured by the software, a program which achieves the data discriminator generating apparatus 1 and at least a partial function thereof may be stored in a storage medium such as a flexible disk or a CD-ROM, and executed by making a computer read it. The storage medium is not limited to a detachable one such as a magnetic disk or an optical disk, but it may be a fixed-type storage medium such as a hard disk device or a memory. That is, the information processing by the software may be concretely implemented by using a hardware resource. Furthermore, the processing by the software may be implemented by the circuit of a FPGA (Field-Programmable Gate Array) or the like and executed by the hardware. Processing of construction of a virtual environment, or the like may be performed by using, for example, an accelerator such as a GPU (Graphical Processing Unit).
The data discriminator generating apparatus 1 and the data discriminator generated by the apparatus may be configured by an analog circuit or a digital circuit other than generated by the program as described above. In this case, a control circuit which controls a part of or the entire function may be included. That is, the data discriminator generating apparatus 1 and the data discriminator may include the control circuit and a memory, and a part of or the entire function may be controlled by the control circuit.
A person skilled in the art may come up with addition, effects or various kinds of modifications of the present invention based on the above-described entire description, but, examples of the present invention are not limited to the above-described individual embodiments. Various kinds of addition, changes and partial deletion can be made within a range that does not depart from the conceptual idea and the gist of the present invention derived from the contents stipulated in claims and equivalents thereof.
[Explanation of numerical reference]
1: data discriminator generating apparatus, 10: data discriminator initializer, 12: data discriminator storage, 14: input accepter, 16: forward propagator, 18: error calculator, 20: backward propagation block, 200: backward propagator, 202: updater