GAN史上最全基础入门总结

本文是GAN(生成对抗网络)的全面入门总结,涵盖GAN的动机、基本原理、评估方法、发展历程及应用。从原始GAN到DCGAN、WGAN、SN-GAN等改进版,深入探讨了GAN的训练技巧、模式塌陷问题及其解决方案。此外,还讨论了条件生成如CycleGAN和无监督特征提取方法如InfoGAN。

阅读提醒:中英文混杂

1. Introduction to GAN

1.1 Motivation

Generative models:

  • explicit models: Likelihood-based models ( autoregressive and flows/VAE)

  • implicit models: sample z → sample x, learning the deep neural network without explicit density estimation

1.2 GAN (original GAN) [Goodfellow, NIPS, 2014]

G captures the data distribution, D estimates the divergence between p d a t a p_{data} pdata and p G p_G pG.
m i n G m a x D V ( G , D ) V ( G , D ) = E x ∼ p d a t a [ log ⁡ D ( x ) ] + E z ∼ p z [ log ⁡ ( 1 − D ( G ( z ) ) ) ] min_Gmax_D V(G,D) \\ V(G,D) = \mathbb{E}_{x\sim p_{data}}[\log D(x)] + \mathbb{E}_{z\sim p_{z}}[\log (1-D(G(z)))] minGmaxDV(G,D)V(G,D)=Expdata[logD(x)]+Ezpz[log(1D(G(z)))]
D尽力区别原始数据与生成数据的区别,形成一个二分类器;G给D提供负样本,并且尽力期骗D使D犯错。

gan

# last layer of D is nn.Sigmoid()
criterion=nn.BCELoss()
# Discriminator
f_loss = criterion(netD(fake_img.detach()), f_l)
r_loss = criterion(netD(real_img.detach()), r_l)
D_loss = (f_loss+r_loss)/2
# Generator
G_loss = criterion(netD(fake_img), r_l)  # 注意用的是real的label
Limitations:
  • unstable convergence
  • vanishing gradient
  • more collapse

1.3 Evaluation

Parzen-Window density estimator (Kernel density estimator)
  • 只适用于低维
  • could be unreliable
Inception Score (IS)

I S ( x ) = exp ⁡ ( H ( y ) − H ( y ∣ x ) ) IS(x) = \exp(H(y)-H(y|x)) IS(x)=exp(H(y)H(yx))

  • IS 越大越好:希望 H ( y ) H(y) H(y)越大越好,表明生成图片的种类越多;希望 H ( y ∣ x ) H(y|x) H(yx)越小越好,表明生成图片 x x x后其类别确定,即能够产生被分类的real image.
  • IS 没有充分度量diversity
Frechet Inception Distance (FID)
  • FID 越小越好

1.4 GAN theory

1.4.1 Bayes-Optimal Discriminator

用D衡量divergence,小的divergence是使discriminator很难分辨的东西,这个divergence不必显示表达,而是用一个NN来实现,这个NN就是D。
D ∗ = a r g m a x D V ( G , D ) D ∗ ( x ) = p d a t a ( x ) p d a t a ( x ) + p G ( x ) m a x V ( G , D ) = V ( G , D ∗ ) = − 2 log ⁡ 2 + 2 J S D ( p d a t a ∣ ∣ p G ) G ∗ = a r g m i n G m a x D V ( G , D ) = a r g m i n G D i v ( p G , p d a t a ) D^*=argmax_DV(G,D) \\ D^*(x) = \frac{p_{data}(x)}{p_{data}(x)+p_{G}(x)}\\ max V(G,D) = V(G,D^*)=-2\log2+2JSD(p_{data}||p_G) \\ G^*=argmin_Gmax_D V(G,D) = argmin_G Div(p_G,p_{data}) D=ar

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值