elvisyjlin / AttGAN-PyTorch

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

What's the meaning of inject_int and thres_int? #19

Open Ksky001 opened 4 years ago

Ksky001 commented 4 years ago

why use extra attra and attrb for attr_a and attr_b?

elvisyjlin commented 4 years ago

The decoder of the generator takes a latent space tensor and a conditional attribute as its inputs. The attributes in CelebA dataset are 0 and 1. But we surmise that it would be better to have symmetric inputs like what we usually do to the images for GANs. We always normalize an images to (-1, 1) when doing the generative stuffs.

This line att_a_ = (att_a * 2 - 1) * thres_int has the same effect. The thres_int is the threshold intensity playing a role of a scaling factor. It is 0.5 by default. So the attributes, which are 0s and 1s, are hence normalized as (-0.5, 0.5).

Please let me know if you have any other questions.