facebookresearch / detectron2

Detectron2 is a platform for object detection, segmentation and other visual recognition tasks.
https://detectron2.readthedocs.io/en/latest/
Apache License 2.0
29.3k stars 7.32k forks source link

tests: data: coco_evaluation: Fix test #5298

Open Jmennius opened 1 month ago

Jmennius commented 1 month ago

...by deep copying results before passing to coco. The results dictionary will be attached as 'annotations' to the dataset and will be changed, making the use of the same structure impossible for the second time.

Previously the test would fail on second call to coco_api.loadRes() with an exception (KeyError: 'precision' when trying to calculate difference between API results).

Also, handle the case when one API produces an exception and the other one does not. Previously, the test code would ignore that and try to calculate the difference resulting in an error.