Skip to content

Instantly share code, notes, and snippets.

@pbamotra
Created July 3, 2019 21:00
Show Gist options
  • Save pbamotra/d42366d9ec7a07e2141c7057723dbd6d to your computer and use it in GitHub Desktop.
Save pbamotra/d42366d9ec7a07e2141c7057723dbd6d to your computer and use it in GitHub Desktop.
DALI-Post-1.1
from torchvision import transforms
def get_image_transforms() -> transforms.Compose:
"""
These transformations meant for data augmentation are a bottleneck
since all the operations are done on CPU and then the tensors are
copied to the GPU device.
"""
return transforms.Compose([
transforms.RandomSizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment