未验证 提交 b6fbe07f 编写于 作者: L LutaoChu 提交者: GitHub

fix bg_replace.py error information bug

上级 4ee2b4ef
...@@ -121,13 +121,13 @@ def infer(args): ...@@ -121,13 +121,13 @@ def infer(args):
# 图像背景替换 # 图像背景替换
if args.image_path is not None: if args.image_path is not None:
if not osp.exists(args.image_path): if not osp.exists(args.image_path):
raise ('The --image_path is not existed: {}'.format( raise Exception('The --image_path is not existed: {}'.format(
args.image_path)) args.image_path))
if args.background_image_path is None: if args.background_image_path is None:
raise ('The --background_image_path is not set. Please set it') raise Exception('The --background_image_path is not set. Please set it')
else: else:
if not osp.exists(args.background_image_path): if not osp.exists(args.background_image_path):
raise ('The --background_image_path is not existed: {}'.format( raise Exception('The --background_image_path is not existed: {}'.format(
args.background_image_path)) args.background_image_path))
img = cv2.imread(args.image_path) img = cv2.imread(args.image_path)
score_map, im_info = predict(img, model, test_transforms) score_map, im_info = predict(img, model, test_transforms)
...@@ -144,15 +144,15 @@ def infer(args): ...@@ -144,15 +144,15 @@ def infer(args):
is_video_bg = False is_video_bg = False
if args.background_video_path is not None: if args.background_video_path is not None:
if not osp.exists(args.background_video_path): if not osp.exists(args.background_video_path):
raise ('The --background_video_path is not existed: {}'.format( raise Exception('The --background_video_path is not existed: {}'.format(
args.background_video_path)) args.background_video_path))
is_video_bg = True is_video_bg = True
elif args.background_image_path is not None: elif args.background_image_path is not None:
if not osp.exists(args.background_image_path): if not osp.exists(args.background_image_path):
raise ('The --background_image_path is not existed: {}'.format( raise Exception('The --background_image_path is not existed: {}'.format(
args.background_image_path)) args.background_image_path))
else: else:
raise ( raise Exception(
'Please offer backgound image or video. You should set --backbground_iamge_paht or --background_video_path' 'Please offer backgound image or video. You should set --backbground_iamge_paht or --background_video_path'
) )
...@@ -162,9 +162,9 @@ def infer(args): ...@@ -162,9 +162,9 @@ def infer(args):
prev_cfd = np.zeros((resize_h, resize_w), np.float32) prev_cfd = np.zeros((resize_h, resize_w), np.float32)
is_init = True is_init = True
if args.video_path is not None: if args.video_path is not None:
print('Please waite. It is computing......') print('Please wait. It is computing......')
if not osp.exists(args.video_path): if not osp.exists(args.video_path):
raise ('The --video_path is not existed: {}'.format( raise Exception('The --video_path is not existed: {}'.format(
args.video_path)) args.video_path))
cap_video = cv2.VideoCapture(args.video_path) cap_video = cv2.VideoCapture(args.video_path)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册