add error message when img is None

This commit is contained in:
LDOUBLEV 2020-06-19 13:16:50 +08:00
parent af6f9a4bf0
commit cfc166c91b
2 changed files with 5 additions and 0 deletions

View File

@ -94,6 +94,9 @@ class EvalTestReader(object):
batch_outs = []
for img_path in img_list:
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:
img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
if img is None:

View File

@ -104,6 +104,8 @@ class DBProcessTrain(object):
if imgvalue is None:
logger.info("{} does not exist!".format(img_path))
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 = AugmentData(data)
data = RandomCropData(data, self.image_shape[1:])