keras之GAN and wavenet

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

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

1.什么是GAN


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

keras之GAN and wavenet_第1张图片

更多可参照: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

keras之GAN and wavenet_第2张图片

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





你可能感兴趣的:(keras)