gyrojeff commited on
Commit
e7affb8
·
1 Parent(s): a7a9b11

fix: bug in noise generator

Browse files
Files changed (1) hide show
  1. detector/data.py +3 -1
detector/data.py CHANGED
@@ -114,7 +114,9 @@ class RandomNoise(object):
114
  def __call__(self, image):
115
  if random.random() < self.preserve:
116
  return image
117
- return image + torch.randn_like(image) * random.random() * self.max_noise
 
 
118
 
119
 
120
  class RandomDownSample(object):
 
114
  def __call__(self, image):
115
  if random.random() < self.preserve:
116
  return image
117
+ return torch.clamp(
118
+ image + torch.randn_like(image) * random.random() * self.max_noise, 0, 1
119
+ )
120
 
121
 
122
  class RandomDownSample(object):