imlixinyang / HiSD

Code for "Image-to-image Translation via Hierarchical Style Disentanglement" (CVPR 2021 Oral).
Other
391 stars 49 forks source link

The visualization in easy_use.ipynb notebook #8

Closed HymEric closed 3 years ago

HymEric commented 3 years ago

Is this right? image

imlixinyang commented 3 years ago

Sorry for that. This is because of the missed clamp function when converting the tensor into PIL image. I can not test this notebook on my own machine, so could you tell me if the latest version can get the right outputs?

HymEric commented 3 years ago

It not works with output = (x_trg.squeeze(0).cpu().permute(1, 2, 0).add(1).mul(255/2)).clamp(0,255).detach().numpy().astype(np.int8)

imlixinyang commented 3 years ago

It seems like float between [0,1] also works. Could you pull and try again?

HymEric commented 3 years ago

There are negative numbers like -100 in the output image matrix even with clamp(0,255)

imlixinyang commented 3 years ago

Use output = x_trg.squeeze(0).cpu().permute(1, 2, 0).add(1).mul(1/2).clamp(0,1).numpy() instead. There may be something wrong when converting the image into np.int8.

HymEric commented 3 years ago

You are right. Thank you!

imlixinyang commented 3 years ago

You're welcomed. I'm sorry that I can not test the script myself so thank you to tell me this bug, too!