From 9ed79f2d4981b4d5b6565e3587267bad7b34b41b Mon Sep 17 00:00:00 2001 From: tham Date: Wed, 21 Apr 2021 15:11:13 +0800 Subject: [PATCH] convert color from bgr to rgb --- yolort/utils/image_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/yolort/utils/image_utils.py b/yolort/utils/image_utils.py index 1a855bb8..46fc5c9a 100644 --- a/yolort/utils/image_utils.py +++ b/yolort/utils/image_utils.py @@ -175,6 +175,7 @@ def read_image_to_tensor( image (np.ndarray): the candidate ndarray image to be parsed to Tensor. is_half (bool): whether to transfer image to half. Default: False. """ + image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) image = np.ascontiguousarray(image, dtype=np.float32) # uint8 to float32 image = np.transpose(image / 255.0, [2, 0, 1])