SimGAN icon indicating copy to clipboard operation
SimGAN copied to clipboard

Why is the output shape of discriminator is (None, 2)?

Open hellojialee opened this issue 8 years ago • 1 comments

Hi everyone. I'm a green hand in GAN. Seeing the following code:

`def discriminator_network(input_image_tensor): """ The discriminator network, Dφ, contains 5 convolution layers and 2 max-pooling layers.

:param input_image_tensor: Input tensor corresponding to an image, either real or refined.
:return: Output tensor that corresponds to the probability of whether an image is real or refined.
"""
x = layers.Convolution2D(96, 3, 3, border_mode='same', subsample=(2, 2), activation='relu')(input_image_tensor)
x = layers.Convolution2D(64, 3, 3, border_mode='same', subsample=(2, 2), activation='relu')(x)
x = layers.MaxPooling2D(pool_size=(3, 3), border_mode='same', strides=(1, 1))(x)
x = layers.Convolution2D(32, 3, 3, border_mode='same', subsample=(1, 1), activation='relu')(x)
x = layers.Convolution2D(32, 1, 1, border_mode='same', subsample=(1, 1), activation='relu')(x)
x = layers.Convolution2D(2, 1, 1, border_mode='same', subsample=(1, 1), activation='relu')(x)

# here one feature map corresponds to `is_real` and the other to `is_refined`,
# and the custom loss function is then `tf.nn.sparse_softmax_cross_entropy_with_logits`
return layers.Reshape((-1, 2))(x)`

How to understand ' here one feature map corresponds to is_real and the other to is_refined'? Usually, the discriminator output only one feature map indicating the confidence probability of true or false.

hellojialee avatar Oct 19 '17 00:10 hellojialee

Ok, I may have figured out.

hellojialee avatar Oct 20 '17 03:10 hellojialee