WO2021174935A1 - 对抗生成神经网络的训练方法及系统 - Google Patents
对抗生成神经网络的训练方法及系统 Download PDFInfo
- Publication number
- WO2021174935A1 WO2021174935A1 PCT/CN2020/134889 CN2020134889W WO2021174935A1 WO 2021174935 A1 WO2021174935 A1 WO 2021174935A1 CN 2020134889 W CN2020134889 W CN 2020134889W WO 2021174935 A1 WO2021174935 A1 WO 2021174935A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- neural network
- initial
- discriminant
- generation
- discrimination
- Prior art date
Links
Images
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/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- 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
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02T—CLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
- Y02T10/00—Road transport of goods or passengers
- Y02T10/10—Internal combustion engine [ICE] based vehicles
- Y02T10/40—Engine management systems
Definitions
- the embodiments of the present application relate to the field of computer technology, and in particular, to a training method, system, computer device, and storage medium of a confrontation generation neural network.
- Heriot-Watt University Heriot-Watt University
- Google Deepmind Google Deepmind company's large-scale adversarial generative network training case shows that the folding loss function (Hinge Loss) as the objective function can improve the stability of the adversarial generative network .
- the current training method is very sensitive to changes in the Hinge Loss boundary. The training is stable when the boundary is small, but the generated effect is biased; when the boundary is large, the training is likely to cause the discriminator gradient to disappear or collapse, but the effect is better.
- the current method of making the discriminator output a one-dimensional scalar and then using it to calculate the target loss relies on a fixed boundary of a single dimension, which will bring about the limitations of the model representation ability , And once the dimension collapses, the entire network will not be able to recover, so training is still very difficult.
- the embodiments of the present application aim to solve the problems of poor stability and low efficiency of the confrontation generation neural network.
- the embodiments of the present application provide a training method, system, computer device, and computer-readable storage medium for a confrontation generation neural network, which can map the output of the confrontation generation neural network to a high-dimensional output, so that the confrontation generation neural network It can be trained in different dimensions and boundaries, so as to obtain a larger convergence gradient, and improve the training speed and stability of the confrontational generative neural network.
- a training method for confronting generative neural networks including:
- the parameters of the initial confrontation generation neural network include the The discrimination parameters of the initial discrimination neural network and the generation parameters of the initial generation neural network;
- L D E[max(0,MD(x)]+E[max(0,M+D(G(z))]], the first discriminant output and the The second discriminant output is calculated to obtain the discriminative loss value
- LD represents the discriminant loss value
- E represents the mathematical expectation value
- max(0,MD(x)) represents the maximum function of 0 and MD(x)
- max( 0, M+D(G(z))) represents the maximum value function of 0 and M+D(G(z)
- M represents the boundary vector
- D(x) represents the first discriminant output
- D (G(z)) represents the second discrimination output
- the parameters of the initial confrontation generation neural network are updated according to the discrimination loss value and the generation loss value to obtain a target confrontation generation neural network.
- an embodiment of the present application also provides a training system for confronting generative neural networks, including:
- the establishment module is used to establish an initial discriminant neural network and an initial generation neural network, and the initial discriminant neural network and the initial generation neural network form an initial confrontation generation neural network;
- the initialization module is used to initialize the parameters of the initial confrontation generation neural network and the boundary vector of the initial discrimination neural network, wherein the boundary vector is a multi-dimensional vector with a preset number of dimensions, and the initial confrontation generation neural network
- the parameters of include the discrimination parameters of the initial discrimination neural network and the generation parameters of the initial generation neural network;
- a generating module configured to obtain a set of real samples and a set of random variables, and input the set of random variables into the initial generating neural network to generate a set of fake samples;
- the output module is used to input the real sample set and the fake sample set to the initial discriminant neural network to obtain the first discriminant output corresponding to the real sample set and the first discriminant output corresponding to the fake sample set Two discriminant output;
- the maximum value function of max(0,M+D(G(z))) represents the maximum value function of 0 and M+D(G(z)), M represents the boundary vector, and D(x) represents all
- the first discrimination output, D(G(z)) represents the second discrimination output;
- the update module is used to update the parameters of the initial confrontation generation neural network according to the discrimination loss value and the generation loss value to obtain the target confrontation generation neural network.
- an embodiment of the present application further provides a computer device.
- the computer device includes a memory, a processor, and a computer program stored on the memory and running on the processor, and the processor executes the
- the computer program implements the following methods:
- the parameters of the initial confrontation generation neural network include the The discrimination parameters of the initial discrimination neural network and the generation parameters of the initial generation neural network;
- L D E[max(0,MD(x)]+E[max(0,M+D(G(z))]], the first discriminant output and the The second discriminant output is calculated to obtain the discriminative loss value
- LD represents the discriminant loss value
- E represents the mathematical expectation value
- max(0,MD(x)) represents the maximum function of 0 and MD(x)
- max( 0, M+D(G(z))) represents the maximum value function of 0 and M+D(G(z)
- M represents the boundary vector
- D(x) represents the first discriminant output
- D (G(z)) represents the second discrimination output
- the parameters of the initial confrontation generation neural network are updated according to the discrimination loss value and the generation loss value to obtain a target confrontation generation neural network.
- embodiments of the present application further provide a computer-readable storage medium, in which a computer program is stored, and the computer program may be executed by at least one processor, so that the at least One processor executes the following methods:
- the parameters of the initial confrontation generation neural network include the The discrimination parameters of the initial discrimination neural network and the generation parameters of the initial generation neural network;
- L D E[max(0,MD(x)]+E[max(0,M+D(G(z))]], the first discriminant output and the The second discriminant output is calculated to obtain the discriminative loss value
- LD represents the discriminant loss value
- E represents the mathematical expectation value
- max(0,MD(x)) represents the maximum function of 0 and MD(x)
- max( 0, M+D(G(z))) represents the maximum value function of 0 and M+D(G(z)
- M represents the boundary vector
- D(x) represents the first discriminant output
- D (G(z)) represents the second discrimination output
- the parameters of the initial confrontation generation neural network are updated according to the discrimination loss value and the generation loss value to obtain a target confrontation generation neural network.
- This application maps the output of the confrontation generation neural network to high-dimensional output through multi-dimensional boundary vectors, so that the confrontation generation neural network can be trained in different dimensions and boundaries, so as to obtain a larger convergence gradient and improve the performance of the confrontation generation neural network. Training speed and stability.
- FIG. 1 is a flow chart of the steps of the training method of the confrontation generative neural network according to the first embodiment of the application;
- FIG. 2 is a schematic diagram of program modules of a training system for confronting generative neural network according to the second embodiment of the application;
- FIG. 3 is a schematic diagram of the hardware structure of the computer device according to the third embodiment of the application.
- the technical solution of the present application may be applied to the fields of artificial intelligence, blockchain and/or big data technology, and may specifically involve neural network technology.
- the data involved in this application such as real samples and/or various parameters, can be stored in a database, or can be stored in a blockchain, such as distributed storage through a blockchain, which is not limited in this application.
- FIG. 1 shows a flow chart of the training method of the confrontation generative neural network according to the first embodiment of the present application. It can be understood that the flowchart in this method embodiment is not used to limit the order of execution of the steps.
- the following is an exemplary description with computer equipment as the main body of execution, and the details are as follows:
- step S100 an initial discriminant neural network and an initial generation neural network are established, and the initial discriminant neural network and the initial generation neural network are combined to form an initial confrontation generation neural network.
- Generative Adversarial Net is a deep learning neural network. Its core idea is derived from the Nash equilibrium of game theory. It consists of a generative network G and a discriminant network D. Take the generated picture as an example, where the generation network G receives a random noise Z, and generates and outputs a fake photo G(Z) through this noise generation picture; it is judged whether the network receives the real photo X or the fake photo G( Z), and determine the authenticity of the photo. In the training process, the goal of generating network G is to generate as real pictures as possible to deceive and discriminate network D, so that the discriminant network cannot judge whether G(Z) is true or false.
- an initial confrontation generation neural network is first established, and the initial confrontation generation neural network is composed of an initial discrimination neural network D and an initial generation neural network G.
- the initial generation neural network is a deconvolutional neural network;
- the initial discrimination neural network is a standard convolutional neural network, and the initial discrimination neural network includes at least an input layer, a convolutional layer, a fully connected layer, and an output layer .
- an initial generation neural network is established on the basis of a deconvolutional neural network
- an initial discriminant neural network is established on the basis of a convolutional neural network
- the initial generation neural network and the initial discriminant neural network form one to generate a face
- the initial confrontation generation neural network of the picture wherein the initial discriminant neural network established by the convolutional network includes an input layer, a convolutional layer, a pooling layer, an activation layer, a fully connected layer, and an output layer.
- Step S102 initialize the parameters of the initial confrontation generation neural network and the boundary vector of the initial discrimination neural network, where the boundary vector is a multi-dimensional vector with a preset number of dimensions, and the parameters of the initial confrontation generation neural network It includes the discrimination parameters of the initial discrimination neural network and the generation parameters of the initial generation neural network.
- the parameters of the initial confrontation generation neural network and the boundary vector M of the initial discrimination neural network are initialized, and the boundary vector M is used as the initial discrimination neural network
- the parameters of the confrontation generation neural network refer to parameters such as the convolution kernel, stride, weight, and bias of the initial discrimination neural network and the initial generation neural network.
- the boundary vector when initializing the boundary vector of the initial discrimination neural network, the boundary vector may be generated according to the number of dimensions of the boundary vector and a preset mathematical distribution formula.
- the dimension of the boundary vector M should be large enough, for example, 512 Dimension to make the boundary of the anti-generating neural network more diversified and the sampled space more fitting;
- the preset mathematical distribution formula can be a uniform distribution U(0,3] or a truncated normal distribution with a value greater than 0
- the boundary vector M is generated, it is used as the output mapping parameter of the output layer of the initial discriminant neural network to perform multi-dimensional mapping on the output of the output layer.
- the boundary vector M use it as the output mapping parameter of the initial discriminant neural network, in order to map the output of the initial discriminant neural network to 10-dimensional vector.
- Step S104 Obtain a set of real samples and a set of random variables, and input the set of random variables into the initial generating neural network to generate a set of fake samples.
- the real sample set X is a series of real samples
- the random variable set Z is a set of random noise obtained through the standard normal distribution.
- the set of random variables Z is used to generate false samples
- the set of real samples is used to train the initial discriminant neural network
- the false samples and real samples are used to train the initial discriminant neural network to improve the Initially discriminate the ability of the neural network to distinguish true and false samples.
- the real sample data set X may be some real face photos
- the random variable set Z is a set of random vectors with values obtained through the standard normal distribution.
- the computer device inputs a set of random variables to the initial generation network, and after operations such as convolution, pooling, activation, and deconvolution, some fake face pictures G(Z) can be generated and output.
- Step S106 input the real sample set and the fake sample set to the initial discriminant neural network to obtain a first discriminant output corresponding to the real sample set and a second discriminant corresponding to the fake sample set Output.
- the real sample set X and the fake sample set G(Z) generated by the initial generation network are input to the input layer of the initial discriminant neural network D, and pass through the convolutional layer, the pooling layer, the activation layer, and the full connection After the processing of the layer, the discriminating probability of the real sample set and the false sample set is output in the output layer.
- the discrimination probability for the real sample set X is D(X)
- the discrimination probability for the fake sample set G(Z) is D(G(Z)).
- the real face image and the generated fake face image are input into the initial discriminant network, and after operations such as convolution, pooling, and activation, a certain weight is assigned in the fully connected layer, and then the output After the layers are mapped by the output mapping parameters, the corresponding discriminant probabilities D(X) and D(G(Z)) are respectively output.
- the real sample set and the fake sample set are input to the initial discriminant neural network to obtain a first discriminant output corresponding to the real sample set and corresponding to the fake sample set
- the second discriminant output step specifically includes: inputting the real sample set into the initial discriminant neural network, and mapping the first output corresponding to the real sample set to the The first multi-dimensional vector corresponding to the boundary vector to obtain the first discriminant output;
- the false sample set is input to the initial discriminant neural network, and the second output corresponding to the false sample set is mapped to the second multi-dimensional vector corresponding to the boundary vector according to the boundary vector to Obtain the second discriminant output.
- the discrimination probability is only a value between [0, 1] that represents the true or false probability of the picture, where 0 represents false and 1 represents true.
- the output is a multi-dimensional vector corresponding to the dimension of the boundary vector M.
- the real sample set X is input to the initial discriminant neural network, and after a series of operations and the multi-dimensional mapping of the boundary vector M, the corresponding multi-dimensional vector D(X) is output; the fake sample set is input to all In the initial discrimination neural network, after a series of operations and the multi-dimensional mapping of the boundary vector M, the corresponding multi-dimensional vector D(G(Z)) is output.
- the real face picture is input into the initial discrimination neural network
- the multidimensional vector output after mapping is D(X)
- the generated fake face picture is input into the initial discrimination neural network
- the multi-dimensional vector output after mapping is D(G(Z)).
- L D represents the discriminant loss value
- E represents the mathematical expectation value
- max(0,MD(x)) represents the maximum function of 0 and MD(x)
- Max(0,M+D(G(z))) represents the maximum value function of 0 and M+D(G(z)
- M represents the boundary vector
- the mathematical expectation value represented by E refers to the mean value obtained by calculating the average of each value in the expectation value function
- the maximum value function represented by max specifically refers to the value within the maximum value function. Find the maximum value.
- step S112 the parameters of the initial confrontation generation neural network are updated according to the discrimination loss value and the generation loss value to obtain a target confrontation generation neural network.
- the parameters of the output layer of the initial discriminant neural network are derivated to obtain the first derivation result, and the first derivation result is calculated according to the first derivation result.
- the parameters of the output layer are updated; then the first derivation result is backpropagated to the previous fully connected layer to update the parameters of the fully connected layer, and so on, until the parameters of the input layer are updated to obtain Neural network for target discrimination.
- the update of the initial generation neural network is updated according to the generation loss value by the method of derivation and back propagation to obtain the target generation neural network, and the target discrimination neural network and the target generation neural network are composed The target confronts the generative neural network.
- the weight of the output layer of the initial discriminant neural network is derivated to obtain the first derivation result, and the first derivation result is updated according to the first derivation result.
- the weight; then the first derivation result is backpropagated to the fully connected layer, and the weight of the fully connected layer is updated according to the first derivation result; finally the first derivation result is backpropagated to the convolutional layer to Update the convolution kernel of the convolution layer.
- all the parameters of the initial discriminant neural network are updated through derivation and back propagation.
- the discrimination loss value before updating the parameters of the initial confrontation generating neural network according to the discrimination loss value and the generation loss value, is also compared with a first preset threshold. , When the discrimination loss value is greater than the first preset threshold, the discrimination parameter is updated to obtain the target discrimination neural network; the generation loss value is compared with the second preset threshold, when the generation When the loss value is greater than the second preset threshold, the generation parameters are updated to obtain the target generation neural network.
- the embodiment of the present application maps the output of the confrontation generation neural network to high-dimensional output through multi-dimensional boundary vectors, so that the confrontation generation neural network can be trained in different dimensions and boundaries, thereby obtaining a larger convergence gradient, and improving the confrontation generation neural network.
- the training speed and stability of the network is a part of the network.
- FIG. 2 shows a schematic diagram of program modules of a training system for a confrontational generative neural network according to the second embodiment of the present application.
- the training system 20 for the confrontation generative neural network may include or be divided into one or more program modules, and the one or more program modules are stored in a storage medium and executed by one or more processors. , In order to complete this application and realize the training method of the above-mentioned confrontation generative neural network.
- the program module referred to in the embodiments of the present application refers to a series of computer program instruction segments capable of completing specific functions, and is more suitable than the program itself to describe the execution process of the training system 20 of the anti-generating neural network in the storage medium.
- the following description will specifically introduce the functions of each program module in this embodiment:
- GAN is a deep learning neural network. Its core idea is derived from the Nash equilibrium of game theory. It consists of a generative network G and a discriminant network D. Take the generated picture as an example, where the generation network G receives a random noise Z, and generates and outputs a fake photo G(Z) through this noise generation picture; it is judged whether the network receives the real photo X or the fake photo G( Z), and determine the authenticity of the photo. In the training process, the goal of generating network G is to generate as real pictures as possible to deceive and discriminate network D, so that the discriminant network cannot judge whether G(Z) is true or false.
- the establishment module 200 first establishes an initial confrontation generation neural network, and the initial confrontation generation neural network is composed of an initial discriminant neural network D and an initial generation neural network G.
- the initial generation neural network is a deconvolutional neural network
- the initial discrimination neural network is a standard convolutional neural network
- the initial discrimination neural network includes at least an input layer, a convolutional layer, a fully connected layer, and an output layer .
- an initial generation neural network is established on the basis of a deconvolutional neural network
- an initial discriminant neural network is established on the basis of a convolutional neural network
- the initial generation neural network and the initial discriminant neural network form one to generate a face
- the initial confrontation generation neural network of the picture wherein the initial discriminant neural network established by the convolutional network includes an input layer, a convolutional layer, a pooling layer, an activation layer, a fully connected layer, and an output layer.
- the initialization module 202 is used to initialize the parameters of the initial confrontation generation neural network and the boundary vector of the initial discrimination neural network, where the boundary vector is a multidimensional vector with a preset number of dimensions, and the initial confrontation generation neural network
- the parameters of the network include the discrimination parameters of the initial discrimination neural network and the generation parameters of the initial generation neural network.
- the initialization module 202 initializes the parameters of the initial confrontation generation neural network and the boundary vector M of the initial discrimination neural network, and sets the boundary
- the vector M is used as the output parameter of the output layer of the initial discriminant neural network, where the boundary vector M is a multi-dimensional vector for mapping the output of the initial discriminant neural network from a single dimension to the boundary vector M corresponds to multiple dimensions;
- the parameters of the initial confrontation generation neural network refer to the convolution kernel, stride, weight, and bias of the initial discrimination neural network and the initial generation neural network.
- the initialization module 202 when the initialization module 202 initializes the boundary vector of the initial discrimination neural network, it also selects values according to the number of dimensions of the boundary vector and a preset mathematical distribution formula to generate the boundary. vector.
- the boundary vector M use it as the output mapping parameter of the initial discriminant neural network, in order to map the output of the initial discriminant neural network to 10-dimensional vector.
- the generating module 204 is configured to obtain a set of real samples and a set of random variables, and input the set of random variables into the initial generating neural network to generate a set of fake samples.
- the real sample set X is a series of real samples
- the random variable set Z is a set of random noise obtained through the standard normal distribution.
- the set of random variables Z is used to generate false samples
- the set of real samples is used to train the initial discriminant neural network
- the false samples and real samples are used to train the initial discriminant neural network to improve the Initially discriminate the ability of the neural network to distinguish true and false samples.
- the real sample data set X may be some real face photos
- the random variable set Z is a set of random vectors with values obtained through the standard normal distribution.
- the computer device inputs a set of random variables to the initial generation network, and after operations such as convolution, pooling, activation, and deconvolution, some fake face pictures G(Z) can be generated and output.
- the output module 206 is configured to input the real sample set and the fake sample set to the initial discriminant neural network to obtain a first discriminant output corresponding to the real sample set and a first discriminant output corresponding to the fake sample set.
- the second discrimination output is configured to input the real sample set and the fake sample set to the initial discriminant neural network to obtain a first discriminant output corresponding to the real sample set and a first discriminant output corresponding to the fake sample set. The second discrimination output.
- the output module 206 inputs the real sample set X and the fake sample set G(Z) generated by the initial generation network to the input layer of the initial discriminant neural network D, and passes through the convolutional layer, the pooling layer, After the activation layer and the fully connected layer are processed, the output layer outputs the discrimination probability of the real sample set and the false sample set.
- the discrimination probability for the real sample set X is D(X)
- the discrimination probability for the fake sample set G(Z) is D(G(Z)).
- the output module 206 inputs the real face picture and the generated fake face picture into the initial discriminant network. After operations such as convolution, pooling, and activation, a certain value is assigned to the fully connected layer. Weight, and then output the corresponding discriminant probabilities D(X) and D(G(Z)) after the output mapping parameters are mapped in the output layer.
- the output module 206 inputs the real sample set and the fake sample set to the initial discriminant neural network to obtain the first discriminant output corresponding to the real sample set and the sum of the
- the step of the second discriminant output corresponding to the false sample set may further include: inputting the real sample set into the initial discriminant neural network, and according to the boundary vector, the first discriminant output corresponding to the real sample set The output is mapped to the first multi-dimensional vector corresponding to the boundary vector to obtain the first discriminant output; the false sample set is input into the initial discriminant neural network, and the boundary vector is compared with all The second output corresponding to the set of false samples is mapped to a second multi-dimensional vector corresponding to the boundary vector to obtain the second discriminant output.
- the output module 206 inputs a real face picture into the initial discriminant neural network, the multi-dimensional vector output after mapping is D(X), and the generated fake face picture is input into the In the initial discriminant neural network, the multidimensional vector output after mapping is D(G(Z)).
- the first discriminant output and the second discriminant output are calculated to obtain the discriminant loss value, where LD represents the discriminant loss value, E represents the mathematical expectation value, and max(0,MD(x)) represents the relation between 0 and MD(x). ), max(0,M+D(G(z))) represents the maximum value function of 0 and M+D(G(z)), M represents the boundary vector, and D(x) represents The first discrimination output, D(G(z)) represents the second discrimination output.
- the mathematical expectation value represented by E refers to the mean value obtained by calculating the average of each value in the expectation value function
- the maximum value function represented by max specifically refers to the value within the maximum value function. Find the maximum value.
- the update module 212 is configured to update the parameters of the initial confrontation generation neural network according to the discrimination loss value and the generation loss value to obtain a target confrontation generation neural network.
- the update module 212 performs partial derivative function derivation on the parameters of the output layer of the initial discriminant neural network according to the discriminant loss value of the discriminant loss function to obtain the first derivation result, and according to the first derivation result A derivation result updates the parameters of the output layer; then the first derivation result is backpropagated to the previous fully connected layer to update the parameters of the fully connected layer, and so on, until the input layer is updated The parameters to obtain the target discriminant neural network.
- the update of the initial generation neural network is updated according to the generation loss value by the method of derivation and back propagation to obtain the target generation neural network, and the target discrimination neural network and the target generation neural network are composed The target confronts the generative neural network.
- the weight of the output layer of the initial discriminant neural network is derivated to obtain the first derivation result, and the first derivation result is updated according to the first derivation result.
- the weight; then the first derivation result is backpropagated to the fully connected layer, and the weight of the fully connected layer is updated according to the first derivation result; finally the first derivation result is backpropagated to the convolutional layer to Update the convolution kernel of the convolution layer.
- all the parameters of the initial discriminant neural network are updated through derivation and back propagation.
- the update module 212 before the update module 212 updates the parameters of the initial confrontation generating neural network according to the discriminant loss value and the generation loss value, it also compares the discriminant loss value with the first prediction value. When the threshold is set, it is compared. When the discriminant loss value is greater than the first preset threshold, the discriminant parameter is updated to obtain the target discriminating neural network; the generated loss value is compared with the second preset threshold When the generation loss value is greater than the second preset threshold, the generation parameters are updated to obtain the target generation neural network.
- the embodiment of the present application maps the output of the confrontation generation neural network to high-dimensional output through multi-dimensional boundary vectors, so that the confrontation generation neural network can be trained in different dimensions and boundaries, thereby obtaining a larger convergence gradient, and improving the confrontation generation neural network.
- the training speed and stability of the network is a part of the network.
- the computer device 2 is a device that can automatically perform numerical calculation and/or information processing in accordance with pre-set or stored instructions.
- the computer device 2 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server or a server cluster composed of multiple servers).
- the computer device 2 at least includes, but is not limited to, a memory and a processor.
- a computer program can be stored in the memory and can be run on the processor. Some or all of the steps.
- the computer device may also include a network interface and/or a training system for counter-generating neural networks.
- the computer device includes a memory 21, a processor 22, a network interface 23, and a training system 20 for generating a neural network against generation.
- the memory 21, a processor 22, a network interface 23, and a training system for generating a neural network against each other can be connected to each other through a system bus.
- the memory 21 includes at least one type of computer-readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory ( RAM), static random access memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disks, optical disks, etc.
- the memory 21 may be an internal storage unit of the computer device 2, for example, the hard disk or memory of the computer device 2.
- the memory 21 may also be an external storage device of the computer device 2, such as a plug-in hard disk, a smart media card (SMC), and a secure digital (Secure Digital, SMC) equipped on the computer device 2. SD) card, flash card (Flash Card), etc.
- the memory 21 may also include both the internal storage unit of the computer device 2 and its external storage device.
- the memory 21 is generally used to store the operating system and various application software installed in the computer device 2, for example, the program code of the training system 20 for the confrontation generation neural network of the second embodiment and so on.
- the memory 21 can also be used to temporarily store various types of data that have been output or will be output.
- the processor 22 may be a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor, or other data processing chips.
- the processor 22 is generally used to control the overall operation of the computer device 2.
- the processor 22 is used to run the program code or process data stored in the memory 21, for example, to run the training system 20 of the confrontation generation neural network, so as to implement the training method of the confrontation generation neural network of the first embodiment.
- the network interface 23 may include a wireless network interface or a wired network interface, and the network interface 23 is generally used to establish a communication connection between the computer device 2 and other electronic devices.
- the network interface 23 is used to connect the computer device 2 with an external terminal through a network, and establish a data transmission channel and a communication connection between the computer device 2 and the external terminal.
- the network may be Intranet, Internet, Global System of Mobile Communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G Network, Bluetooth (Bluetooth), Wi-Fi and other wireless or wired networks.
- the processor may call a medium or program stored in the memory to implement the following methods:
- the parameters of the initial confrontation generation neural network include the The discrimination parameters of the initial discrimination neural network and the generation parameters of the initial generation neural network;
- L D E[max(0,MD(x)]+E[max(0,M+D(G(z))]], the first discriminant output and the The second discriminant output is calculated to obtain the discriminative loss value
- LD represents the discriminant loss value
- E represents the mathematical expectation value
- max(0,MD(x)) represents the maximum function of 0 and MD(x)
- max( 0, M+D(G(z))) represents the maximum value function of 0 and M+D(G(z)
- M represents the boundary vector
- D(x) represents the first discriminant output
- D (G(z)) represents the second discrimination output
- the parameters of the initial confrontation generation neural network are updated according to the discrimination loss value and the generation loss value to obtain a target confrontation generation neural network.
- the processor may also execute the medium or program to implement other steps of the method in the foregoing embodiment, which will not be repeated here.
- FIG. 3 only shows the computer device 2 with components 20-23, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.
- the training system 20 for the confrontation generation neural network stored in the memory 21 may also be divided into one or more program modules, and the one or more program modules are stored in the memory 21, and It is executed by one or more processors (the processor 22 in this embodiment) to complete the application.
- FIG. 2 shows a schematic diagram of the program modules of the training system 20 of the confrontation generation neural network.
- the training system 20 of the confrontation generation neural network can be divided into a building module 200, an initialization module 202, and a generation module.
- the program module referred to in the present application refers to a series of computer program instruction segments that can complete specific functions, and is more suitable than a program to describe the execution process of the training system 20 for the confrontation generation neural network in the computer device 2.
- the specific functions of the program modules 200-212 have been described in detail in the second embodiment, and will not be repeated here.
- This embodiment also provides a computer-readable storage medium, such as flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), only Readable memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disks, optical disks, servers, App application malls, etc., on which computer programs are stored, The corresponding function is realized when the program is executed by the processor.
- the computer-readable storage medium of this embodiment is used to store the training system 20 of the confrontation generation neural network, and when executed by the processor, realizes the training method of the confrontation generation neural network of the first embodiment.
- the computer program may be executed by at least one processor, so that the at least one processor executes the following method:
- the parameters of the initial confrontation generation neural network include the The discrimination parameters of the initial discrimination neural network and the generation parameters of the initial generation neural network;
- L D E[max(0,MD(x)]+E[max(0,M+D(G(z))]], the first discriminant output and the The second discriminant output is calculated to obtain the discriminative loss value
- LD represents the discriminant loss value
- E represents the mathematical expectation value
- max(0,MD(x)) represents the maximum function of 0 and MD(x)
- max( 0, M+D(G(z))) represents the maximum value function of 0 and M+D(G(z)
- M represents the boundary vector
- D(x) represents the first discriminant output
- D (G(z)) represents the second discrimination output
- the parameters of the initial confrontation generation neural network are updated according to the discrimination loss value and the generation loss value to obtain a target confrontation generation neural network.
- the storage medium involved in this application such as a computer-readable storage medium, may be non-volatile or volatile.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Life Sciences & Earth Sciences (AREA)
- Molecular Biology (AREA)
- Artificial Intelligence (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Image Analysis (AREA)
- Machine Translation (AREA)
Abstract
一种对抗生成神经网络的训练方法,包括步骤:建立初始判别神经网络和初始生成神经网络以组成初始对抗生成神经网络(S100);初始化初始对抗生成神经网络的参数和边界向量(S102);获取真实样本集合和随机变量集合,并将随机变量集合输入到初始生成神经网络中以生成假样本集合(S104);将真实样本集合和假样本集合输入到初始判别神经网络,以得到第一判别输出和第二判别输出(S106);根据预设的判别损失函数进行计算得到判别损失值(S108);根据预设的生成损失函数进行计算得到生成损失值(S110);根据判别损失值和生成损失值对初始对抗生成神经网络的参数进行更新以得到目标对抗生成神经网络(S112)。通过该方法,能够提高对抗生成神经网络的训练速度和稳定性。
Description
本申请要求于2020年3月3日提交中国专利局、申请号为202010138371.1,发明名称为“对抗生成神经网络的训练方法及系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请实施例涉及计算机技术领域,尤其涉及一种对抗生成神经网络的训练方法、系统、计算机设备及存储介质。
赫瑞-瓦特大学(Heriot-Watt University)和谷歌深度神经(Google Deepmind)公司的大规模对抗生成网络训练案例表明,以折页损失函数(Hinge Loss)作为目标函数可以提高对抗生成网络的稳定性。但是,发明人发现,目前的训练方法对Hinge Loss边界的改变相当敏感,边界小时训练稳定,但生成效果偏差;边界大时训练容易造成判别器梯度消失或发生崩溃,但是效果更好。但是如果人工对边界进行调参会严重影响效率;另一方面,目前使判别器输出一维标量然后以其计算目标损失的方法依赖于单一维度的固定边界,会带来模型表征能力的局限性,而且一旦该维度出现崩溃,整个网络将无法恢复,所以训练难度仍然很大。
因此,本申请实施例旨在解决对抗生成神经网络稳定性差和效率低的问题。
发明内容
有鉴于此,本申请实施例提供了一种对抗生成神经网络的训练方法、系统、计算机设备及计算机可读存储介质,能够将对抗生成神经网络的输出映射为高维输出,使得对抗生成神经网络可以在不同的维度和边界进行训练,从而获得较大的收敛梯度,提高了对抗生成神经网络的训练速度和稳定性。
本申请实施例是通过下述技术方案来解决上述技术问题:
一种对抗生成神经网络的训练方法,包括:
建立初始判别神经网络和初始生成神经网络,并将所述初始判别神经网络和所述初始生成神经网络组成初始对抗生成神经网络;
初始化所述初始对抗生成神经网络的参数和所述初始判别神经网络的边界向量,其中,所述边界向量是一个具有预设维度数量的多维向量,所述初始对抗生成神经网络的参数包括所述初始判别神经网络的判别参数和所述初始生成神经网络的生成参数;
获取真实样本集合和随机变量集合,并将所述随机变量集合输入到所述初始生成神经网络中,以生成假样本集合;
将所述真实样本集合和所述假样本集合输入到所述初始判别神经网络,以得到与所述真实样本集合对应的第一判别输出和与所述假样本集合对应的第二判别输出;
根据预设的判别损失函数L
D=E[max(0,M-D(x))]+E[max(0,M+D(G(z)))]对所述第一判别输出和所述第二判别输出进行计算以得到判别损失值,其中,L
D表示判别损失值,E表示数学期望值,max(0,M-D(x))表示关于0和M-D(x)的最大值函数,max(0,M+D(G(z)))表示关于0和M+D(G(z))的最大值函数,M表示所述边界向量,D(x)表示所述第一判别输出,D(G(z))表示所述第二判别输出;
根据预设的生成损失函数L
G=-E[D(G(z))]对所述第二判别输出进行计算以得到生成损失值,其中,L
G表示所述生成损失值;
根据所述判别损失值和所述生成损失值对所述初始对抗生成神经网络的参数进行更新以得到目标对抗生成神经网络。
为了实现上述目的,本申请实施例还提供一种对抗生成神经网络的训练系统,包括:
建立模块,用于建立初始判别神经网络和初始生成神经网络,并将所述初始判别神经网络和所述初始生成神经网络组成初始对抗生成神经网络;
初始化模块,用于初始化所述初始对抗生成神经网络的参数和所述初始判别神经网络的边界向量,其中,所述边界向量是一个具有预设维度数量的多维向量,所述初始对抗生成神经网络的参数包括所述初始判别神经网络的判别参数和所述初始生成神经网络的生成参数;
生成模块,用于获取真实样本集合和随机变量集合,并将所述随机变量集合输入到所述初始生成神经网络中,以生成假样本集合;
输出模块,用于将所述真实样本集合和所述假样本集合输入到所述初始判别神经网络,以得到与所述真实样本集合对应的第一判别输出和与所述假样本集合对应的第二判别输出;
第一计算模块,用于根据预设的判别损失函数L
D=E[max(0,M-D(x))]+E[max(0,M+D(G(z)))]对所述第一判别输出和所述第二判别输出进行计算以得到判别损失值,其中,L
D表示判别损失值,E表示数学期望值,max(0,M-D(x))表示关于0和M-D(x)的最大值函数,max(0,M+D(G(z)))表示关于0和M+D(G(z))的最大值函数,M表示所述边界向量,D(x)表示所述第一判别输出,D(G(z))表示所述第二判别输出;
第二计算模块,用于根据预设的生成损失函数L
G=-E[D(G(z))]对所述第二判别输出进行计算以得到生成损失值,其中,L
G表示所述生成损失值;
更新模块,用于根据所述判别损失值和所述生成损失值对所述初始对抗生成神经网络的参数进行更新以得到目标对抗生成神经网络。
为了实现上述目的,本申请实施例还提供一种计算机设备,所述计算机设备包括存储器、处理器以及存储在所述存储器上并可在处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现以下方法:
建立初始判别神经网络和初始生成神经网络,并将所述初始判别神经网络和所述初始生成神经网络组成初始对抗生成神经网络;
初始化所述初始对抗生成神经网络的参数和所述初始判别神经网络的边界向量,其中,所述边界向量是一个具有预设维度数量的多维向量,所述初始对抗生成神经网络的参数包括所述初始判别神经网络的判别参数和所述初始生成神经网络的生成参数;
获取真实样本集合和随机变量集合,并将所述随机变量集合输入到所述初始生成神经网络中,以生成假样本集合;
将所述真实样本集合和所述假样本集合输入到所述初始判别神经网络,以得到与所述真实样本集合对应的第一判别输出和与所述假样本集合对应的第二判别输出;
根据预设的判别损失函数L
D=E[max(0,M-D(x))]+E[max(0,M+D(G(z)))]对所述第一判别输出和所述第二判别输出进行计算以得到判别损失值,其中,L
D表示判别损失值,E表示数学期望值,max(0,M-D(x))表示关于0和M-D(x)的最大值函数,max(0,M+D(G(z)))表示关于0和M+D(G(z))的最大值函数,M表示所述边界向量,D(x)表示所述第一判别输出,D(G(z))表示所述第二判别输出;
根据预设的生成损失函数L
G=-E[D(G(z))]对所述第二判别输出进行计算以得到生成损失值,其中,L
G表示所述生成损失值;
根据所述判别损失值和所述生成损失值对所述初始对抗生成神经网络的参数进行更新以得到目标对抗生成神经网络。
为了实现上述目的,本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序可被至少一个处理器所执行,以使所述至少一个处理器执行以下方法:
建立初始判别神经网络和初始生成神经网络,并将所述初始判别神经网络和所述初始生成神经网络组成初始对抗生成神经网络;
初始化所述初始对抗生成神经网络的参数和所述初始判别神经网络的边界向量,其中,所述边界向量是一个具有预设维度数量的多维向量,所述初始对抗生成神经网络的参数包括所述初始判别神经网络的判别参数和所述初始生成神经网络的生成参数;
获取真实样本集合和随机变量集合,并将所述随机变量集合输入到所述初始生成神经网络中,以生成假样本集合;
将所述真实样本集合和所述假样本集合输入到所述初始判别神经网络,以得到与所述真实样本集合对应的第一判别输出和与所述假样本集合对应的第二判别输出;
根据预设的判别损失函数L
D=E[max(0,M-D(x))]+E[max(0,M+D(G(z)))]对所述第一判别输出和所述第二判别输出进行计算以得到判别损失值,其中,L
D表示判别损失值,E表示数学期望值,max(0,M-D(x))表示关于0和M-D(x)的最大值函数,max(0,M+D(G(z)))表示关于0和M+D(G(z))的最大值函数,M表示所述边界向量,D(x)表示所述第一判别输出,D(G(z))表示所述第二判别输出;
根据预设的生成损失函数L
G=-E[D(G(z))]对所述第二判别输出进行计算以得到生成损失值,其中,L
G表示所述生成损失值;
根据所述判别损失值和所述生成损失值对所述初始对抗生成神经网络的参数进行更新以得到目标对抗生成神经网络。
本申请通过多维的边界向量将对抗生成神经网络的输出映射为高维输出,使得对抗生成神经网络可以在不同的维度和边界进行训练,从而获得较大的收敛梯度,提高了对抗生成神经网络的训练速度和稳定性。
以下结合附图和具体实施例对本申请进行详细描述,但不作为对本申请的限定。
图1为本申请实施例一之对抗生成神经网络的训练方法的步骤流程图;
图2为本申请实施例二之对抗生成神经网络的训练系统的程序模块示意图;
图3为本申请实施例三之计算机设备的硬件结构示意图。
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本申请要求的保护范围之内。
本申请的技术方案可应用于人工智能、区块链和/或大数据技术领域,具体可涉及神经网络技术。可选的,本申请涉及的数据如真实样本和/或各种参数等可存储于数据库中,或者可以存储于区块链中,比如通过区块链分布式存储,本申请不做限定。
实施例一
请参阅图1,示出了本申请实施例一之对抗生成神经网络的训练方法的步骤流程图。可以理解,本方法实施例中的流程图不用于对执行步骤的顺序进行限定。下面以计算机设备为执行主体进行示例性描述,具体如下:
步骤S100,建立初始判别神经网络和初始生成神经网络,并将所述初始判别神经网络和所述初始生成神经网络组成初始对抗生成神经网络。
对抗生成神经网络(Generative Adversarial Net,GAN),是一种深度学习神经网络,其核心思想源于博弈论的纳什均衡,由一个生成网络G和一个判别网络D组成。以生成图片为例,其中,生成网络G接收一个随机的噪声Z,并通过这个噪声生成图片生成并输出一张假的照片G(Z);判别网络接收输入的真照片X或假照片G(Z),并判断出照片的真假。在训练的过程中,生成网络G的目标就是尽量生成真实的图片去欺骗判别网络D,让判别网络无法判断G(Z)的真假。
具体的,在本实施例中,首先建立初始对抗生成神经网络,所述初始对抗生成神经网络由初始判别神经网络D和初始生成神经网络G组成。其中,所述初始生成神经网络是反卷积神经网络;所述初始判别神经网络是标准的卷积神经网络,所述初始判别神经网络至少包括输入层、卷积层、全连接层和输出层。
示例性的,以反卷积神经网络为基础建立初始生成神经网络,以卷积神经网络为基础建立初始判别神经网络,所述初始生成神经网络和所述初始判别神经网络组成一个用来生成人脸图片的初始对抗生成神经网络,其中,所述以卷积网络建立的初始判别神经网络包括输入层、卷积层、池化层、激活层、全连接层和输出层。
步骤S102,初始化所述初始对抗生成神经网络的参数和所述初始判别神经网络的边界向量,其中,所述边界向量是一个具有预设维度数量的多维向量,所述初始对抗生成神经网络的参数包括所述初始判别神经网络的判别参数和所述初始生成神经网络的生成参数。
具体的,在建立了初始对抗生成神经网络后,则初始化所述初始对抗生成神经网络的参数和所述初始判别神经网络的边界向量M,并将所述边界向量M作为所述初始判别神经网络的输出层的输出参数,其中,所述边界向量M是一个多维的向量,用以将所述初始判别神经网络的输出由单一维度映射为与所述边界向量M对应的多维度;所述初始对抗生成神经网络的参数指的是所述初始判别神经网络和初始生成神经网络的卷积核、步幅、权值和偏置等参数。
在一较佳实施例中,初始化所述初始判别神经网络的边界向量时,可以根据所述边界向量的维度数量和预设的数学分布公式进行取值以生成所述边界向量。
具体的,首先根据预设的多维向量M的维度数量和数学分布公式进行随机取值以生成所述边界向量M,其中,在实际应用中,所述边界向量M的维度应足够大,例如512维,以使对抗生成神经网络的边界更加多样化、所采样的空间更加拟合;所述预设的数学分布公式可以是均匀分布U(0,3]或者数值大于0的截断的正态分布。生成所述边界向量M后,则将其作为所述初始判别神经网络的输出层的输出映射参数,用以对所述输出层的输出进行多维映射。
示例性的,预设的边界向量M的维度为1*10,即10维,所采用的数学分布公式为均匀分布U(0,3],则随机取值生成的边界向量为M={0.2,0.5,0.9,1.1,1.4,1.7,2.2,2.6,2.9,3}。生成所述边界向量M后,将其作为初始判别神经网络的输出映射参数,以期将初始判别神经网络的输出映射为10维的向量。
步骤S104,获取真实样本集合和随机变量集合,并将所述随机变量集合输入到所述初始生成神经网络中,以生成假样本集合。
具体的,真实样本集合X是一系列真实的样本的集合,随机变量集合Z是一组通过标 准正太分布获得的随机噪声。所述随机变量集合Z用于生成假的样本,所述真实样本集合用于对所述初始判别神经网络进行训练,将假样本和真样本一起对所述初始判别神经网络进行训练可以提高所述初始判别神经网络鉴别真假样本的能力。
示例性的,真实样本数据集合X可以是一些真实的人脸照片,随机变量集合Z是一组通过标准正太分布取值的随机向量。所述计算机设备将一组随机变量输入到所述初始生成网络,经过卷积、池化、激活和反卷积等操作,可以生成并输出一些假的人脸图片G(Z)。
步骤S106,将所述真实样本集合和所述假样本集合输入到所述初始判别神经网络,以得到与所述真实样本集合对应的第一判别输出和与所述假样本集合对应的第二判别输出。
具体的,将真实样本集合X和所述初始生成网络生成的假样本集合G(Z)输入到所述初始判别神经网络D的输入层,经过卷积层、池化层、激活层、全连接层的处理后,在输出层输出对所述真实样本集合和假样本集合的判别概率。其中,对真实样本集合X的判别概率为D(X),对假样本集合G(Z)的判别概率为D(G(Z))。
示例性的,将真实的人脸图片和生成的假的人脸图片输入到初始判别网络中,经过卷积、池化、激活等操作后,在全连接层中赋予一定的权重,然后在输出层经过输出映射参数的映射后分别输出对应的判别概率D(X)和D(G(Z))。
在一较佳实施例中,将所述真实样本集合和所述假样本集合输入到所述初始判别神经网络以得到与所述真实样本集合对应的第一判别输出和与所述假样本集合对应的第二判别输出的步骤,具体包括:将所述真实样本集合输入至所述初始判别神经网络中,并根据所述边界向量将与所述真实样本集合对应的第一输出映射为与所述边界向量对应的第一多维向量,以得到所述第一判别输出;
将所述假样本集合输入至所述初始判别神经网络中,并根据所述边界向量将与所述假样本集合对应的第二输出映射为与所述边界向量对应的第二多维向量,以得到所述第二判别输出。
具体的,在没有经过所述边界M的映射之前,判别概率只是一个表征图片真假概率的介于[0,1]的数值,其中,0表示假,1表示真。经过所述边界向量M的多维映射之后,输出的是一个与所述边界向量M的维度对应的多维度向量。所述真实样本集合X输入到所述初始判别神经网络中,经过一系列的操作和所述边界向量M的多维映射后,输出对应的多维向量D(X);所述假样本集合输入到所述初始判别神经网络中,经过一系列的操作和所述边界向量M的多维映射后,输出对应的多维向量D(G(Z))。
示例性的,将真实的人脸图片输入到所述初始判别神经网络中,经过映射后输出的多维向量是D(X),将生成的假的人脸图片输入到所述初始判别神经网络中,经过映射后输出的多维向量是D(G(Z))。
步骤S108,根据预设的判别损失函数L
D=E[max(0,M-D(x))]+E[max(0,M+D(G(z)))]对所述第一判别输出和所述第二判别输出进行计算以得到判别损失值,其中,L
D表示判别损失值,E表示数学期望值,max(0,M-D(x))表示关于0和M-D(x)的最大值函数,max(0,M+D(G(z)))表示关于0和M+D(G(z))的最大值函数,M表示所述边界向量,D(x)表示所述第一判别输出,D(G(z))表示所述第二判别输出。
具体的,在本实施例中,E所表示的数学期望值指的是对期望值函数内的各个数值求算数平均数得到的均值,max所表示的最大值函数具体指的是对最大值函数内的数值求最大值。
示例性的,通过边界向量M映射得到的第一判别输出为D(x)={0.3,0.5,0.6,0.9,1.6,1.8,2.1,2.4,2.5,2.9},第二判别输出为D(G(z))={0.1,0.2,0.5,1.0,1.3,1.8,2.3, 2.4,2.7,3},则E[max(0,M-D(x))]=(0+0+0.3+0.2+0+0+0.1+0.2+0.4+0.1)÷10=0.13,E[max(0,M+D(G(z)))]=(0.1+0.3+0.4+0.1+0.1+0+0.1+0.2+0.2+0)÷10=0.15,L
D=0.13+0.15=0.28。
步骤S110,根据预设的生成损失函数L
G=-E[D(G(z))]对所述第二判别输出进行计算以得到生成损失值,其中,L
G表示所述生成损失值。
示例性的,第二判别输出为D(G(z))={0.1,0.2,0.5,1.0,1.3,1.8,2.3,2.4,2.7,3},则L
G=-E[D(G(z))]=-[(0.1+0.2+0.5+1.0+1.3+1.8+2.3+2.4+2.7+3)]÷10=-3.06。
步骤S112,根据所述判别损失值和所述生成损失值对所述初始对抗生成神经网络的参数进行更新以得到目标对抗生成神经网络。
具体的,根据所述判别损失函数的判别损失值对所述初始判别神经网络的输出层的参数进行偏导函数的求导,得到第一求导结果,并根据所述第一求导结果对所述输出层的参数进行更新;然后将所述第一求导结果反向传播给前面的全连接层,以更新全连接层的参数,以此类推,直至更新完输入层的参数,以得到目标判别神经网络。同样的,初始生成神经网络的更新根据所述生成损失值采用求导和反向传播的方法进行更新,以得到目标生成神经网络,并将所述目标判别神经网络和所述目标生成神经网络组成所述目标对抗生成神经网络。
示例性的,根据判别损失值L
D=0.28对初始判别神经网络的输出层的权值进行偏导函数的求导,以得到第一求导结果,并根据所述第一求导结果更新所述权值;然后将第一求导结果反向传播给全连接层,并根据第一求导结果更新全连接层的权值;最后将第一求导结果反向传播给卷积层,以更新卷积层的卷积核。以此类推,通过求导和反向传播,更新初始判别神经网络的所有参数。
在一较佳实施例中,根据所述判别损失值和所述生成损失值对所述初始对抗生成神经网络的参数进行更新之前,还将所述判别损失值与第一预设阈值时进行比较,当所述判别损失值大于第一预设阈值时,则对所述判别参数进行更新,以得到目标判别神经网络;将所述生成损失值与第二预设阈值进行比较,当所述生成损失值大于第二预设阈值时,则对所述生成参数进行更新,以得到目标生成神经网络。
本申请实施例通过多维的边界向量将对抗生成神经网络的输出映射为高维输出,使得对抗生成神经网络可以在不同的维度和边界进行训练,从而获得较大的收敛梯度,提高了对抗生成神经网络的训练速度和稳定性。
实施例二
请参阅图2,示出了本申请实施例二之对抗生成神经网络的训练系统的程序模块示意图。可以理解,本方法实施例中的流程图不用于对执行步骤的顺序进行限定。在本实施例中,对抗生成神经网络的训练系统20可以包括或被分割成一个或多个程序模块,一个或者多个程序模块被存储于存储介质中,并由一个或多个处理器所执行,以完成本申请,并可实现上述对抗生成神经网络的训练方法。本申请实施例所称的程序模块是指能够完成特定功能的一系列计算机程序指令段,比程序本身更适合于描述对抗生成神经网络的训练系统20在存储介质中的执行过程。以下描述将具体介绍本实施例各程序模块的功能:
建立模块200,用于建立初始判别神经网络和初始生成神经网络,并将所述初始判别神经网络和所述初始生成神经网络组成初始对抗生成神经网络。
GAN是一种深度学习神经网络,其核心思想源于博弈论的纳什均衡,由一个生成网络G和一个判别网络D组成。以生成图片为例,其中,生成网络G接收一个随机的噪声Z,并通过这个噪声生成图片生成并输出一张假的照片G(Z);判别网络接收输入的真照片X或假照片G(Z),并判断出照片的真假。在训练的过程中,生成网络G的目标就是尽量生成真 实的图片去欺骗判别网络D,让判别网络无法判断G(Z)的真假。
具体的,在本实施例中,所述建立模块200首先建立初始对抗生成神经网络,所述初始对抗生成神经网络由初始判别神经网络D和初始生成神经网络G组成。其中,所述初始生成神经网络是反卷积神经网络;所述初始判别神经网络是标准的卷积神经网络,所述初始判别神经网络至少包括输入层、卷积层、全连接层和输出层。
示例性的,以反卷积神经网络为基础建立初始生成神经网络,以卷积神经网络为基础建立初始判别神经网络,所述初始生成神经网络和所述初始判别神经网络组成一个用来生成人脸图片的初始对抗生成神经网络,其中,所述以卷积网络建立的初始判别神经网络包括输入层、卷积层、池化层、激活层、全连接层和输出层。
初始化模块202,用于初始化所述初始对抗生成神经网络的参数和所述初始判别神经网络的边界向量,其中,所述边界向量是一个具有预设维度数量的多维向量,所述初始对抗生成神经网络的参数包括所述初始判别神经网络的判别参数和所述初始生成神经网络的生成参数。
具体的,在所述建立模块200建立了初始对抗生成神经网络后,所述初始化模块202初始化所述初始对抗生成神经网络的参数和所述初始判别神经网络的边界向量M,并将所述边界向量M作为所述初始判别神经网络的输出层的输出参数,其中,所述边界向量M是一个多维的向量,用以将所述初始判别神经网络的输出由单一维度映射为与所述边界向量M对应的多维度;所述初始对抗生成神经网络的参数指的是所述初始判别神经网络和初始生成神经网络的卷积核、步幅、权值和偏置等参数。
在一较佳实施例中,所述初始化模块202在初始化所述初始判别神经网络的边界向量时,还根据所述边界向量的维度数量和预设的数学分布公式进行取值以生成所述边界向量。
具体的,所述初始化模块202首先根据预设的多维向量M的维度数量和数学分布公式进行随机取值以生成所述边界向量M,其中,在实际应用中,所述边界向量M的维度应足够大,例如512维,以使对抗生成神经网络的边界更加多样化、所采样的空间更加拟合;所述预设的数学分布公式可以是均匀分布U(0,3]或者数值大于0的截断的正态分布。生成所述边界向量M后,则将其作为所述初始判别神经网络的输出层的输出映射参数,用以对所述输出层的输出进行多维映射。
示例性的,预设的边界向量M的维度为1*10,即10维,所采用的数学分布公式为均匀分布U(0,3],则随机取值生成的边界向量为M={0.2,0.5,0.9,1.1,1.4,1.7,2.2,2.6,2.9,3}。生成所述边界向量M后,将其作为初始判别神经网络的输出映射参数,以期将初始判别神经网络的输出映射为10维的向量。
生成模块204,用于获取真实样本集合和随机变量集合,并将所述随机变量集合输入到所述初始生成神经网络中,以生成假样本集合。
具体的,真实样本集合X是一系列真实的样本的集合,随机变量集合Z是一组通过标准正太分布获得的随机噪声。所述随机变量集合Z用于生成假的样本,所述真实样本集合用于对所述初始判别神经网络进行训练,将假样本和真样本一起对所述初始判别神经网络进行训练可以提高所述初始判别神经网络鉴别真假样本的能力。
示例性的,真实样本数据集合X可以是一些真实的人脸照片,随机变量集合Z是一组通过标准正太分布取值的随机向量。所述计算机设备将一组随机变量输入到所述初始生成网络,经过卷积、池化、激活和反卷积等操作,可以生成并输出一些假的人脸图片G(Z)。
输出模块206,用于将所述真实样本集合和所述假样本集合输入到所述初始判别神经网络,以得到与所述真实样本集合对应的第一判别输出和与所述假样本集合对应的第二判别输出。
具体的,所述输出模块206将真实样本集合X和所述初始生成网络生成的假样本集合 G(Z)输入到所述初始判别神经网络D的输入层,经过卷积层、池化层、激活层、全连接层的处理后,在输出层输出对所述真实样本集合和假样本集合的判别概率。其中,对真实样本集合X的判别概率为D(X),对假样本集合G(Z)的判别概率为D(G(Z))。
示例性的,所述输出模块206将真实的人脸图片和生成的假的人脸图片输入到初始判别网络中,经过卷积、池化、激活等操作后,在全连接层中赋予一定的权重,然后在输出层经过输出映射参数的映射后分别输出对应的判别概率D(X)和D(G(Z))。
在一较佳实施例中,所述输出模块206将所述真实样本集合和所述假样本集合输入到所述初始判别神经网络以得到与所述真实样本集合对应的第一判别输出和与所述假样本集合对应的第二判别输出的步骤,还可以包括:将所述真实样本集合输入至所述初始判别神经网络中,并根据所述边界向量将与所述真实样本集合对应的第一输出映射为与所述边界向量对应的第一多维向量,以得到所述第一判别输出;将所述假样本集合输入至所述初始判别神经网络中,并根据所述边界向量将与所述假样本集合对应的第二输出映射为与所述边界向量对应的第二多维向量,以得到所述第二判别输出。
具体的,在没有经过所述边界M的映射之前,判别概率只是一个表征图片真假概率的介于[0,1]的数值,其中,0表示假,1表示真。经过所述边界向量M的多维映射之后,输出的是一个与所述边界向量M的维度对应的多维度向量。所述真实样本集合X输入到所述初始判别神经网络中,经过一系列的操作和所述边界向量M的多维映射后,输出对应的多维向量D(X);所述假样本集合输入到所述初始判别神经网络中,经过一系列的操作和所述边界向量M的多维映射后,输出对应的多维向量D(G(Z))。
示例性的,所述输出模块206将真实的人脸图片输入到所述初始判别神经网络中,经过映射后输出的多维向量是D(X),将生成的假的人脸图片输入到所述初始判别神经网络中,经过映射后输出的多维向量是D(G(Z))。
第一计算模块208,用于根据预设的判别损失函数L
D=E[max(0,M-D(x))]+E[max(0,M+D(G(z)))]对所述第一判别输出和所述第二判别输出进行计算以得到判别损失值,其中,L
D表示判别损失值,E表示数学期望值,max(0,M-D(x))表示关于0和M-D(x)的最大值函数,max(0,M+D(G(z)))表示关于0和M+D(G(z))的最大值函数,M表示所述边界向量,D(x)表示所述第一判别输出,D(G(z))表示所述第二判别输出。
具体的,在本实施例中,E所表示的数学期望值指的是对期望值函数内的各个数值求算数平均数得到的均值,max所表示的最大值函数具体指的是对最大值函数内的数值求最大值。
示例性的,通过边界向量M映射得到的第一判别输出为D(x)={0.3,0.5,0.6,0.9,1.6,1.8,2.1,2.4,2.5,2.9},第二判别输出为D(G(z))={0.1,0.2,0.5,1.0,1.3,1.8,2.3,2.4,2.7,3},则E[max(0,M-D(x))]=(0+0+0.3+0.2+0+0+0.1+0.2+0.4+0.1)÷10=0.13,E[max(0,M+D(G(z)))]=(0.1+0.3+0.4+0.1+0.1+0+0.1+0.2+0.2+0)÷10=0.15,L
D=0.13+0.15=0.28。
第二计算模块210,用于根据预设的生成损失函数L
G=-E[D(G(z))]对所述第二判别输出进行计算以得到生成损失值,其中,L
G表示所述生成损失值。
示例性的,第二判别输出为D(G(z))={0.1,0.2,0.5,1.0,1.3,1.8,2.3,2.4,2.7,3},则L
G=-E[D(G(z))]=-[(0.1+0.2+0.5+1.0+1.3+1.8+2.3+2.4+2.7+3)]÷10=-3.06。
更新模块212,用于根据所述判别损失值和所述生成损失值对所述初始对抗生成神经网络的参数进行更新以得到目标对抗生成神经网络。
具体的,所述更新模块212根据所述判别损失函数的判别损失值对所述初始判别神经网络的输出层的参数进行偏导函数的求导,得到第一求导结果,并根据所述第一求导结果对所述输出层的参数进行更新;然后将所述第一求导结果反向传播给前面的全连接层,以更新全连接层的参数,以此类推,直至更新完输入层的参数,以得到目标判别神经网络。同样的,初始生成神经网络的更新根据所述生成损失值采用求导和反向传播的方法进行更新,以得到目标生成神经网络,并将所述目标判别神经网络和所述目标生成神经网络组成所述目标对抗生成神经网络。
示例性的,根据判别损失值L
D=0.28对初始判别神经网络的输出层的权值进行偏导函数的求导,以得到第一求导结果,并根据所述第一求导结果更新所述权值;然后将第一求导结果反向传播给全连接层,并根据第一求导结果更新全连接层的权值;最后将第一求导结果反向传播给卷积层,以更新卷积层的卷积核。以此类推,通过求导和反向传播,更新初始判别神经网络的所有参数。
在一较佳实施例中,所述更新模块212根据所述判别损失值和所述生成损失值对所述初始对抗生成神经网络的参数进行更新之前,还将所述判别损失值与第一预设阈值时进行比较,当所述判别损失值大于第一预设阈值时,则对所述判别参数进行更新,以得到目标判别神经网络;将所述生成损失值与第二预设阈值进行比较,当所述生成损失值大于第二预设阈值时,则对所述生成参数进行更新,以得到目标生成神经网络。
本申请实施例通过多维的边界向量将对抗生成神经网络的输出映射为高维输出,使得对抗生成神经网络可以在不同的维度和边界进行训练,从而获得较大的收敛梯度,提高了对抗生成神经网络的训练速度和稳定性。
实施例三
参阅图3,是本申请实施例三之计算机设备的硬件架构示意图。本实施例中,所述计算机设备2是一种能够按照事先设定或者存储的指令,自动进行数值计算和/或信息处理的设备。该计算机设备2可以是机架式服务器、刀片式服务器、塔式服务器或机柜式服务器(包括独立的服务器,或者多个服务器所组成的服务器集群)等。如图3所示,所述计算机设备2至少包括,但不限于,存储器和处理器,存储器上可存储有计算机程序,并可在处理器上运行,处理器可执行计算机程序时实现上述方法中的部分或全部步骤。可选的,该计算机设备还可包括网络接口和/或对抗生成神经网络的训练系统。例如,该计算机设备包括存储器21、处理器22、网络接口23以及对抗生成神经网络的训练系统20,可通过系统总线相互通信连接存储器21、处理器22、网络接口23、以及对抗生成神经网络的训练系统20。其中:
本实施例中,存储器21至少包括一种类型的计算机可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,存储器21可以是计算机设备2的内部存储单元,例如该计算机设备2的硬盘或内存。在另一些实施例中,存储器21也可以是计算机设备2的外部存储设备,例如该计算机设备2上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,存储器21还可以既包括计算机设备2的内部存储单元也包括其外部存储设备。本实施例中,存储器21通常用于存储安装于计算机设备2的操作系统和各类应用软件,例如实施例二的对抗生成神经网络的训练系统20的程序代码等。此外,存储器21还可以用于暂时地存储已经输出或者将要输出的各类数据。
处理器22在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器22通常用于控制计算机设备2 的总体操作。本实施例中,处理器22用于运行存储器21中存储的程序代码或者处理数据,例如运行对抗生成神经网络的训练系统20,以实现实施例一的对抗生成神经网络的训练方法。
所述网络接口23可包括无线网络接口或有线网络接口,该网络接口23通常用于在所述计算机设备2与其他电子装置之间建立通信连接。例如,所述网络接口23用于通过网络将所述计算机设备2与外部终端相连,在所述计算机设备2与外部终端之间的建立数据传输通道和通信连接等。所述网络可以是企业内部网(Intranet)、互联网(Internet)、全球移动通讯系统(Global System of Mobile communication,GSM)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、4G网络、5G网络、蓝牙(Bluetooth)、Wi-Fi等无线或有线网络。
示例的,处理器可调用存储器存储的介质或程序实现以下方法:
建立初始判别神经网络和初始生成神经网络,并将所述初始判别神经网络和所述初始生成神经网络组成初始对抗生成神经网络;
初始化所述初始对抗生成神经网络的参数和所述初始判别神经网络的边界向量,其中,所述边界向量是一个具有预设维度数量的多维向量,所述初始对抗生成神经网络的参数包括所述初始判别神经网络的判别参数和所述初始生成神经网络的生成参数;
获取真实样本集合和随机变量集合,并将所述随机变量集合输入到所述初始生成神经网络中,以生成假样本集合;
将所述真实样本集合和所述假样本集合输入到所述初始判别神经网络,以得到与所述真实样本集合对应的第一判别输出和与所述假样本集合对应的第二判别输出;
根据预设的判别损失函数L
D=E[max(0,M-D(x))]+E[max(0,M+D(G(z)))]对所述第一判别输出和所述第二判别输出进行计算以得到判别损失值,其中,L
D表示判别损失值,E表示数学期望值,max(0,M-D(x))表示关于0和M-D(x)的最大值函数,max(0,M+D(G(z)))表示关于0和M+D(G(z))的最大值函数,M表示所述边界向量,D(x)表示所述第一判别输出,D(G(z))表示所述第二判别输出;
根据预设的生成损失函数L
G=-E[D(G(z))]对所述第二判别输出进行计算以得到生成损失值,其中,L
G表示所述生成损失值;
根据所述判别损失值和所述生成损失值对所述初始对抗生成神经网络的参数进行更新以得到目标对抗生成神经网络。
可选的,该处理器还可执行该介质或程序实现上述实施例中方法的其他步骤,这里不再赘述。
需要指出的是,图3仅示出了具有部件20-23的计算机设备2,但是应理解的是,并不要求实施所有示出的部件,可以替代的实施更多或者更少的部件。
在本实施例中,存储于存储器21中的所述对抗生成神经网络的训练系统20还可以被分割为一个或者多个程序模块,所述一个或者多个程序模块被存储于存储器21中,并由一个或多个处理器(本实施例为处理器22)所执行,以完成本申请。
例如,图2示出了所述对抗生成神经网络的训练系统20的程序模块示意图,该实施例中,所述对抗生成神经网络的训练系统20可以被划分为建立模块200、初始化模块202、生成模块204、输出模块206、第一计算模块208、第二计算模块210和更新模块212。其中,本申请所称的程序模块是指能够完成特定功能的一系列计算机程序指令段,比程序更适合于描述所述对抗生成神经网络的训练系统20在所述计算机设备2中的执行过程。所述程序模块200-212的具体功能在实施例二中已有详细描述,在此不再赘述。
实施例四
本实施例还提供一种计算机可读存储介质,如闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘、服务器、App应用商城等等,其上存储有计算机程序,程序被处理器执行时实现相应功能。本实施例的计算机可读存储介质用于存储对抗生成神经网络的训练系统20,被处理器执行时实现实施例一的对抗生成神经网络的训练方法。例如,计算机程序可被至少一个处理器所执行,以使所述至少一个处理器执行以下方法:
建立初始判别神经网络和初始生成神经网络,并将所述初始判别神经网络和所述初始生成神经网络组成初始对抗生成神经网络;
初始化所述初始对抗生成神经网络的参数和所述初始判别神经网络的边界向量,其中,所述边界向量是一个具有预设维度数量的多维向量,所述初始对抗生成神经网络的参数包括所述初始判别神经网络的判别参数和所述初始生成神经网络的生成参数;
获取真实样本集合和随机变量集合,并将所述随机变量集合输入到所述初始生成神经网络中,以生成假样本集合;
将所述真实样本集合和所述假样本集合输入到所述初始判别神经网络,以得到与所述真实样本集合对应的第一判别输出和与所述假样本集合对应的第二判别输出;
根据预设的判别损失函数L
D=E[max(0,M-D(x))]+E[max(0,M+D(G(z)))]对所述第一判别输出和所述第二判别输出进行计算以得到判别损失值,其中,L
D表示判别损失值,E表示数学期望值,max(0,M-D(x))表示关于0和M-D(x)的最大值函数,max(0,M+D(G(z)))表示关于0和M+D(G(z))的最大值函数,M表示所述边界向量,D(x)表示所述第一判别输出,D(G(z))表示所述第二判别输出;
根据预设的生成损失函数L
G=-E[D(G(z))]对所述第二判别输出进行计算以得到生成损失值,其中,L
G表示所述生成损失值;
根据所述判别损失值和所述生成损失值对所述初始对抗生成神经网络的参数进行更新以得到目标对抗生成神经网络。
可选的,该计算机程序被处理器执行时还可实现上述实施例中方法的其他步骤,这里不再赘述。进一步可选的,本申请涉及的存储介质如计算机可读存储介质可以是非易失性的,也可以是易失性的。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。
Claims (20)
- 一种对抗生成神经网络的训练方法,其中,包括:建立初始判别神经网络和初始生成神经网络,并将所述初始判别神经网络和所述初始生成神经网络组成初始对抗生成神经网络;初始化所述初始对抗生成神经网络的参数和所述初始判别神经网络的边界向量,其中,所述边界向量是一个具有预设维度数量的多维向量,所述初始对抗生成神经网络的参数包括所述初始判别神经网络的判别参数和所述初始生成神经网络的生成参数;获取真实样本集合和随机变量集合,并将所述随机变量集合输入到所述初始生成神经网络中,以生成假样本集合;将所述真实样本集合和所述假样本集合输入到所述初始判别神经网络,以得到与所述真实样本集合对应的第一判别输出和与所述假样本集合对应的第二判别输出;根据预设的判别损失函数L D=E[max(0,M-D(x))]+E[max(0,M+D(G(z)))]对所述第一判别输出和所述第二判别输出进行计算以得到判别损失值,其中,L D表示判别损失值,E表示数学期望值,max(0,M-D(x))表示关于0和M-D(x)的最大值函数,max(0,M+D(G(z)))表示关于0和M+D(G(z))的最大值函数,M表示所述边界向量,D(x)表示所述第一判别输出,D(G(z))表示所述第二判别输出;根据预设的生成损失函数L G=-E[D(G(z))]对所述第二判别输出进行计算以得到生成损失值,其中,L G表示所述生成损失值;根据所述判别损失值和所述生成损失值对所述初始对抗生成神经网络的参数进行更新以得到目标对抗生成神经网络。
- 根据权利要求1所述的对抗生成神经网络的训练方法,其中,所述初始判别神经网络的边界向量的初始化,包括:接收用户发送的初始化指令,以获取所述预设维度数量,并确定所述预设维度数量中的每一个维度;及根据预设数学分布公式的值域对所述每一个维度进行随机取值,以得到所述边界向量。
- 根据权利要求1所述的对抗生成神经网络的训练方法,其中,所述将所述真实样本集合和所述假样本集合输入到所述初始判别神经网络,以得到与所述真实样本集合对应的第一判别输出和与所述假样本集合对应的第二判别输出,包括:将所述真实样本集合输入至所述初始判别神经网络中,并根据所述边界向量将与所述真实样本集合对应的第一输出映射为与所述边界向量对应的第一多维向量,得到所述第一判别输出;将所述假样本集合输入至所述初始判别神经网络中,并根据所述边界向量将与所述假样本集合对应的第二输出映射为与所述边界向量对应的第二多维向量,得到所述第二判别输出。
- 根据权利要求1所述的对抗生成神经网络的训练方法,其中,所述根据所述判别损失值和所述生成损失值对所述初始对抗生成神经网络的参数进行更新以得到目标对抗生成神经网络,包括:当所述判别损失值大于第一预设阈值时,则对所述判别参数进行更新,以得到目标判别神经网络;当所述生成损失值大于第二预设阈值时,则对所述生成参数进行更新,以得到目标生成神经网络;将所述目标判别神经网络和所述目标生成神经网络进行组合,得到所述目标对抗生成 神经网络。
- 根据权利要求4所述的对抗生成神经网络的训练方法,其中,所述对所述判别参数进行更新,包括:根据所述判别损失值,将所述判别参数进行求导,得到第一求导结果,并将所述第一求导结果反向传播,以根据所述第一求导结果更新所述判别参数。
- 根据权利要求4所述的对抗生成神经网络的训练方法,其中,所述对所述生成参数进行更新,包括:根据所述生成损失值,将所述生成参数进行求导,得到第二求导结果,并将所述第二求导结果反向传播,以根据所述第二求导结果更新所述生成参数。
- 一种对抗生成神经网络的训练系统,其中,包括:建立模块,用于建立初始判别神经网络和初始生成神经网络,并将所述初始判别神经网络和所述初始生成神经网络组成初始对抗生成神经网络;初始化模块,用于初始化所述初始对抗生成神经网络的参数和所述初始判别神经网络的边界向量,其中,所述边界向量是一个具有预设维度数量的多维向量,所述初始对抗生成神经网络的参数包括所述初始判别神经网络的判别参数和所述初始生成神经网络的生成参数;生成模块,用于获取真实样本集合和随机变量集合,并将所述随机变量集合输入到所述初始生成神经网络中,以生成假样本集合;输出模块,用于将所述真实样本集合和所述假样本集合输入到所述初始判别神经网络,以得到与所述真实样本集合对应的第一判别输出和与所述假样本集合对应的第二判别输出;第一计算模块,用于根据预设的判别损失函数L D=E[max(0,M-D(x))]+E[max(0,M+D(G(z)))]对所述第一判别输出和所述第二判别输出进行计算以得到判别损失值,其中,L D表示判别损失值,E表示数学期望值,max(0,M-D(x))表示关于0和M-D(x)的最大值函数,max(0,M+D(G(z)))表示关于0和M+D(G(z))的最大值函数,M表示所述边界向量,D(x)表示所述第一判别输出,D(G(z))表示所述第二判别输出;第二计算模块,用于根据预设的生成损失函数L G=-E[D(G(z))]对所述第二判别输出进行计算以得到生成损失值,其中,L G表示所述生成损失值;更新模块,用于根据所述判别损失值和所述生成损失值对所述初始对抗生成神经网络的参数进行更新以得到目标对抗生成神经网络。
- 根据权利要求7所述的对抗生成神经网络的训练系统,其中,所述输出模块还用于:将所述真实样本集合输入至所述初始判别神经网络中,并根据所述边界向量将与所述真实样本集合对应的第一输出映射为与所述边界向量对应的第一多维向量,得到所述第一判别输出;将所述假样本集合输入至所述初始判别神经网络中,并根据所述边界向量将与所述假样本集合对应的第二输出映射为与所述边界向量对应的第二多维向量,得到所述第二判别输出。
- 一种计算机设备,所述计算机设备包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现以下方法:建立初始判别神经网络和初始生成神经网络,并将所述初始判别神经网络和所述初始生成神经网络组成初始对抗生成神经网络;初始化所述初始对抗生成神经网络的参数和所述初始判别神经网络的边界向量,其中,所述边界向量是一个具有预设维度数量的多维向量,所述初始对抗生成神经网络的参数包括所述初始判别神经网络的判别参数和所述初始生成神经网络的生成参数;获取真实样本集合和随机变量集合,并将所述随机变量集合输入到所述初始生成神经网络中,以生成假样本集合;将所述真实样本集合和所述假样本集合输入到所述初始判别神经网络,以得到与所述真实样本集合对应的第一判别输出和与所述假样本集合对应的第二判别输出;根据预设的判别损失函数L D=E[max(0,M-D(x))]+E[max(0,M+D(G(z)))]对所述第一判别输出和所述第二判别输出进行计算以得到判别损失值,其中,L D表示判别损失值,E表示数学期望值,max(0,M-D(x))表示关于0和M-D(x)的最大值函数,max(0,M+D(G(z)))表示关于0和M+D(G(z))的最大值函数,M表示所述边界向量,D(x)表示所述第一判别输出,D(G(z))表示所述第二判别输出;根据预设的生成损失函数L G=-E[D(G(z))]对所述第二判别输出进行计算以得到生成损失值,其中,L G表示所述生成损失值;根据所述判别损失值和所述生成损失值对所述初始对抗生成神经网络的参数进行更新以得到目标对抗生成神经网络。
- 根据权利要求9所述的计算机设备,其中,所述初始判别神经网络的边界向量的初始化时,具体实现:接收用户发送的初始化指令,以获取所述预设维度数量,并确定所述预设维度数量中的每一个维度;及根据预设数学分布公式的值域对所述每一个维度进行随机取值,以得到所述边界向量。
- 根据权利要求9所述的计算机设备,其中,所述将所述真实样本集合和所述假样本集合输入到所述初始判别神经网络,以得到与所述真实样本集合对应的第一判别输出和与所述假样本集合对应的第二判别输出时,具体实现:将所述真实样本集合输入至所述初始判别神经网络中,并根据所述边界向量将与所述真实样本集合对应的第一输出映射为与所述边界向量对应的第一多维向量,得到所述第一判别输出;将所述假样本集合输入至所述初始判别神经网络中,并根据所述边界向量将与所述假样本集合对应的第二输出映射为与所述边界向量对应的第二多维向量,得到所述第二判别输出。
- 根据权利要求9所述的计算机设备,其中,所述根据所述判别损失值和所述生成损失值对所述初始对抗生成神经网络的参数进行更新以得到目标对抗生成神经网络时,具体实现:当所述判别损失值大于第一预设阈值时,则对所述判别参数进行更新,以得到目标判别神经网络;当所述生成损失值大于第二预设阈值时,则对所述生成参数进行更新,以得到目标生成神经网络;将所述目标判别神经网络和所述目标生成神经网络进行组合,得到所述目标对抗生成神经网络。
- 根据权利要求12所述的计算机设备,其中,所述对所述判别参数进行更新时,具体实现:根据所述判别损失值,将所述判别参数进行求导,得到第一求导结果,并将所述第一 求导结果反向传播,以根据所述第一求导结果更新所述判别参数。
- 根据权利要求12所述的计算机设备,其中,所述对所述生成参数进行更新时,具体实现:根据所述生成损失值,将所述生成参数进行求导,得到第二求导结果,并将所述第二求导结果反向传播,以根据所述第二求导结果更新所述生成参数。
- 一种计算机可读存储介质,其中,所述计算机可读存储介质内存储有计算机程序,所述计算机程序可被至少一个处理器所执行,以使所述至少一个处理器执行以下方法:建立初始判别神经网络和初始生成神经网络,并将所述初始判别神经网络和所述初始生成神经网络组成初始对抗生成神经网络;初始化所述初始对抗生成神经网络的参数和所述初始判别神经网络的边界向量,其中,所述边界向量是一个具有预设维度数量的多维向量,所述初始对抗生成神经网络的参数包括所述初始判别神经网络的判别参数和所述初始生成神经网络的生成参数;获取真实样本集合和随机变量集合,并将所述随机变量集合输入到所述初始生成神经网络中,以生成假样本集合;将所述真实样本集合和所述假样本集合输入到所述初始判别神经网络,以得到与所述真实样本集合对应的第一判别输出和与所述假样本集合对应的第二判别输出;根据预设的判别损失函数L D=E[max(0,M-D(x))]+E[max(0,M+D(G(z)))]对所述第一判别输出和所述第二判别输出进行计算以得到判别损失值,其中,L D表示判别损失值,E表示数学期望值,max(0,M-D(x))表示关于0和M-D(x)的最大值函数,max(0,M+D(G(z)))表示关于0和M+D(G(z))的最大值函数,M表示所述边界向量,D(x)表示所述第一判别输出,D(G(z))表示所述第二判别输出;根据预设的生成损失函数L G=-E[D(G(z))]对所述第二判别输出进行计算以得到生成损失值,其中,L G表示所述生成损失值;根据所述判别损失值和所述生成损失值对所述初始对抗生成神经网络的参数进行更新以得到目标对抗生成神经网络。
- 根据权利要求15所述的计算机可读存储介质,其中,所述初始判别神经网络的边界向量的初始化时,具体执行:接收用户发送的初始化指令,以获取所述预设维度数量,并确定所述预设维度数量中的每一个维度;及根据预设数学分布公式的值域对所述每一个维度进行随机取值,以得到所述边界向量。
- 根据权利要求15所述的计算机可读存储介质,其中,所述将所述真实样本集合和所述假样本集合输入到所述初始判别神经网络,以得到与所述真实样本集合对应的第一判别输出和与所述假样本集合对应的第二判别输出时,具体执行:将所述真实样本集合输入至所述初始判别神经网络中,并根据所述边界向量将与所述真实样本集合对应的第一输出映射为与所述边界向量对应的第一多维向量,得到所述第一判别输出;将所述假样本集合输入至所述初始判别神经网络中,并根据所述边界向量将与所述假样本集合对应的第二输出映射为与所述边界向量对应的第二多维向量,得到所述第二判别输出。
- 根据权利要求15所述的计算机可读存储介质,其中,所述根据所述判别损失值和所述生成损失值对所述初始对抗生成神经网络的参数进行更新以得到目标对抗生成神经网络时,具体执行:当所述判别损失值大于第一预设阈值时,则对所述判别参数进行更新,以得到目标判别神经网络;当所述生成损失值大于第二预设阈值时,则对所述生成参数进行更新,以得到目标生成神经网络;将所述目标判别神经网络和所述目标生成神经网络进行组合,得到所述目标对抗生成神经网络。
- 根据权利要求18所述的计算机可读存储介质,其中,所述对所述判别参数进行更新时,具体执行:根据所述判别损失值,将所述判别参数进行求导,得到第一求导结果,并将所述第一求导结果反向传播,以根据所述第一求导结果更新所述判别参数。
- 根据权利要求18所述的计算机可读存储介质,其中,所述对所述生成参数进行更新时,具体执行:根据所述生成损失值,将所述生成参数进行求导,得到第二求导结果,并将所述第二求导结果反向传播,以根据所述第二求导结果更新所述生成参数。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010138371.1 | 2020-03-03 | ||
CN202010138371.1A CN111445007B (zh) | 2020-03-03 | 2020-03-03 | 对抗生成神经网络的训练方法及系统 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021174935A1 true WO2021174935A1 (zh) | 2021-09-10 |
Family
ID=71627209
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2020/134889 WO2021174935A1 (zh) | 2020-03-03 | 2020-12-09 | 对抗生成神经网络的训练方法及系统 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111445007B (zh) |
WO (1) | WO2021174935A1 (zh) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114005446A (zh) * | 2021-11-01 | 2022-02-01 | 科大讯飞股份有限公司 | 情感分析方法、相关设备及可读存储介质 |
CN114858782A (zh) * | 2022-07-05 | 2022-08-05 | 中国民航大学 | 基于拉曼高光谱对抗判别模型的奶粉掺杂非定向检测方法 |
CN115277086A (zh) * | 2022-06-16 | 2022-11-01 | 西安电子科技大学 | 基于生成对抗网络的网络背景流量生成方法 |
CN115688229A (zh) * | 2022-10-18 | 2023-02-03 | 河海大学 | 基于深度学习的网壳结构最不利缺陷模态创建方法 |
CN117934869A (zh) * | 2024-03-22 | 2024-04-26 | 中铁大桥局集团有限公司 | 一种目标检测方法、系统、计算设备以及介质 |
CN118152812A (zh) * | 2024-05-10 | 2024-06-07 | 腾讯科技(深圳)有限公司 | 虚假信息识别模型的训练方法、装置、设备及存储介质 |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111445007B (zh) * | 2020-03-03 | 2023-08-01 | 平安科技(深圳)有限公司 | 对抗生成神经网络的训练方法及系统 |
CN112565777B (zh) * | 2020-11-30 | 2023-04-07 | 通号智慧城市研究设计院有限公司 | 基于深度学习模型视频数据传输方法、系统、介质及设备 |
CN112598188A (zh) * | 2020-12-29 | 2021-04-02 | 沃太能源南通有限公司 | 神经网络的生成方法、功率预测方法、装置和存储介质 |
CN113988291B (zh) * | 2021-10-26 | 2024-06-04 | 支付宝(杭州)信息技术有限公司 | 用户表征网络的训练方法及装置 |
CN114236410B (zh) * | 2021-11-24 | 2022-06-24 | 广东工业大学 | 基于新型生成式对抗神经网络的锂电池soh估计方法 |
CN115022001B (zh) * | 2022-05-27 | 2023-05-09 | 中国电子信息产业集团有限公司第六研究所 | 域名识别模型的训练方法、装置、电子设备及存储介质 |
CN115439894B (zh) * | 2022-11-08 | 2023-04-11 | 荣耀终端有限公司 | 训练指纹配对模型的方法、电子设备、程序产品及介质 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107180392A (zh) * | 2017-05-18 | 2017-09-19 | 北京科技大学 | 一种电力企业电费回收数据模拟方法 |
CN107563995A (zh) * | 2017-08-14 | 2018-01-09 | 华南理工大学 | 一种多判别器误差反传的对抗网络方法 |
CN108960278A (zh) * | 2017-05-18 | 2018-12-07 | 英特尔公司 | 使用生成式对抗网络的鉴别器的新奇检测 |
US20190220388A1 (en) * | 2018-01-18 | 2019-07-18 | Hitachi, Ltd. | Boundary search test support device and boundary search test support method |
CN111445007A (zh) * | 2020-03-03 | 2020-07-24 | 平安科技(深圳)有限公司 | 对抗生成神经网络的训练方法及系统 |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10324467B1 (en) * | 2017-12-29 | 2019-06-18 | Apex Artificial Intelligence Industries, Inc. | Controller systems and methods of limiting the operation of neural networks to be within one or more conditions |
US11061650B2 (en) * | 2019-06-27 | 2021-07-13 | Intel Corporation | Methods and apparatus to automatically generate code for graphical user interfaces |
CN110720915A (zh) * | 2019-09-09 | 2020-01-24 | 浙江工业大学 | 一种基于gan的脑部电阻抗断层成像方法 |
-
2020
- 2020-03-03 CN CN202010138371.1A patent/CN111445007B/zh active Active
- 2020-12-09 WO PCT/CN2020/134889 patent/WO2021174935A1/zh active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107180392A (zh) * | 2017-05-18 | 2017-09-19 | 北京科技大学 | 一种电力企业电费回收数据模拟方法 |
CN108960278A (zh) * | 2017-05-18 | 2018-12-07 | 英特尔公司 | 使用生成式对抗网络的鉴别器的新奇检测 |
CN107563995A (zh) * | 2017-08-14 | 2018-01-09 | 华南理工大学 | 一种多判别器误差反传的对抗网络方法 |
US20190220388A1 (en) * | 2018-01-18 | 2019-07-18 | Hitachi, Ltd. | Boundary search test support device and boundary search test support method |
CN111445007A (zh) * | 2020-03-03 | 2020-07-24 | 平安科技(深圳)有限公司 | 对抗生成神经网络的训练方法及系统 |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114005446A (zh) * | 2021-11-01 | 2022-02-01 | 科大讯飞股份有限公司 | 情感分析方法、相关设备及可读存储介质 |
CN115277086A (zh) * | 2022-06-16 | 2022-11-01 | 西安电子科技大学 | 基于生成对抗网络的网络背景流量生成方法 |
CN115277086B (zh) * | 2022-06-16 | 2023-10-20 | 西安电子科技大学 | 基于生成对抗网络的网络背景流量生成方法 |
CN114858782A (zh) * | 2022-07-05 | 2022-08-05 | 中国民航大学 | 基于拉曼高光谱对抗判别模型的奶粉掺杂非定向检测方法 |
CN114858782B (zh) * | 2022-07-05 | 2022-09-27 | 中国民航大学 | 基于拉曼高光谱对抗判别模型的奶粉掺杂非定向检测方法 |
CN115688229A (zh) * | 2022-10-18 | 2023-02-03 | 河海大学 | 基于深度学习的网壳结构最不利缺陷模态创建方法 |
CN115688229B (zh) * | 2022-10-18 | 2023-05-02 | 河海大学 | 基于深度学习的网壳结构最不利缺陷模态创建方法 |
CN117934869A (zh) * | 2024-03-22 | 2024-04-26 | 中铁大桥局集团有限公司 | 一种目标检测方法、系统、计算设备以及介质 |
CN118152812A (zh) * | 2024-05-10 | 2024-06-07 | 腾讯科技(深圳)有限公司 | 虚假信息识别模型的训练方法、装置、设备及存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN111445007B (zh) | 2023-08-01 |
CN111445007A (zh) | 2020-07-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021174935A1 (zh) | 对抗生成神经网络的训练方法及系统 | |
WO2020143225A1 (zh) | 神经网络的训练方法、训练装置和电子设备 | |
US11334671B2 (en) | Adding adversarial robustness to trained machine learning models | |
US20230385652A1 (en) | System and Method of Federated Learning with Diversified Feedback | |
WO2022007434A1 (zh) | 可视化方法及相关设备 | |
WO2019082165A1 (en) | GENERATION OF NEURAL NETWORKS WITH COMPRESSED REPRESENTATION HAVING A HIGH DEGREE OF PRECISION | |
CN112132847A (zh) | 模型训练方法、图像分割方法、装置、电子设备和介质 | |
CN111460234B (zh) | 图查询方法、装置、电子设备及计算机可读存储介质 | |
WO2018201601A1 (zh) | 基于数据源的业务定制装置、方法、系统及存储介质 | |
CN112231592B (zh) | 基于图的网络社团发现方法、装置、设备以及存储介质 | |
WO2019232772A1 (en) | Systems and methods for content identification | |
WO2023159746A1 (zh) | 基于图像分割的图像抠图方法、装置、计算机设备及介质 | |
CN112580733B (zh) | 分类模型的训练方法、装置、设备以及存储介质 | |
CN110009486A (zh) | 一种欺诈检测的方法、系统、设备及计算机可读存储介质 | |
WO2022095432A1 (zh) | 神经网络模型训练方法、装置、计算机设备及存储介质 | |
US20210271755A1 (en) | Detecting device and detecting method | |
WO2022179603A1 (zh) | 一种增强现实方法及其相关设备 | |
CN112668482A (zh) | 人脸识别训练方法、装置、计算机设备及存储介质 | |
CN113641797A (zh) | 数据处理方法、装置、设备、存储介质及计算机程序产品 | |
WO2021042895A1 (zh) | 基于神经网络的验证码识别方法、系统及计算机设备 | |
WO2021000674A1 (zh) | 细胞图片识别方法、系统、计算机设备及可读存储介质 | |
CN111709473B (zh) | 对象特征的聚类方法及装置 | |
CN114758130B (zh) | 图像处理及模型训练方法、装置、设备和存储介质 | |
CN113505861B (zh) | 基于元学习和记忆网络的图像分类方法及系统 | |
CN110929118B (zh) | 网络数据处理方法、设备、装置、介质 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 20923643 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 20923643 Country of ref document: EP Kind code of ref document: A1 |