I am performing transforms an images for a dog classifier and I am getting an error. Here is the code and the error I am getting:
import os
from torchvision import datasets
from torchvision import datasets
from PIL import ImageFile
TODO: Write data loaders for training, validation, and test sets
ImageFile.LOAD_TRUNCATED_IMAGES = True
number of subprocesses to use for data loading
num_workers = 0
batch_sizes
batch_size = 20
Specify appropriate transforms, and
transforms ={
'train' : transforms.Compose([transforms.Resize(256),
                              transforms.RandomResizedCrop(224),
                              transforms.RandomHorizontalFlip(),
                              transforms.RandomRotation(10),
                              transforms.RandomVerticalFlip(),
                              transforms.ToTensor(),
                              transforms.Normalize(mean=[0.485, 0.456, 0.406],
                                                  std=[0.229,0.224,0.225])]),
                              
'valid' : transforms.Compose([transforms.Resize(256),
                              transforms.RandomResizedCrop(224),
                              transforms.RandomHorizontalFlip(),
                              transforms.RandomRotation(10),
                              transforms.RandomVerticalFlip(),
                              transforms.ToTensor(),
                              transforms.Normalize(mean=[0.485, 0.456, 0.406],
                                                  std=[0.229,0.224,0.225])]),
                              
'test' : transforms.Compose([transforms.Resize(256),
                              transforms.RandomResizedCrop(224),
                              transforms.RandomHorizontalFlip(),
                              transforms.RandomRotation(10),
                              transforms.RandomVerticalFlip(),
                              transforms.ToTensor(),
                              transforms.Normalize(mean=[0.485, 0.456, 0.406],
                                                  std=[0.229,0.224,0.225])])

}
Image_datasets = {x: datasets.ImageFolder(os.path.join(‘dogImages’,y),transforms[xy])
for x in[‘train’, ‘valid’,‘test’]}
data_loaders = {x: torch.utils.data.DataLoader(Image_datasets, batch_size=batch_size, shuffle=True,
num_workers=num_workers)
for x in[‘train’, ‘valid’,‘test’]}
Error:
                             ---------------------------------------------------------------------------

AttributeError                            Traceback (most recent call last)
 in 
15 transforms ={
16
—> 17     ‘train’ : transforms.Compose([transforms.Resize(256),
18                                   transforms.RandomResizedCrop(224),
19                                   transforms.RandomHorizontalFlip(),
AttributeError: ‘dict’ object has no attribute ‘Compose’