diff --git a/python/paddle/vision/transforms/functional_cv2.py b/python/paddle/vision/transforms/functional_cv2.py index 5c2e8d61bc527297ce95b62e8c9c0dd0202c6bbf..4cc04c39d0bf93d5ced572a77e975570fffe4e9e 100644 --- a/python/paddle/vision/transforms/functional_cv2.py +++ b/python/paddle/vision/transforms/functional_cv2.py @@ -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