未验证 提交 3c95acc3 编写于 作者: L LielinJiang 提交者: GitHub

Remove cv2 dependence of normalize (#28361)

* rm cv2 dependence of normalize
上级 44a476c2
......@@ -495,9 +495,8 @@ def normalize(img, mean, std, data_format='CHW', to_rgb=False):
mean = np.float32(np.array(mean).reshape(1, 1, -1))
std = np.float32(np.array(std).reshape(1, 1, -1))
if to_rgb:
cv2 = try_import('cv2')
# inplace
cv2.cvtColor(img, cv2.COLOR_BGR2RGB, img)
img = img[..., ::-1]
img = (img - mean) / std
return img
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册