提交 85126e83 编写于 作者: W wangguanzhong 提交者: GitHub

refine doc in json eval mode (#3079)

上级 e74303b6
......@@ -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)
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册