Skip to content

Commit

Permalink
add user warning
Browse files Browse the repository at this point in the history
  • Loading branch information
ZwwWayne committed Apr 30, 2021
1 parent 43dd636 commit 63606a9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/compatibility.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Compatibility of MMDetection 2.x

## Mask AP Evaluation
## Mask AP Evaluation since MMDetection 2.12.0

Before [PR 4898](https://github.com/open-mmlab/mmdetection/pull/4898), the mask AP of small, medium, and large instances is calculated based on the bounding box area rather than the real mask area. This leads to higher APs and APm but lower APl but will not affect the overall mask AP.
Before [PR 4898](https://github.com/open-mmlab/mmdetection/pull/4898) and V2.13.0, the mask AP of small, medium, and large instances is calculated based on the bounding box area rather than the real mask area. This leads to higher APs and APm but lower APl but will not affect the overall mask AP.
[PR 4898](https://github.com/open-mmlab/mmdetection/pull/4898) change it to use mask areas by deleting `bbox` in mask AP calculation.
The new calculation is consistent with [Detectron2](https://github.com/facebookresearch/detectron2/).

Expand Down
11 changes: 9 additions & 2 deletions mmdet/datasets/coco.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import itertools
import warnings
import logging
import os.path as osp
import tempfile
Expand Down Expand Up @@ -445,10 +446,16 @@ def evaluate(self,
# When evaluating mask AP, if the results contain bbox,
# cocoapi will use the box area instead of the mask area
# for calculating the instance area. Though the overall AP
# is not affected, this leads to different small/medium/large
# mask AP results.
# is not affected, this leads to different
# small/medium/large mask AP results.
for x in predictions:
x.pop('bbox')
warnings.simplefilter('once')
warnings.warn(
'The key "bbox" is deleted for more accurate mask AP '
'of small/medium/large instances since v2.13.0. This '
'does not change the overall mAP calculation.',
UserWarning)
cocoDt = cocoGt.loadRes(predictions)
except IndexError:
print_log(
Expand Down

0 comments on commit 63606a9

Please sign in to comment.