-
-
Notifications
You must be signed in to change notification settings - Fork 91
Description
I was running into issues trying to re-create the original paper, and stumbled upon this repository.
I was able to re-create the results when using the caffe pretrained model (which has images in the range of [0, 255]), but had drastically different results when using pytorch's pretrained model (which has images in the range of [0, 1]). I noticed this tidbit of code in your repository:
pytorch-neural-style-transfer/utils/utils.py
Lines 43 to 49 in f5650de
| # normalize using ImageNet's mean | |
| # [0, 255] range worked much better for me than [0, 1] range (even though PyTorch models were trained on latter) | |
| transform = transforms.Compose([ | |
| transforms.ToTensor(), | |
| transforms.Lambda(lambda x: x.mul(255)), | |
| transforms.Normalize(mean=IMAGENET_MEAN_255, std=IMAGENET_STD_NEUTRAL) | |
| ]) |
I applied that same transformation, and got results that are comparable to the original paper. I am somewhat confused about why this works, though. If pytorch's vgg19 is trained on millions of images in the range of [0, 1], wouldn't it just interpret anything above 1 as being pure white?