I’m loading images into a dataset
class. However, when using torchvision’s transforms
functions, it seems to be rotating the images 90 degrees counterclockwise. Is there a reason for this, and a way to prevent it?
transform = transforms.Compose([transforms.Resize([256, 256]),
transforms.RandomCrop(224),
transforms.ToTensor()])
train_dataset = Images(data_path, transform, 'train')
class Images(data.Dataset):
def __init__(self, data_path, transform, mode):
self.examples, self.labels = make_dataset(data_path, mode)
self.transform = transform
def __getitem__(self, idx):
example = self.examples[idx]
this_img = Image.open(example)
this_img.load()
if self.transform:
this_img = self.transform(this_img)
When I debug and print this_img
at this point, it appears rotated. How can I prevent this? Thanks!