Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hellojialee opened this issue Oct 19, 2017 · 1 comment
Open

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

hellojialee opened this issue Oct 19, 2017 · 1 comment

Comments

@hellojialee
Copy link

hellojialee commented Oct 19, 2017

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
Copy link
Author

hellojialee commented Oct 20, 2017

Ok, I may have figured out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant