LynnHo / AttGAN-Tensorflow

AttGAN: Facial Attribute Editing by Only Changing What You Want (IEEE TIP 2019)
MIT License
603 stars 133 forks source link

Label range in training phase and testing phase inconsistent #9

Closed CharlesNord closed 5 years ago

CharlesNord commented 5 years ago

from line 256 to line 258 of train.py : _b_sample_ipt = (b_sample_ipt 2 - 1) thres_int if i > 0: # i == 0 is for reconstruction _b_sample_ipt[..., i - 1] = _b_sample_ipt[..., i - 1] * test_int / thres_int

In default setting, test_int is 1 and thres_int is 0.5 , it seems that you first scaled the labels to [-0.5 , 0.5] . Then you scaled them by test_int/thres_int, so they are [-1, 1] again. It's not consistent with the label range you used for training (i.e. -0.5, 0.5), is this a trick to enhance the feature you want to change ? or it's just a bug?

LynnHo commented 5 years ago

@CharlesNord It's not a bug. Although we train the network with the input attribute code in {-0.5, 0.5}, we find the network can generalize to the code in range of (-z, z), z > 0.5. Therefore, any y in (-z, z) can be viewed as the intensity of the attribute, and test_int = 1 aims for enhancing the attribute as you said.