Closed brando90 closed 2 years ago
Just change the path in the following code to your favorite one.
imagenet = ImageFolder('~/.torch/data/imagenet/val',
transforms.Compose([transforms.CenterCrop(224),transforms.ToTensor(),
transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225))]))
Just change the path in the following code to your favorite one.
imagenet = ImageFolder('~/.torch/data/imagenet/val', transforms.Compose([transforms.CenterCrop(224),transforms.ToTensor(), transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225))]))
but one has to download imagenet...this is better:
transform = transforms.Compose(
[transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])
batch_size = 128
num_workers = 0
trainset = torchvision.datasets.CIFAR10(root='./data', train=True,
download=True, transform=transform)
trainloader = torch.utils.data.DataLoader(trainset, batch_size=batch_size,
shuffle=True, num_workers=num_workers)
testset = torchvision.datasets.CIFAR10(root='./data', train=False,
download=True, transform=transform)
testloader = torch.utils.data.DataLoader(testset, batch_size=batch_size,
shuffle=False, num_workers=num_workers)
classes = ('plane', 'car', 'bird', 'cat',
'deer', 'dog', 'frog', 'horse', 'ship', 'truck')
data = next(iter(trainloader))
Got error:
is it possible to download some data set to test anatome such that it doesn't throw an error?
Perhaps a colab example is better?
a start: https://colab.research.google.com/drive/1GrhWrWFPmlc6kmxc0TJY0Nb6qOBBgjzX?usp=sharing