首页 > 编程语言 >tensorflow2从入门到精通——DCGAN算法实现

tensorflow2从入门到精通——DCGAN算法实现

时间:2022-11-01 18:37:59浏览次数:45  
标签:tensorflow2 layers 入门 self LeakyReLU same padding strides DCGAN


class DCGAN(tf.keras.Model):
def __init__(self):
super(DCGAN,self).__init__()
self.Generator = tf.keras.models.Sequential([ #生成器网络
layers.Dense(7*7*256),
layers.BatchNormalization(),
layers.LeakyReLU(),
layers.Reshape((7,7,256)),
layers.Conv2DTranspose(128, (5, 5), strides=(1, 1), padding='same'),
layers.BatchNormalization(),
layers.LeakyReLU(),
layers.Conv2DTranspose(64, (5, 5), strides=(2, 2), padding='same'),
layers.BatchNormalization(),
layers.LeakyReLU(),
layers.Conv2DTranspose(1, (5, 5), strides=(2, 2), padding='same',activation='tanh'),
])
self.Discriminator = tf.keras.models.Sequential([ #判别器网络
layers.Conv2D(64,(5,5),strides=(2,2),padding='same'),
layers.LeakyReLU(),
layers.Conv2D(128, (5, 5), strides=(2, 2), padding='same'),
layers.LeakyReLU(),
layers.Flatten(),
layers.Dense(1)
])


标签:tensorflow2,layers,入门,self,LeakyReLU,same,padding,strides,DCGAN
From: https://blog.51cto.com/u_13859040/5814671

相关文章