使用TensorFlow object_detection_evaluation.py计算mAP的结果疑问
Hey there! Let’s break down why your result makes total sense, using the TensorFlow Object Detection API’s evaluation logic.
核心结论:这个结果完全合理
Your {'PASCAL/Precision/mAP@0.1IOU': 1.0} output is totally expected given the scenario you described—here’s why:
1. IOU阈值0.1非常宽松
First, remember that mAP@0.1IOU uses an Intersection over Union (IOU) threshold of 0.1 to determine if a prediction "matches" a ground truth (GT) box. This is way more lenient than the standard PASCAL VOC threshold of 0.5.
For your two prediction boxes:
- The larger box
[100, 100, 220, 220]: Even if its corresponding GT box is slightly shifted (e.g.,[105, 105, 225, 225]), the IOU will still be well above 0.1. If the GT is identical, IOU is 1.0—obviously a match. - The tiny box
[10, 10, 11, 11]: Even a slightly larger GT box (like[9, 9, 12, 12]) would give an IOU of ~0.11, which just meets the 0.1 threshold. If the GT is exactly the same, IOU is 1.0.
2. 你的预测框大概率与真值完美匹配
根据object_detection_evaluation.py的逻辑,mAP达到1.0需要满足两个核心条件:
- 无假阳性: 每个预测框都能找到一个IOU≥0.1的真值框匹配
- 无假阴性: 每个真值框都能找到一个IOU≥0.1的预测框匹配
从你的结果反推,几乎可以确定:
- 你有且仅有2个真值框(和预测框数量一致)
- 每个预测框和对应真值框的IOU都≥0.1
- 没有多余的预测框(不存在匹配不到真值的预测),也没有遗漏的真值框(所有真值都被预测覆盖)
3. mAP的计算逻辑
这个脚本里的PASCAL-style mAP是对所有类别平均精度(AP)的均值。如果你的测试集中每个类别的AP都是1.0(该类所有预测都正确,无漏检),那么整体mAP自然就是1.0。
快速验证建议
如果你想进一步确认:
- 手动计算每个预测框和对应真值框的IOU,你会发现它们都≥0.1
- 检查真值框数量和预测框数量是否一致,确保没有多预测或少预测的情况
内容的提问来源于stack exchange,提问作者M. Krech

