Skip to content

Commit

Permalink
Merge pull request #7 (Augmentation bug fix) from olivesgatech/develop
Browse files Browse the repository at this point in the history
Augmentation bug fix
  • Loading branch information
yalaudah authored Apr 3, 2019
2 parents 2f6d85f + 01e10c0 commit 0d4ff25
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions core/augmentations.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,15 @@ def __call__(self, img, mask):
class RandomHorizontallyFlip(object):
def __call__(self, img, mask):
if random.random() < 0.5:
return img.transpose(Image.FLIP_LEFT_RIGHT), mask.transpose(Image.FLIP_LEFT_RIGHT)
#Note: we use FLIP_TOP_BOTTOM here intentionaly. Due to the dimensions of the image,
# it ends up being a horizontal flip.
return img.transpose(Image.FLIP_TOP_BOTTOM), mask.transpose(Image.FLIP_TOP_BOTTOM)
return img, mask

class RandomVerticallyFlip(object):
def __call__(self, img, mask):
if random.random() < 0.5:
return img.transpose(Image.FLIP_TOP_BOTTOM), mask.transpose(Image.FLIP_TOP_BOTTOM)
return img.transpose(Image.FLIP_LEFT_RIGHT), mask.transpose(Image.FLIP_LEFT_RIGHT)
return img, mask

class FreeScale(object):
Expand Down
2 changes: 1 addition & 1 deletion patch_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def train(args):
# Setup Augmentations
if args.aug:
data_aug = Compose(
[RandomRotate(30), RandomHorizontallyFlip(), AddNoise()])
[RandomRotate(10), RandomHorizontallyFlip(), AddNoise()])
else:
data_aug = None

Expand Down
2 changes: 1 addition & 1 deletion section_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def train(args):
# Setup Augmentations
if args.aug:
data_aug = Compose(
[RandomRotate(25), RandomHorizontallyFlip(), AddNoise()])
[RandomRotate(10), RandomHorizontallyFlip(), AddNoise()])
else:
data_aug = None

Expand Down

0 comments on commit 0d4ff25

Please sign in to comment.