李宏毅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

image_1d6ver5ijgik1qb19iq17aff3v1p.png-170.4kB

Generation: it is a neural network or a function.

image_1d6vf27p01uo3b0mek2jbn0i26.png-82.2kB

input vector: each dimension of input vector represents some characterstics.

image_1d6vfd5e41soj7q8oug1ivqoqf3j.png-211.7kB

Discriminator

Discriminator: it is a neural network or a function.

image_1d6vffv2b1hdqc7t1ds919m61vsh40.png-116.8kB

output scalar: large value means real, smaller value means fake.

image_1d71d0nln1pln1b6jukgvuq1bb39.png-154.5kB

GAN Algorithm


  • Initialize generator and discriminator

  • In each training iteration:

    Step 1: fix generator G, and update discriminator D
    image_1d71dmph567nq9h1pip1css537m.png-270.6kB

    Step 2: fix discriminator D, and update generator G
    image_1d71dvcq1358qop1nhobvj13vq26.png-183.7kB


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 =m1i=1mlogD(xi)+m1i=1mlog(1D(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 =m1i=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

image_1d71g9i98v8b675smdq7f142633.png-208.8kB

image_1d71gfn38r1f4s1cvl1a2v1im13g.png-205kB

image_1d71gij86ogcvot1res1hfeodk3t.png-256kB

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+TopDownGAN

image_1d71gl4dtnc11ckqeij1smcsh14a.png-172.4kB

Can Generator Learn by Itself?

image_1d71i9fpaf251pn14dg1u94c634n.png-307.2kB

image_1d71ish3fov11j182oo133qf754.png-359.9kB

若使用Auto-Encoder技术作为Generator,那么需要更深的网络结构。

Can Discriminator Generate?

image_1d71j8v7h145mpgrqb9ot3voa5u.png-258.8kB

image_1d71jbs62f8r1aq64qg18fcpp66r.png-214.5kB

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 =argmaxxXD(x)

image_1d71jps1ihgi3s41lfu1cema6j78.png-286.2kB

Generator v.s. Discriminator

  • Generator
    • Pros:
      • Easy to generate even with deep model.
    • Cons:
      • Imitate the appearance.
      • Hard to learn the correlation between components.

  • Discriminator
    • Pros:
      • Considering the big picture.
    • Cons:
      • Generation is not always feasible, especially when your model is deep.
      • How to do negative sampling?

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 =argmaxxXD(x)Gx

image_1d71jvp5n12gj1jm315hk1upp1u1t7l.png-302kB

image_1d71k1iotr2k1ansvgl6gg1dcf82.png-190.8kB

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值