提交 8f638f7b 编写于 作者: S sunyanfang01

add transf

上级 075a2796
...@@ -385,15 +385,12 @@ class RandomDistort: ...@@ -385,15 +385,12 @@ class RandomDistort:
'saturation': self.saturation_prob, 'saturation': self.saturation_prob,
'hue': self.hue_prob, 'hue': self.hue_prob,
} }
im = im.astype('uint8')
im = Image.fromarray(im)
for id in range(len(ops)): for id in range(len(ops)):
params = params_dict[ops[id].__name__] params = params_dict[ops[id].__name__]
prob = prob_dict[ops[id].__name__] prob = prob_dict[ops[id].__name__]
params['im'] = im params['im'] = im
if np.random.uniform(0, 1) < prob: if np.random.uniform(0, 1) < prob:
im = ops[id](**params) im = ops[id](**params)
im = np.asarray(im).astype('float32')
if label is None: if label is None:
return (im, ) return (im, )
else: else:
......
...@@ -889,15 +889,12 @@ class RandomDistort: ...@@ -889,15 +889,12 @@ class RandomDistort:
'saturation': self.saturation_prob, 'saturation': self.saturation_prob,
'hue': self.hue_prob 'hue': self.hue_prob
} }
im = im.astype('uint8')
im = Image.fromarray(im)
for id in range(4): for id in range(4):
params = params_dict[ops[id].__name__] params = params_dict[ops[id].__name__]
prob = prob_dict[ops[id].__name__] prob = prob_dict[ops[id].__name__]
params['im'] = im params['im'] = im
if np.random.uniform(0, 1) < prob: if np.random.uniform(0, 1) < prob:
im = ops[id](**params) im = ops[id](**params)
im = np.asarray(im).astype('float32')
if label is None: if label is None:
return (im, im_info) return (im, im_info)
else: else:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册