提交 afe95881 编写于 作者: J jiangjiajun

modify error message for training

上级 f1912b7f
......@@ -48,8 +48,9 @@ class Compose:
tuple: 根据网络所需字段所组成的tuple;
字段由transforms中的最后一个数据预处理操作决定。
"""
im = cv2.imread(im).astype('float32')
if im is None:
try:
im = cv2.imread(im).astype('float32')
except:
raise TypeError('Can\'t read The image file {}!'.format(im))
im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
for op in self.transforms:
......
......@@ -73,10 +73,11 @@ class Compose:
def decode_image(im_file, im_info, label_info):
if im_info is None:
im_info = dict()
im = cv2.imread(im_file).astype('float32')
if im is None:
try:
im = cv2.imread(im_file).astype('float32')
except:
raise TypeError(
'Can\'t read The image file {}!'.format(im_file))
'Can\'t read The image file {}!'.format(im_file))
im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
# make default im_info with [h, w, 1]
im_info['im_resize_info'] = np.array(
......
......@@ -59,8 +59,9 @@ class Compose:
if im_info is None:
im_info = dict()
im = cv2.imread(im).astype('float32')
if im is None:
try:
im = cv2.imread(im).astype('float32')
except:
raise ValueError('Can\'t read The image file {}!'.format(im))
if self.to_rgb:
im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册