diff --git a/alodataset/transforms.py b/alodataset/transforms.py index 4adcf402..50a58d1a 100644 --- a/alodataset/transforms.py +++ b/alodataset/transforms.py @@ -587,7 +587,7 @@ def apply(self, frame: Frame): class RealisticNoise(AloTransform): - def __init__(self, gaussian_std: float = 0.02, shot_std: float = 0.2, *args, **kwargs): + def __init__(self, gaussian_std: float = 0.02, shot_std: float = 0.05, same_on_sequence=False, *args, **kwargs): """Add an approximation of a realistic noise to the image. More precisely, we add a gaussian noise and a shot noise to the image. @@ -606,10 +606,7 @@ def __init__(self, gaussian_std: float = 0.02, shot_std: float = 0.2, *args, **k """ self.gaussian_std = gaussian_std self.shot_std = shot_std - super().__init__(*args, **kwargs) - assert ( - not self.same_on_sequence and not self.same_on_frames - ), "Noise should be different for all images at all time steps" + super().__init__(*args, same_on_sequence=same_on_sequence, **kwargs) def sample_params(self): """No parameters to sample""" @@ -664,7 +661,7 @@ def sample_params(self): def apply(self, frame: Frame): assert frame.normalization == "01", "frame should be normalized between 0 and 1 before color modification" - frame = frame ** self.gamma + frame = frame**self.gamma frame = frame * self.brightness # change color by applying different coefficients to R, G, and B channels C = frame.shape[frame.names.index("C")]