Skip to content

Instantly share code, notes, and snippets.

@alankbi
Last active February 14, 2020 17:35
Show Gist options
  • Save alankbi/b027ebaf6de535c3765ed50b7f6c07ce to your computer and use it in GitHub Desktop.
Save alankbi/b027ebaf6de535c3765ed50b7f6c07ce to your computer and use it in GitHub Desktop.
Data augmentation and DataLoaders with Detecto
from torchvision import transforms
augmentations = transforms.Compose([
transforms.ToPILImage(),
transforms.RandomHorizontalFlip(0.5),
transforms.ColorJitter(saturation=0.5),
transforms.ToTensor(),
utils.normalize_transform(),
])
dataset = core.Dataset('images/', transform=augmentations)
loader = core.DataLoader(dataset, batch_size=2, shuffle=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment