提交 cfc166c9 编写于 作者: L LDOUBLEV

add error message when img is None

上级 af6f9a4b
...@@ -94,6 +94,9 @@ class EvalTestReader(object): ...@@ -94,6 +94,9 @@ class EvalTestReader(object):
batch_outs = [] batch_outs = []
for img_path in img_list: for img_path in img_list:
img = cv2.imread(img_path) img = cv2.imread(img_path)
if img is None:
logger.info("{} does not exist!".format(img_path))
continue
if len(list(img.shape)) == 2 or img.shape[2] == 1: if len(list(img.shape)) == 2 or img.shape[2] == 1:
img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR) img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
if img is None: if img is None:
......
...@@ -104,6 +104,8 @@ class DBProcessTrain(object): ...@@ -104,6 +104,8 @@ class DBProcessTrain(object):
if imgvalue is None: if imgvalue is None:
logger.info("{} does not exist!".format(img_path)) logger.info("{} does not exist!".format(img_path))
return None return None
if len(list(imgvalue.shape)) == 2 or imgvalue.shape[2] == 1:
imgvalue = cv2.cvtColor(imgvalue, cv2.COLOR_GRAY2BGR)
data = self.make_data_dict(imgvalue, gt_label) data = self.make_data_dict(imgvalue, gt_label)
data = AugmentData(data) data = AugmentData(data)
data = RandomCropData(data, self.image_shape[1:]) data = RandomCropData(data, self.image_shape[1:])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册