Hello, I'd been reading and executing your code and noticed that you are using ToTensor transform from torchvision.
I think you need to be aware of it's scaling effects.
Lets break down transform = transforms.Compose([ToTensor(), Normalize(mean=127.5, std=128)])
Assume the intensity of a pixel is 128.
ToTensor converts it to float, BUT ALSO divides it by 255.
So now your intensity is 0.5
Then in Normalize: (0.5 - 127.5) / 128 = -127 / 128 ~ -0.97.
Applying it to other values from range withing [0, 255], we get a range for your intensity in [-0.998, 0.996], which is quiet opposite for what I would consider normalization
The fix is pretty simple, that is to use PILToTensor from the same torchvision, that does not scale your input by 255. Doint that you will get way normal normalization as shown below, in (-1, 1) :)
I will try retraining and benchmarking with better normalization and will submit a pr
Hello, I'd been reading and executing your code and noticed that you are using ToTensor transform from torchvision. I think you need to be aware of it's scaling effects. Lets break down transform = transforms.Compose([ToTensor(), Normalize(mean=127.5, std=128)]) Assume the intensity of a pixel is 128. ToTensor converts it to float, BUT ALSO divides it by 255. So now your intensity is 0.5 Then in Normalize: (0.5 - 127.5) / 128 = -127 / 128 ~ -0.97. Applying it to other values from range withing [0, 255], we get a range for your intensity in [-0.998, 0.996], which is quiet opposite for what I would consider normalization
The fix is pretty simple, that is to use PILToTensor from the same torchvision, that does not scale your input by 255. Doint that you will get way normal normalization as shown below, in (-1, 1) :)
I will try retraining and benchmarking with better normalization and will submit a pr