tomasjakab / imm

Code for unsupervised learning of object landmarks as proposed in "Unsupervised Learning of Object Landmarks through Conditional Image Generation", Tomas Jakab*, Ankush Gupta*, Hakan Bilen, Andrea Vedaldi, Advances in Neural Information Processing Systems (NeurIPS) 2018.
149 stars 25 forks source link

Some questions about the ws value? #8

Closed HuAndrew closed 4 years ago

HuAndrew commented 4 years ago

Hi, Jakab, Ankush, Vedaldi.

Thank your sharing imm work, it's such very amazing work.

When I used PyTorch to reproduce your work, I encountered a problem about the initial value of the moving average in line 131 imm/imm_model.py.

And I am very confused about the origin of this set of values. Can you explain the spark of your design ideas and how to set this ws values?

Because PyTorch uses 0~1 input data to train network models by default, including loss network VGG(offical model).

I tried the tf ws values, but the effect did not meet expectations(mean error about 12 on ALFW, and your result is about 6.834 )

ws = [100.0, 1.6, 2.3, 1.8, 2.8, 100.0]
f_e = tf.square if self._config.perceptual.l2 else tf.abs

if loss_mask is None:
    loss_mask = lambda x: x

losses = []
n_feats = len(feats)
# n_feats = 3
# wl = [self._exp_running_avg(losses[k], training_pl, init_val=ws[k], name=names[k]) for k in range(n_feats)]

for k in range(n_feats):
    l = f_e(feat_gt[k] - feat_pred[k])
    wl = self._exp_running_avg(tf.reduce_mean(loss_mask(l)), training_pl, init_val=ws[k], name=names[k])
    l /= wl

    l = tf.reduce_mean(loss_mask(l))
    losses.append(l)
tomasjakab commented 4 years ago

Hi Andrew!

The ws weights are based on the ones used in Photographic Image Synthesis with Cascaded Refinement Networks.

HuAndrew commented 4 years ago

I try it, thank you very much.