我正在使用从此处(本文为纸)创建GAN的代码。我正在尝试将其应用于新领域,从其在MNIST上的应用切换到3D脑MRI图像。我的问题是GAN本身的定义。
例如,他们用于定义生成模型的代码(采用z_dim尺寸的噪声并从MNIST分布生成图像,因此为28x28)就是这样,我的评论基于我的看法:
def generate(self, z):
# start with noise in compact space
assert z.shape[1] == self.z_dim
# Fully connected layer that for some reason expands to latent * 64
output = tflib.ops.linear.Linear('Generator.Input', self.z_dim,
self.latent_dim * 64, z)
output = tf.nn.relu(output)
# Reshape the latent dimension into 4x4 MNIST
output = tf.reshape(output, [-1, self.latent_dim * 4, 4, 4])
# Reduce the latent dimension to get 8x8 MNIST
output = tflib.ops.deconv2d.Deconv2D('Generator.2', self.latent_dim * 4,
self.latent_dim * 2, 5, …Run Code Online (Sandbox Code Playgroud) python conv-neural-network tensorflow niftynet generative-adversarial-network