Created
November 26, 2018 15:44
-
-
Save WillKoehrsen/d5de7d61e9cc2971c5aed1763f6e1ff3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from torchvision import transforms | |
# Image transformations | |
image_transforms = { | |
# Train uses data augmentation | |
'train': | |
transforms.Compose([ | |
transforms.RandomResizedCrop(size=256, scale=(0.8, 1.0)), | |
transforms.RandomRotation(degrees=15), | |
transforms.ColorJitter(), | |
transforms.RandomHorizontalFlip(), | |
transforms.CenterCrop(size=224), # Image net standards | |
transforms.ToTensor(), | |
transforms.Normalize([0.485, 0.456, 0.406], | |
[0.229, 0.224, 0.225]) # Imagenet standards | |
]), | |
# Validation does not use augmentation | |
'valid': | |
transforms.Compose([ | |
transforms.Resize(size=256), | |
transforms.CenterCrop(size=224), | |
transforms.ToTensor(), | |
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]) | |
]), | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment