提交 23b01120 编写于 作者: Z zh-hike 提交者: zengshao0622

fix randomapply

上级 85f65ce7
...@@ -162,7 +162,7 @@ DataLoader: ...@@ -162,7 +162,7 @@ DataLoader:
contrast: 0.4 contrast: 0.4
saturation: 0.4 saturation: 0.4
hue: 0.1 hue: 0.1
p: 0.8 p: 1.0
- RandomGrayscale: - RandomGrayscale:
p: 0.2 p: 0.2
- NormalizeImage: - NormalizeImage:
......
...@@ -162,7 +162,7 @@ DataLoader: ...@@ -162,7 +162,7 @@ DataLoader:
contrast: 0.4 contrast: 0.4
saturation: 0.4 saturation: 0.4
hue: 0.1 hue: 0.1
p: 0.8 p: 1.0
- RandomGrayscale: - RandomGrayscale:
p: 0.2 p: 0.2
- NormalizeImage: - NormalizeImage:
......
...@@ -168,6 +168,8 @@ class RandomApply(object): ...@@ -168,6 +168,8 @@ class RandomApply(object):
self.trans = T.Compose(ts) self.trans = T.Compose(ts)
def __call__(self, img): def __call__(self, img):
if self.p < np.random.rand(1):
return img
timg = self.trans(img) timg = self.trans(img)
return timg return timg
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册