From 6a6c97f92b37ed35b26e1c6dcbb6c1d459bfee7e Mon Sep 17 00:00:00 2001 From: dyning Date: Wed, 24 Jun 2020 10:46:40 +0800 Subject: [PATCH] raise exception when concatenate error --- tools/eval_utils/eval_det_utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/eval_utils/eval_det_utils.py b/tools/eval_utils/eval_det_utils.py index 252c9364..6ae8cb5b 100644 --- a/tools/eval_utils/eval_det_utils.py +++ b/tools/eval_utils/eval_det_utils.py @@ -59,7 +59,13 @@ def cal_det_res(exe, config, eval_info_dict): img_list.append(data[ino][0]) ratio_list.append(data[ino][1]) img_name_list.append(data[ino][2]) - img_list = np.concatenate(img_list, axis=0) + try: + img_list = np.concatenate(img_list, axis=0) + except: + err = "concatenate error usually caused by different input image shapes.\n \ + Please set \"test_batch_size_per_card\" in main yml as 1\n \ + or add \"test_image_shape: [h, w]\" in reader yml for EvalReader." + raise Exception(err) outs = exe.run(eval_info_dict['program'], \ feed={'image': img_list}, \ fetch_list=eval_info_dict['fetch_varname_list'])