Skip to content

Is there a way to use PythonAPI loadRes and COCOeval with empty detections? #675

@tomikoskinen

Description

@tomikoskinen

I am trying to run a simple evaluation:

    cocoGt = COCO(json_gt_path)
    cocoDt = cocoGt.loadRes(json_pr_path)
    cocoEval = COCOeval(cocoGt, cocoDt, "bbox")
    cocoEval.evaluate()
    cocoEval.accumulate()
    cocoEval.summarize()

, where my detector did not detect any box-annotations, so json_pr_path only has an empty array [].
This leads to an error in coco.loadRes:

pycocotools/coco.py", line 335, in loadRes if 'caption' in anns[0]: ~~~~^^^ IndexError: list index out of range

Is there a way to use these functions and evaluate with zero predicted/detected boxes?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions