未验证 提交 0e1ef228 编写于 作者: J jerrywgz 提交者: GitHub

fix hang when load error in faster_rcnn (#1666)

* fix hang when load error in faster_rcnn
上级 39d43111
......@@ -28,6 +28,7 @@ from __future__ import unicode_literals
import cv2
import numpy as np
from config import cfg
import os
def get_image_blob(roidb, mode):
......@@ -43,8 +44,11 @@ def get_image_blob(roidb, mode):
target_size = cfg.TEST.scales[0]
max_size = cfg.TEST.max_size
im = cv2.imread(roidb['image'])
assert im is not None, \
'Failed to read image \'{}\''.format(roidb['image'])
try:
assert im is not None
except AssertionError as e:
print('Failed to read image \'{}\''.format(roidb['image']))
os._exit(0)
if roidb['flipped']:
im = im[:, ::-1, :]
im, im_scale = prep_im_for_blob(im, cfg.pixel_means, target_size, max_size)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册