我喜欢用mAP (平均平均精度)来评估我的目标检测模型。在detection/utils/中有我想要使用的object_detection_evaluation.py。
我用下列词作为地面真相箱:
pascal_evaluator = object_detection_evaluation.PascalDetectionEvaluator(
categories, matching_iou_threshold=0.1)
groundtruth_boxes = np.array([[10, 10, 11, 11]], dtype=float)
groundtruth_class_labels = np.array([1], dtype=int)
groundtruth_is_difficult_list = np.array([False], dtype=bool)
pascal_evaluator.add_single_ground_truth_image_info(
'img2',
{
standard_fields.InputDataFields.groundtruth_boxes: groundtruth_boxes,
standard_fields.InputDataFields.groundtruth_classes: groundtruth_class_labels,
standard_fields.InputDataFields.groundtruth_difficult: groundtruth_is_difficult_list
}
)对于预测框来说:
# Add detections
image_key = 'img2'
detected_boxes = np.array(
[ [100, 100, 220, 220], [10, 10, 11, 11]],
dtype=float)
detected_class_labels = np.array([1,1], dtype=int)
detected_scores = np.array([0.8, 0.9], dtype=float)
pascal_evaluator.add_single_detected_image_info(image_key, {
standard_fields.DetectionResultFields.detection_boxes:
detected_boxes,
standard_fields.DetectionResultFields.detection_scores:
detected_scores,
standard_fields.DetectionResultFields.detection_classes:
detected_class_labels
})我用
metrics = pascal_evaluator.evaluate()
print(metrics)我的问题是:
如果我使用此预测框[100, 100, 220, 220],则[10, 10, 11, 11]的结果是:
{‘PASCAL/PASCAL/mAP@0.1IOU’:1.0,'PASCAL/PerformanceByCategory/AP@0.1IOU/face':1.0}
如果我使用[10, 10, 11, 11],[100, 100, 220, 220] (其他框序列)
我得到的结果如下:
{‘PASCAL/精度/mAP@0.1IOU’:0.5,'PASCAL/PerformanceByCategory/AP@0.1IOU/face':0.5}
为什么是这样?还是虫子?
干杯迈克尔
发布于 2018-09-19 08:44:21
虽然您对此不太清楚,但我想我在代码中发现了错误。您刚才提到,对于不同顺序的包围盒,您得到了不同的结果。这似乎很奇怪,如果是真的,那肯定是个错误。
但是,由于我自己测试了代码,您可能没有将相应的分数(detected_scores = np.array([0.8, 0.9], dtype=float))更改为边框。但是这样你也改变了问题,而不仅仅是包围框的顺序。如果应用正确的边界框,则在这两种情况下,mAP保持不变:
{‘PascalBoxes_#en0#/mAP@0.5IOU’:1.0,'PascalBoxes_PerformanceByCategory/AP@0.5IOU/person':1.0}
https://stackoverflow.com/questions/49014512
复制相似问题