本文主要是介绍李宏毅GAN学习笔记(01),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
GAN Lecture 1
Yann LeCun: Adversarial training is the coolest thing since sliced bread.
Outline
- Basic Idea of GAN
- GAN as Structured Learning
- Can Generator Learn by Itself?
- Can Discriminator Generate?
- A Little Bit Theory
Basic Idea of GAN
Generation
Generation: it is a neural network or a function.
input vector: each dimension of input vector represents some characterstics.
Discriminator
Discriminator: it is a neural network or a function.
output scalar: large value means real, smaller value means fake.
GAN Algorithm
-
Initialize generator and discriminator
-
In each training iteration:
Step 1: fix generator G, and update discriminator D
Step 2: fix discriminator D, and update generator G
Initialize θ d \theta_d θd for D and θ g \theta_g θg for G
-
In each training iteration:
- Sample m examples { x 1 , x 2 , … , x m } \{ x^1, x^2, \dots, x^m \} {x1,x2,…,xm} from database
- Sample m noise samples { z 1 , z 2 , … , z m } \{ z^1, z^2, \dots, z^m \} {z1,z2,…,zm} from a distrubution
- Obtaining generated data { x ~ 1 , x ~ 2 , … , x ~ m } ,   x ~ i = G ( z i ) \{ \widetilde{x}^1, \widetilde{x}^2, \dots, \widetilde{x}^m \}, \, \widetilde{x}^i=G(z^i) {x 1,x 2,…,x m},x i=G(zi)
- Update discriminator parameters θ d \theta_d θd to maximize
- V ~ = 1 m ∑ i = 1 m l o g D ( x i ) + 1 m ∑ i = 1 m l o g ( 1 − D ( x ~ i ) ) \widetilde{V}=\frac{1}{m}\sum^m_{i=1}logD(x^i)+\frac{1}{m}\sum^m_{i=1}log(1-D(\widetilde{x}^i)) V =m1∑i=1mlogD(xi)+m1∑i=1mlog(1−D(x i))
- θ d ← θ d + η ▽ V ~ ( θ d ) \theta_d \gets \theta_d+\eta\bigtriangledown_{\widetilde{V}(\theta_d)} θd←θd+η▽V (θd)
Learning D
- Sample m noise samples { z 1 , z 2 , … , z m } \{z^1, z^2, \dots, z^m \} {z1,z2,…,zm} from a distribution
- Update generator parameters θ g \theta_g θg to maxmize
- V ~ = 1 m ∑ i = 1 m l o g ( D ( G ( z i ) ) ) \widetilde{V}=\frac{1}{m}\sum_{i=1}^mlog(D(G(z^i))) V =m1∑i=1mlog(D(G(zi)))
- θ g ← θ g + η ▽ V ~ ( θ g ) \theta_g\gets\theta_g+\eta\bigtriangledown_{\widetilde{V}(\theta_g)} θg←θg+η▽V (θg)
Learning G
GAN as Structured Learning
Structured Learning Approach
-
Bottom Up: Learn to generate the object at the component level
缺乏大局观
-
Top Down: Evaluating the whole object, and find the best one
B o t t o m    U p + T o p    D o w n ⇒ G A N Bottom \; Up + Top \; Down \Rightarrow GAN BottomUp+TopDown⇒GAN
Can Generator Learn by Itself?
若使用Auto-Encoder技术作为Generator,那么需要更深的网络结构。
Can Discriminator Generate?
Discriminator – Training
- General Algorithm
- Given a set of positive example, randomly generate a set of negative examples.
- In each iteration
- Learn a discriminator D that can discriminate positive and negative examples.
- Generate negative examples by discriminator D: x ~ = a r g m a x x ∈ X D ( x ) \widetilde{x}=arg max_{x\in X}D(x) x =argmaxx∈XD(x)
Generator v.s. Discriminator
- Generator
- Pros:
- Easy to generate even with deep model.
- Cons:
- Imitate the appearance.
- Hard to learn the correlation between components.
- Pros:
- Discriminator
- Pros:
- Considering the big picture.
- Cons:
- Generation is not always feasible, especially when your model is deep.
- How to do negative sampling?
- Pros:
Discriminator + Generator – Training
- General Algorithm
- Given a set of positive example, randomly generate a set of negative examples.
- In each iteration
- Learn a discriminator D that can discriminate positive and negative examples.
- Generate negative examples by discriminator D: x ~ = a r g m a x x ∈ X D ( x )   ⇔   G → x ~ \widetilde{x}=arg max_{x\in X}D(x) \,\Leftrightarrow\, G\to\widetilde{x} x =argmaxx∈XD(x)⇔G→x
这篇关于李宏毅GAN学习笔记(01)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!