From 25b6e25f969ef0212e6e18afd510cf124440a11d Mon Sep 17 00:00:00 2001 From: Julien Salotti Date: Fri, 1 Jul 2022 17:16:35 +0200 Subject: [PATCH 1/2] RealisticNoise default values --- alodataset/transforms.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/alodataset/transforms.py b/alodataset/transforms.py index 4adcf402..a4eff7cb 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, *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. @@ -607,9 +607,6 @@ 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" 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")] From 93ebd6ac0d66ca97a1b7aee4414fb59fa7d62252 Mon Sep 17 00:00:00 2001 From: Julien Salotti Date: Fri, 15 Jul 2022 16:09:59 +0200 Subject: [PATCH 2/2] set noise same_on_sequence default to false --- alodataset/transforms.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alodataset/transforms.py b/alodataset/transforms.py index a4eff7cb..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.05, *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,7 +606,7 @@ def __init__(self, gaussian_std: float = 0.02, shot_std: float = 0.05, *args, ** """ self.gaussian_std = gaussian_std self.shot_std = shot_std - super().__init__(*args, **kwargs) + super().__init__(*args, same_on_sequence=same_on_sequence, **kwargs) def sample_params(self): """No parameters to sample"""