提交 3f824f00 编写于 作者: L LDOUBLEV

modify normalization of db_process to speed up

上级 244a06d5
...@@ -194,8 +194,12 @@ class DBProcessTest(object): ...@@ -194,8 +194,12 @@ class DBProcessTest(object):
img_std = [0.229, 0.224, 0.225] img_std = [0.229, 0.224, 0.225]
im = im.astype(np.float32, copy=False) im = im.astype(np.float32, copy=False)
im = im / 255 im = im / 255
im -= img_mean im[:, :, 0] -= img_mean[0]
im /= img_std im[:, :, 1] -= img_mean[1]
im[:, :, 2] -= img_mean[2]
im[:, :, 0] /= img_std[0]
im[:, :, 1] /= img_std[1]
im[:, :, 2] /= img_std[2]
channel_swap = (2, 0, 1) channel_swap = (2, 0, 1)
im = im.transpose(channel_swap) im = im.transpose(channel_swap)
return im return im
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册