Skip to content

Instantly share code, notes, and snippets.

@johnolafenwa
Last active May 8, 2018 19:16
Show Gist options
  • Save johnolafenwa/143621c1814db95dd1267617a667a0da to your computer and use it in GitHub Desktop.
Save johnolafenwa/143621c1814db95dd1267617a667a0da to your computer and use it in GitHub Desktop.
#Define transformations for the training set, flip the images randomly, crop out and apply mean and std normalization
train_transformations = transforms.Compose([
transforms.RandomHorizontalFlip(),
transforms.RandomCrop(32,padding=4),
transforms.ToTensor(),
transforms.Normalize((0.5,0.5,0.5), (0.5,0.5,0.5))
])
#Load the training set
train_set =CIFAR10(root="./data",train=True,transform=train_transformations,download=True)
#Create a loder for the training set
train_loader = DataLoader(train_set,batch_size=32,shuffle=True,num_workers=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment