当前位置:网站首页>Deep convolution generation countermeasure network
Deep convolution generation countermeasure network
2022-07-23 12:18:00 【Emperor Confucianism is supreme】
Understanding and learning depth convolution to generate confrontation network
One .GAN
introduction : Generative antagonistic network GAN, It's one of the most popular research directions . stay 2014 year , By Goodfellow The great God put forward , At that time G God is also a doctoral student at the University of Montreal . According to relevant media Statistics :CVPR2018 In my paper , One third of the papers are related to GAN of . thus it can be seen ,GAN In the future years of vision , It will be a fertile land . And we go to the pit GAN, First of all, we need reasons ,GAN What can be done , Why learn GAN.
》》GAN The original intention of is to generate data that does not exist in the real world , Similar to making AI Be creative or imaginative . The application scenario is as follows :
》AI The writer ,AI Painters need creativity AI body ;
》 Make the blur clear ( Go to the rain , Defogging , To shake , etc. );
》 Data enhancement , Generate more new data for feed, It can slow down the over fitting phenomenon of the model .
Now we're right GAN Have a discussion :
(1)GAN The idea is a two person zero sum game (two-player game), The sum of the interests of both sides of the game is a constant , For example, two people break their wrists , Suppose the total space is certain , You have more strength , Then you get a little more space , Correspondingly, I have less space , On the contrary, if I am strong, I will get a little more , But one thing is certain , My total space is certain , This is a two player game , But the total benefit is certain .
Only the GAN It can be seen as ,GAN There are two such players , A person's name is a generative model (G), Another person's name is the discriminant model (D). They have their own functions . such as , We have some real data , At the same time, there's a mess of fake data .(G) Try to imitate the fake data that you take with you into real data , And into the real data .(D) Trying desperately to separate real data from fake data . here ,(G) It's a generative model , It's similar to selling fake goods , Study hard how to cheat (D). and (D) It's a discriminant model , It's like a police uncle , Study hard how to distinguish (G) The deceptive technique of . such , With (D) More and more excellent identification techniques ,(G) I'm getting more and more skilled at deception .
The same thing is :
These two models can be regarded as a black box , Accept the input and have an output , It's like a function , An I / O map .
The difference is :
Generate models (G) function : It's like a sample generator , Enter a noise / sample , Then wrap it in a realistic sample , That is output .
Discriminant model (D): Compare it to a two classifier ( Like 0-1 classifier ), To determine whether the input sample is true or false .( That is, the output value is greater than 0.5 Still less than 0.5).
(2) The big way to train these two models is : Alternating individual iterations .
We can define an iteration number , Alternate iterations to a certain number of times and then stop . Let's take a look at the noise again at this time Z The generated false samples will find , It turns out that it's very real . Do you feel after watching this process GAN The design of is really ingenious , I think the most praiseworthy place may be the true and false transformation of this false sample in the training process , This is also the key to the game .
(3) The operational process of generating a counter network :
stay a In the figure , There is a big gap between the initial state data and the real data , The discriminator has the ability to preliminarily divide whether it is real data , But because of the noise , The effect is still flawed ;
》》》 stay b In the figure , By training the discriminator , Judging device D Start to gradually converge in a more perfect direction ;
》》》 stay c In the figure , Let's move the generated data to the real data , It makes it easier for the generated data to be discriminated as real data by the discriminator ;
》》》 stay d In the figure , To achieve the ideal p( Generate )=p( real ), here D And G Can't be further optimized !D(x)=1/2. We can 't continue to study after our generation model is matched with the source data ( Because the constant line y = 1/2 Guidance is always for 0).
( Here's the picture a,b,c,d Shown )
(4)GAN Characteristics :
● Compared with the traditional model , He has two different networks , Not a single network , And the training mode is confrontation training .
● GAN in G The gradient update information from the discriminator D, Not from data samples .
(5)GAN Advantages and disadvantages :
advantage :
● GAN It's a generative model , Compared with other generation models ( Boltzmann machine and GSNs) Only to spread to , Without the complicated Markov chain ;
● Compared to all the other models , GAN Can produce clearer , Real samples ;
● GAN It's an unsupervised way of learning , It can be widely used in unsupervised learning and semi supervised learning ;
● Compared with the variational self encoder , GANs No decisive bias is introduced ( deterministic bias), The variational method introduces decisive bias , Because they optimize the lower bound of log likelihood , Not likelihood itself , This seems to lead to VAES The generated instance ratio GANs More fuzzy ;
● comparison VAE, GANs There is no variation in the lower bound , If the discriminator is well trained , Then the generator can learn the distribution of training samples perfectly . let me put it another way ,GANs It's gradual , however VAE It's biased ;
● GAN Apply to some scenes , For example, image style migration , Super resolution , Image completion , Denoise , The difficulty of loss function design is avoided , It doesn't matter , As long as there is a benchmark , Go straight up to the discriminator , The rest of it is up to counter training .
shortcoming :
● Training GAN Need to reach Nash equilibrium , Sometimes it can be done by gradient descent , Sometimes I can't . We haven't found a good way to reach Nash equilibrium , So training GAN comparison VAE perhaps PixelRNN It's not stable , But I think in practice it is more stable than training the Boltzmann machine
● GAN Not suitable for dealing with discrete data , For example, the text
● GAN There is training instability 、 The gradient disappears 、 The problem of pattern collapse ( At present it has been solved )
Two .DCGAN( Deep convolution network )
introduction :
DCGAN The founding paper of was published in 2015 year , stay GAN On the basis of that, the paper puts forward DCGAN, The main improvement is in the network structure , Stable during training , And can effectively achieve the generation of high-quality pictures and related generation model applications .DCGAN The network structure of the generator is shown in the figure below :
(1) DCGAN Improvement :
● Use step convolution instead of the upper sampling layer , Convolution has a good effect on extracting image features , And use convolution instead of full connection layer ;
● generator G Discriminator D Almost every layer in the batchnorm layer , Normalize the output of the feature layer , Accelerated training , Improved training stability .( The last layer of the generator and the first layer of the discriminator do not add batchnorm);
● Use... In the discriminator leakrelu Activation function , instead of RELU, Prevent gradient thinning , The generator still uses relu, But the output layer uses tanh;
● Use adam Optimizer training , And the best learning rate is 0.0002.( Some experimenters have tried other learning rates , But I have to say 0.0002 It's the best )
● generator G Discriminator D Almost every layer in the batchnorm layer , Normalize the output of the feature layer , Accelerated training , Improved training stability .( The last layer of the generator and the first layer of the discriminator do not add batchnorm)
(2) DCGAN The vector calculation of :
(smiling woman - neutral woman + neutral man = smiling man )
(man with glasses -man +woman = woman with glasses)
Existing problems :DCGAN Although there is a good architecture , But yes. GAN In terms of training stability, there is no cure , No fundamental solution , And you still need to balance carefully when you train G,D The training process , It's often training a lot , Train another time .
(3) About online DCGAN The implementation of the :
》》》DCGAN To achieve the generation of animation avatars :
》 First of all, we need to use reptiles to crawl a large number of animation pictures ;
》 Our goal is to create anime avatars , So face detection is needed to capture the image ;
》 build tensorflow frame
》 Training , The generated results are as follows :
Epoch0:
Epoch20:
Epoch300:
result : As you can see from the above picture , The first 300 individual Epoch The picture of can almost be fake .
(4) We generate face images :
》 Build and activate a virtual environment
》 Execute the first .py file , Batch conversion of pictures to unified format files , A set folder will be generated , In this directory to generate images that meet the requirements ;
》 Start training , Execute another .py file , Will generate the set folder , Find the trained pictures in this directory .( If the training is terminated for some reason , Execution of the above command will continue training on the original basis )
》 result :
Epoch0:
Epoch25:
Epoch100:
》 result : We use 6400 Face image data set for training ,train200-20000 It's through DCGAN The generation of the figure head , You can see the 1 individual Epoch-train200 It's fuzzy , however train-5000 We can see that there are face generation , and train-20000 You can almost see a clear face !
》DCGAN And my gains :
In practice , The probability of perfect coincidence of generated data and real data in space is very low , In most cases, we can find a perfect discriminator to divide .( One sentence summary , In primitive GAN The problem in is : The better the discriminator , The more serious the generation gradient disappears ) In the back propagation of network training , Gradient update is almost zero , That is, it's hard for the Internet to learn from this process .
And for DCGAN Training for 1,10,25 individual epoch, The gradient of generator optimization drops rapidly . But modifying the gradient function can effectively avoid the problem of gradient disappearance . But what? , As the number of training iterations goes up , The gradient is rising very fast , At the same time, the noise of the curve is also increasing , That is to say, the variance of gradient is also increasing , This can lead to low sample quality .
边栏推荐
- Lvgl8.1 version notes
- Nt68661 screen parameter upgrade-rk3128-start up and upgrade screen parameters yourself
- Introduction and practice of Google or tools for linear programming
- 硬件知識1--原理圖和接口類型(基於百問網硬件操作大全視頻教程)
- 实用卷积相关trick
- ARM架构与编程1--LED闪烁(基于百问网ARM架构与编程教程视频)
- 绿色数据中心“东数西算”全面启动
- Solve Sudoku puzzles with Google or tools
- Rondom总结
- 论文解读:《一种利用二核苷酸One-hot编码器识别水稻基因组中N6甲基腺嘌呤位点的卷积神经网络》
猜你喜欢

时间序列的数据分析(一):主要成分

线性规划之Google OR-Tools 简介与实战

Introduction and practice of Google or tools for linear programming

Notes | Baidu flying plasma AI talent Creation Camp: detailed explanation of deep learning model training and key parameter tuning

Development and deployment of steel defect detection using paddlex yolov3 of propeller

Use pyod to detect outliers

Use steps of Charles' packet capturing

ARM架构与编程1--LED闪烁(基于百问网ARM架构与编程教程视频)

Analyze the pre integration of vio with less rigorous but logical mathematical theory

论文解读:《基于预先训练的DNA载体和注意机制识别增强子-启动子与神经网络的相互作用》
随机推荐
Solution to schema verification failure in saving substantive examination request
What technologies are used in pharmaceutical research and development in the field of life sciences? Cryoelectron microscope? Molecular simulation? IND?
for循环
2021可信隐私计算高峰论坛暨数据安全产业峰会上百家争鸣
利用pycaret:低代码,自动化机器学习框架解决分类问题
Ninja startup process
ARM架构与编程5--gcc与Makefile(基于百问网ARM架构与编程教程视频)
NLP自然语言处理-机器学习和自然语言处理介绍(二)
Interpretation of yolov3 key code
Linked list related interview questions
Practical convolution correlation trick
使用PyOD来进行异常值检测
“東數西算”下數據中心的液冷GPU服務器如何發展?
Find the sum of numbers between 1 and 100 that cannot be divided by 3
硬件知識1--原理圖和接口類型(基於百問網硬件操作大全視頻教程)
使用pycaret来进行数据挖掘:关联规则挖掘
Check the sandbox file in the real app
Compile Ninja with makefile
3D image classification of lung CT scan using propeller
Static linked list