From 85126e83da16940990fce0a43ad30a579173554e Mon Sep 17 00:00:00 2001 From: wangguanzhong Date: Mon, 12 Aug 2019 11:58:53 +0800 Subject: [PATCH] refine doc in json eval mode (#3079) --- ppdet/utils/eval_utils.py | 7 ++++++- tools/eval.py | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ppdet/utils/eval_utils.py b/ppdet/utils/eval_utils.py index ee8ff6a5b..d1e331361 100644 --- a/ppdet/utils/eval_utils.py +++ b/ppdet/utils/eval_utils.py @@ -113,7 +113,8 @@ def eval_results(results, output = 'bbox.json' if output_directory: output = os.path.join(output_directory, 'bbox.json') - box_ap_stats = bbox_eval(results, anno_file, output, with_background) + box_ap_stats = bbox_eval(results, anno_file, output, + with_background) if 'mask' in results[0]: output = 'mask.json' if output_directory: @@ -130,6 +131,7 @@ def eval_results(results, box_ap_stats.append(box_ap) return box_ap_stats + def json_eval_results(feed, metric, json_directory=None): """ cocoapi eval with already exists proposal.json, bbox.json or mask.json @@ -139,6 +141,9 @@ def json_eval_results(feed, metric, json_directory=None): anno_file = getattr(feed.dataset, 'annotation', None) json_file_list = ['proposal.json', 'bbox.json', 'mask.json'] if json_directory: + assert os.path.exists( + json_directory), "The json directory:{} does not exist".format( + json_directory) for k, v in enumerate(json_file_list): json_file_list[k] = os.path.join(str(json_directory), v) diff --git a/tools/eval.py b/tools/eval.py index 4a192e35c..264605db4 100644 --- a/tools/eval.py +++ b/tools/eval.py @@ -93,6 +93,10 @@ def main(): # eval already exists json file if FLAGS.json_eval: + logger.info( + "In json_eval mode, PaddleDetection will evaluate json files in " + "output_eval directly. And proposal.json, bbox.json and mask.json " + "will be detected by default.") json_eval_results( eval_feed, cfg.metric, json_directory=FLAGS.output_eval) return -- GitLab