mingyuliutw / UNIT

Unsupervised Image-to-Image Translation
Other
1.98k stars 360 forks source link

What are the values in the normalized x and y coordinates in SVHN -> MNIST model? #39

Closed hsm207 closed 6 years ago

hsm207 commented 6 years ago

In Appendix B, in the paragraph about SVHN -> MNIST, it is written:

For each input image, we created a 5-channel variant where the first three channels were the original RGB images and the last two channels were the normalized x and y coordinates.

It seems to me that this is implement in cocogan_trainer_da.py:

  def _create_xy_image(self, width=32):
    coordinates = list(itertools.product(range(width), range(width)))
    arr = (np.reshape(np.asarray(coordinates), newshape=[width, width, 2]) - width/2 ) / (width/2)
    new_map = np.transpose(np.float32(arr), [2, 0, 1])
    xy = Variable(torch.from_numpy(new_map), requires_grad=False)
    return xy

The way the code is written, the contents of xy is just -1 or 0 because the environment is Python 2. Did you mean to do this? I thought the values should be between -1 and 1.

mingyuliutw commented 6 years ago

Thanks for reporting. This is a bug. The xy image should be in [-1 1]. I have pushed the update.