keras之GAN and wavenet

GAN用于学习怎么生成仿真数据(NIPS 2016 Tutorial: Generative Adversarial Networks, by I.Goodfellow, 2016)

WAVENET是一个深度GAN,用于让电脑生成人声和乐器声。

1.什么是GAN


GAN 主要包括了两个部分,即生成器 generator 与判别器 discriminator。生成器主要用来学习真实图像分布从而让自身生成的图像更加真实,以骗过判别器。判别器则需要对接收的图片进行真假判别。在整个过程中,生成器努力地让生成的图像更加真实,而判别器则努力地去识别出图像的真假,这个过程相当于一个二人博弈,随着时间的推移,生成器和判别器在不断地进行对抗,最终两个网络达到了一个动态均衡:生成器生成的图像接近于真实图像分布,而判别器识别不出真假图像,对于给定图像的预测为真的概率基本接近 0.5(相当于随机猜测类别)。


更多可参照:https://www.leiphone.com/news/201707/1JEkcUZI1leAFq5L.html

2.GAN应用

StackGAN: Text to Photo-Realistic Image Synthesis with Stacked Generative Adversarial Networks, by Han Zhang, Tao Xu, Hongsheng Li, Shaoting Zhang, Xiaolei Huang, Xiaogang Wang, and Dimitris Metaxas(the code is available online at: https://github.com/hanzhanggit/StackGAN )


Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks, by A. Radford, L. Metz, and S. Chintala, arXiv: 1511.06434, 2015) used for the generator and the discriminator networks

Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks,by A.Radford, L. Metz, and S. Chintala, arXiv

3.深度卷及GAN(DCGAN)

论文来源:Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks, by A. Radford, L. Metz, and S. Chintala, arXiv: 1511.06434,2015


https://blog.csdn.net/stdcoutzyx/article/details/53872121

from keras.layers import Dense,BatchNormalization,UpSampling2D
from keras.layers import Conv2D,Activation,Reshape
from keras.models import Sequential

def generator_model():
    model=Sequential()
    model.add(Dense(input_dim=100,output_dim=1024,activation='tanh'))
    model.add(Dense(128*7*7))
    model.add(BatchNormalization())
    model.add(Activation('tanh'))
    model.add(Reshape((128,7,7),input_shape=(128*7*7)))
    model.add(UpSampling2D(size=(2,2)))
    model.add(Conv2D(64,5,5,padding='SAME',activation='tanh'))
    model.add(UpSampling2D(size=(2,2)))
    model.add(Conv2D(1,5,5,padding='SAME',activation='tanh'))
    return model
def	discriminator_model():
    model=Sequential()
    model.add(Convolution2D(64,5,5,border_mode='same',input_shape=(1,28,28)))
    model.add(Activation('tanh'))
    model.add(MaxPooling2D(pool_size=(2,2)))
    model.add(Conv2D(128,5,5))
    model.add(Activation('tanh'))
    model.add(MaxPooling2D(pool_size=(2,	2)))
    model.add(Flatten())
    model.add(Dense(1024))
    model.add(Activation('tanh'))
    model.add(Dense(1))
    model.add(Activation('sigmoid'))
    return model

https://github.com/soumith/ganhacks





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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值