Similarities between the Generator and the Discriminator

Hello everyone,

I had a question regarding the building of both the Discriminator and Generator architectures.

Simply, should the architecture of one be the symmetry of the other ? In the GAN courses, we have both G and D being mirrored, one with convolutions and the other with transposed convolution.

Is that a requirement ?

PS: I don’t understand what should be the shape of the output of the generator to make it efficient.

Edit: Pressed send too fast :sweat_smile:

Ya we need to make generator and discriminator both mirror because the gans could improve itself by knowing whats real and whats wrong and if both of them aren’t symmetrical then there would be a distinction on the generated images and gan couldn’t learn from it

The reason behind the generator and the discriminator having symmetric architecture is just that the two networks should be equally powerful. We do not want any of them to go out of the competition as this will put a halt to the learning of the generator. We just want them to always stay at the same or approximately the same level in order to get our generator to get useful input from the discriminator.

It is not necessary to have symmetric architecture unless you can have an architecture that will keep them (generator and discriminator) in competition. But usually, as symmetric architecture can accomplish this requirement, the generator and discriminator have symmetric architectures.

Hope this helps :blush:

1 Like

Hi @Barb ,

The architecture of G and D no need to be symmetry to each other. You can have different architecture for them.

If you want to train the G and D by input an image to G and expect the D will recover the image, you will need to make sure the size of input and output met your expectation.

2 Likes

@Khushwanth @chinmay-d @jiaqing2303 Thanks for your answers.

Something I still don’t understand is, why (or how ?) does the shape of the discriminator’s output matter.

I clearly understand that the role of the D is to tell the percentage of this is fake or not.

But then, shouldn’t be the shape a 1x1 ?

Thank you all gain :slight_smile:

1 Like

@Barb

To add to the point of others, the architecture between generator and discriminator can vary a lot based on the domain.

For example, in LayoutGAN, they use wireframe rendering discriminators, here they rasterize image on the fly in discriminator and then use CNN to reduce it further to check real/fakeness of the generated wireframe points.

The output of D to estimate real/fake likelihood does matter just for the estimation function.

@vinothpandian

I think I understand the architecture point.

@vvvin333 Yes but how does the shape matter ? This is what I can wrap my head around.

It does not matter, I think. As you can see in the simple sample here
https://www.geeksforgeeks.org/generative-adversarial-network-gan/
output is a (0-1) number from sigmoid function, so you can use any of appropriate estimation function.

пт, 10 сент. 2021 г., 10:53 Fabien Charmet via DeepLearning.AI <dlai@discoursemail.com>: