Skip to content

Instantly share code, notes, and snippets.

@MLWhiz
Last active September 7, 2020 16:12
Show Gist options
  • Select an option

  • Save MLWhiz/a55ccd51813ddba17a54aefd98a76ed9 to your computer and use it in GitHub Desktop.

Select an option

Save MLWhiz/a55ccd51813ddba17a54aefd98a76ed9 to your computer and use it in GitHub Desktop.
from torchvision import transforms
from torchvision.datasets import ImageFolder
traindir = "data/train/"
t = transforms.Compose([
transforms.Resize(size=256),
transforms.CenterCrop(size=224),
transforms.ToTensor()])
train_dataset = ImageFolder(root=traindir,transform=t)
print("Num Images in Dataset:", len(train_dataset))
print("Example Image and Label:", train_dataset[2])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment