Skip to content

Commit

Permalink
fix: avoid lambda in RandomImgAug that prevents DDP
Browse files Browse the repository at this point in the history
  • Loading branch information
beniz committed Jul 24, 2021
1 parent f09d484 commit a206f91
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions data/base_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,17 +484,18 @@ def __call__(self, img, mask):
else:
return img, mask


def sometimes(aug):
return iaa.Sometimes(0.5, aug)

class RandomImgAug():

def __init__(self,with_mask=True):
self.with_mask = with_mask
self.sometimes = lambda aug: iaa.Sometimes(0.5, aug)
self.seq = iaa.Sequential(
[
iaa.SomeOf((0, 5),
[
self.sometimes(iaa.Superpixels(p_replace=(0, 0.5), n_segments=(100, 200))), # convert images into their superpixel representation
sometimes(iaa.Superpixels(p_replace=(0, 0.5), n_segments=(100, 200))), # convert images into their superpixel representation
iaa.OneOf([
iaa.GaussianBlur((0, 3.0)), # blur images with a sigma between 0 and 3.0
iaa.AverageBlur(k=(2, 7)), # blur image using local means with kernel sizes between 2 and 7
Expand Down

0 comments on commit a206f91

Please sign in to comment.