elvisyjlin / AttGAN-PyTorch

AttGAN PyTorch Arbitrary Facial Attribute Editing: Only Change What You Want
MIT License
248 stars 61 forks source link

what are shortcut_layers and inject_layers in generator layer #28

Open Sepideh-Rezaeirad opened 3 years ago

Sepideh-Rezaeirad commented 3 years ago

Hi,

Many thanks for providing your code publicly. Could you please explain what are shortcut_layers and inject_layers in generator?

Thank you.

elvisyjlin commented 3 years ago

Briefly speaking, shortcut layers pass the information from encoder layers to decoder layers. Since the AttGAN generator, which is composed of an encoder and a decoder, is a U-Net structure, the corresponding layers in the encoder and the decoder has the same dimension and information can be passed between them.

Injection layers, on the other hand, inform the intermediate layers of the decoder about the target attributes. Traditional condition GAN's generator gets the target attributes at the beginning layer. The information will somehow lose when they fly through the whole network. Telling intermediate decoder layers target attributes encourage they to translate the image toward the them.

If you'd like to read more, please refer to the paper.

daizigege commented 2 years ago

1、but why you contact 1024 with 512(1024+512=1536), not contact 512 with 512(512+512=1024).. Don't their dimensions need to be commen?

2、And you set injection layers equal to 0, is that to say it get a good performance and attrubute information doesn`t lose ?