add cv2.IMREAD_COLOR to decode when input_channel is 3
@@ -77,9 +77,10 @@ class Compose(ClsTransform):
try:
if input_channel == 3:
im = cv2.imread(im_file, cv2.IMREAD_ANYDEPTH |
- cv2.IMREAD_ANYCOLOR)
+ cv2.IMREAD_ANYCOLOR | cv2.IMREAD_COLOR)
else:
- im = cv2.imread(im_file, cv2.IMREAD_UNCHANGED)
+ im = cv2.imread(im_file, cv2.IMREAD_ANYDEPTH |
+ cv2.IMREAD_ANYCOLOR)
if im.ndim < 3:
im = np.expand_dims(im, axis=-1)
except:
@@ -112,9 +112,10 @@ class Compose(DetTransform):
@@ -89,9 +89,10 @@ class Compose(SegTransform):
elif img_format in ['jpeg', 'bmp', 'png', 'jpg']:
return cv2.imread(img_path, cv2.IMREAD_ANYDEPTH |
- return cv2.imread(im_file, cv2.IMREAD_UNCHANGED)
+ return cv2.imread(im_file, cv2.IMREAD_ANYDEPTH |
elif ext == '.npy':
return np.load(img_path)