Skip to content

Instantly share code, notes, and snippets.

@Diyago
Created August 25, 2019 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Diyago/2ae3d14b0307297081fb4456050057ab to your computer and use it in GitHub Desktop.
Save Diyago/2ae3d14b0307297081fb4456050057ab to your computer and use it in GitHub Desktop.
def aug_with_crop(image_size = 256, crop_prob = 1):
return Compose([
RandomCrop(width = image_size, height = image_size, p=crop_prob),
HorizontalFlip(p=0.5),
VerticalFlip(p=0.5),
RandomRotate90(p=0.5),
Transpose(p=0.5),
ShiftScaleRotate(shift_limit=0.01, scale_limit=0.04, rotate_limit=0, p=0.25),
RandomBrightnessContrast(p=0.5),
RandomGamma(p=0.25),
IAAEmboss(p=0.25),
Blur(p=0.01, blur_limit = 3),
OneOf([
ElasticTransform(p=0.5, alpha=120, sigma=120 * 0.05, alpha_affine=120 * 0.03),
GridDistortion(p=0.5),
OpticalDistortion(p=1, distort_limit=2, shift_limit=0.5)
], p=0.8)
], p = 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment