Change color channel from BGR to RGB for darknet preprocessing (#4794)
authorvizero1 <50483246+vizero1@users.noreply.github.com>
Mon, 3 Feb 2020 04:03:57 +0000 (05:03 +0100)
committerGitHub <noreply@github.com>
Mon, 3 Feb 2020 04:03:57 +0000 (12:03 +0800)
python/tvm/relay/testing/darknet.py

index d4d673b..091600d 100644 (file)
@@ -60,6 +60,7 @@ def _resize_image(img, w_in, h_in):
 def load_image_color(test_image):
     """To load the image using opencv api and do preprocessing."""
     imagex = cv2.imread(test_image)
+    imagex = cv2.cvtColor(imagex, cv2.COLOR_BGR2RGB)
     imagex = np.array(imagex)
     imagex = imagex.transpose((2, 0, 1))
     imagex = np.divide(imagex, 255.0)