fix: bug in noise generator
Browse files- 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
|
|
|
|
|
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):
|