-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
In your code:
` def add_noise(self, img: mge.Tensor) -> Tuple[mge.Tensor, float]:
"""
Args:
- img: [-black, camera_value_scale]
Returns:
- noisy_img
- iso
"""
N = img.shape[0]
isos = np.random.uniform(*self.opts.iso_range, size=(N, ))
k, b = self.noise_func(isos, value_scale=self.opts.camera_value_scale)
k = k.reshape(-1, 1, 1, 1)
b = b.reshape(-1, 1, 1, 1)
shot_noisy = megengine.random.poisson((img / k).clip(0, 1)) * k
read_noisy = megengine.random.normal(size=img.shape) * math.sqrt(b)
noisy = shot_noisy + read_noisy
noisy = F.round(noisy)
return noisy
It seems that clip(0,1) should not be used in the codeshot_noisy = megengine.random.poisson((img / k).clip(0, 1)) * k`, since most of (img / k)'s range is not between 0 and 1
Metadata
Metadata
Assignees
Labels
No labels