I’m looking to resize the MNIST dataset to a 8x8 image, and then resize the 8x8 image, back to its original dimensions. During this process, the image should lose quality (since we are resizing from 8x8 to 28x28.
Currently, the code is as follows
dataset = torchvision.datasets.MNIST('./', train=True, download=False, transform=torchvision.transforms.Compose([ torchvision.transforms.Resize(8) ])) upscale = transforms.Compose([transforms.Resize(28)]) pil, label = dataset #Take first image in dataset result = upscale(pil) result.show()
But this does not save the result into the MNIST object (i.e. the variable named "dataset’). I would also need a nasty for loop to loop through all the images.
Is there a better way to accomplish this?