Created
August 8, 2019 18:51
-
-
Save Lexie88rus/eed4021f1b1194b7753d434d5e0d5696 to your computer and use it in GitHub Desktop.
Augmenter simple example
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
# Import package | |
import Augmentor | |
# Initialize pipeline | |
p = Augmentor.DataPipeline([[np.array(image), np.array(mask)]]) | |
# Apply augmentations | |
p.rotate(1, max_left_rotation=3, max_right_rotation=3) | |
p.shear(1, max_shear_left = 3, max_shear_right = 3) | |
p.zoom_random(1, percentage_area=0.9) | |
# Sample from augmentation pipeline | |
images_aug = p.sample(1) | |
# Access augmented image and mask | |
augmented_image = images_aug[0][0] | |
augmented_mask = images_aug[0][1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment