PyTorch-AdaIN-StyleTransfer icon indicating copy to clipboard operation
PyTorch-AdaIN-StyleTransfer copied to clipboard

Why Test result has red spot?

Open ymzlygw opened this issue 4 years ago • 1 comments

Hi, First thanks for your Implement for AdaIn. I want to know why I get the following result when I use the 'Style Transfer Test.ipynb'. I used the pretrained mode of vgg and decoder as read.md.

ダウンロード

As you can see, the result image has many red spots and I don't know why, can you explain about it? thanks By the way,I delete following part in processing of network output: "out = torchvision.utils.make_grid(out.clamp(min=-1, max=1), nrow=3, scale_each=True, normalize=True)" And Use: img = toPIL(out[0]) to get the red spotted image And these red parts is the black color in the origin content image. is there some relation?

ymzlygw avatar Feb 24 '21 07:02 ymzlygw

In my opinion, the reason for these red spots may come from that some pixels contain extreme values, such as exactly 1 or -1.

So you can try to remove the 'clamp' operation in the code, like:

"out = torchvision.utils.make_grid(out, nrow=3, scale_each=True, normalize=True)"

This may influence the performance of the model to some extend, but it can avoid the red spots in my case.

Besides, I also suggest you reading the original code at https://github.com/xunhuang1995/AdaIN-style

WendongZh avatar Jun 11 '21 07:06 WendongZh