Skip to content

Instantly share code, notes, and snippets.

@ternaus
Last active July 27, 2020 19:09
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 ternaus/a6a11847e3a1b0da41fc84de85476ef5 to your computer and use it in GitHub Desktop.
Save ternaus/a6a11847e3a1b0da41fc84de85476ef5 to your computer and use it in GitHub Desktop.
For medium. Image+mask
import albumentations as A
transform = A.Compose([
A.HorizontalFlip(p=0.5),
A.ShiftScaleRotate(border_mode=cv2.BORDER_CONSTANT,
scale_limit=0.3,
rotate_limit=(10, 30),
p=0.5)
], p=1)
transformed = transform(image=image, mask=mask)
image_transformed = transformed['image']
mask_transformed = transformed['mask']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment