Closed SerezD closed 1 year ago
Hi @SerezD ! Check out examples/cifar/train_cifar.py
-- basically, we never actually bring the images into [0, 1] and instead just normalize them directly with scaled normalization parameters (after converting them to float32 with the Convert
augmentation):
Convert(ch.float16),
torchvision.transforms.Normalize(CIFAR_MEAN, CIFAR_STD),
Feel free to re-open the issue if this doesn't help!
I have noticed that setting up a pipeline like:
results in batches of
torch.uint8
image tensors in range [0 255].I cannot find any way to have batches of images as
torch.float32
and in range [0, 1], like is done intorchvision.transforms.ToTensor
(docs here).As a solution, I have written a custom Transform like the following:
This in practice converts images to float and divides by 255.
Is it the only way to obtain the desired result, or am I missing something?
Is it possible to have a
ToTensor()
transform that operates like the torch counterpart (merging the ToTensor, ToTorchImage, and DivideImage255 operations) in some future release?