From 424299ccef3f08043279a861bfcea2deaf852bbd Mon Sep 17 00:00:00 2001 From: "Tzu-Chan (Alice) Chuang" <achuang@lyft.com> Date: Wed, 24 Jul 2019 20:02:19 -0700 Subject: [PATCH] Add exceptions handling while validating (#975) * Add exceptions handling while validating * fix lint * add Exception type --- mmdet/core/evaluation/eval_hooks.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mmdet/core/evaluation/eval_hooks.py b/mmdet/core/evaluation/eval_hooks.py index c709958..99bd2d8 100644 --- a/mmdet/core/evaluation/eval_hooks.py +++ b/mmdet/core/evaluation/eval_hooks.py @@ -145,7 +145,11 @@ class CocoDistEvalmAPHook(DistEvalHook): cocoGt = self.dataset.coco imgIds = cocoGt.getImgIds() for res_type in res_types: - cocoDt = cocoGt.loadRes(result_files[res_type]) + try: + cocoDt = cocoGt.loadRes(result_files[res_type]) + except IndexError: + print('No prediction found.') + break iou_type = res_type cocoEval = COCOeval(cocoGt, cocoDt, iou_type) cocoEval.params.imgIds = imgIds -- GitLab