May need update on page 384 #115
baifanhorst
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There seems to be a change in torchvision.transforms:
Starting from version 0.17, the default value of the antialias parameter of all the resizing transforms in torchvision.transforms will change from None to True.
Therefore, the transform object defined on page 384 may be changed as:
transform = transforms.Compose([
transforms.ToTensor(),
transforms.Resize((img_height, img_width), antialias=True),
])
Otherwise, there will be a warning:
"C:\Users\username\anaconda3\lib\site-packages\torchvision\transforms\functional.py:1603: UserWarning: The default value of the antialias parameter of all the resizing transforms (Resize(), RandomResizedCrop(), etc.) will change from None to True in v0.17, in order to be consistent across the PIL and Tensor backends. To suppress this warning, directly pass antialias=True (recommended, future default), antialias=None (current default, which means False for Tensors and True for PIL), or antialias=False (only works on Tensors - PIL will still use antialiasing). This also applies if you are using the inference transforms from the models weights: update the call to weights.transforms(antialias=True).
warnings.warn("
Also, there may be another warning related to the transformation:
"Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers)."
This is because after transformation some RGB channel values fall outside [0, 1]. In my case, the maximum RGB channel value is 1.0000002, which is why I received the above warning. But this is a minor issue and the images are still correctly displayed,
Beta Was this translation helpful? Give feedback.
All reactions