Skip to content

Instantly share code, notes, and snippets.

@keshik6
Created March 20, 2019 15:45
Show Gist options
  • Save keshik6/0e893746c817c0bcada83cddcb03f418 to your computer and use it in GitHub Desktop.
Save keshik6/0e893746c817c0bcada83cddcb03f418 to your computer and use it in GitHub Desktop.
Train time Transformations for pascal VOC
# This is for model 1
transformations = transforms.Compose([transforms.Resize(330),
transforms.RandomChoice([
transforms.CenterCrop(300),
transforms.RandomResizedCrop(300, scale=(0.80, 1.0)),
]),
transforms.RandomChoice([
transforms.ColorJitter(brightness=(0.80, 1.20)),
transforms.RandomGrayscale(p = 0.25)
]),
transforms.RandomHorizontalFlip(p = 0.25),
transforms.RandomRotation(25),
transforms.ToTensor(),
transforms.Normalize(mean = mean, std = std),
])
# This is for model 2
transformations = transforms.Compose([transforms.Resize((300, 300)),
transforms.RandomChoice([
transforms.ColorJitter(brightness=(0.80, 1.20)),
transforms.RandomGrayscale(p = 0.25)
]),
transforms.RandomHorizontalFlip(p = 0.25),
transforms.RandomRotation(25),
transforms.ToTensor(),
transforms.Normalize(mean = mean, std = std),
])
# The purpose of model 1 was to add noise labels during training to see whether the model becomes robust.
# The rest of the comman augmentations are for robustness as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment