class paddle.fluid.evaluator. DetectionMAP ( input, gt_label, gt_box, gt_difficult=None, class_num=None, background_label=0, overlap_threshold=0.5, evaluate_difficult=True, ap_version='integral' ) [source]

Warning: This would be deprecated in the future. Please use fluid.metrics.DetectionMAP instead. Calculate the detection mean average precision (mAP).

The general steps are as follows: 1. calculate the true positive and false positive according to the input

System Message: ERROR/3 (/usr/local/lib/python3.8/site-packages/paddle/fluid/ of paddle.fluid.evaluator.DetectionMAP, line 7)

Unexpected indentation.

of detection and labels.

System Message: WARNING/2 (/usr/local/lib/python3.8/site-packages/paddle/fluid/ of paddle.fluid.evaluator.DetectionMAP, line 8)

Block quote ends without a blank line; unexpected unindent.

  1. calculate mAP value, support two versions: ‘11 point’ and ‘integral’.

Please get more information from the following articles:

  • input (Variable) – The detection results, which is a LoDTensor with shape [M, 6]. The layout is [label, confidence, xmin, ymin, xmax, ymax].

  • gt_label (Variable) – The ground truth label index, which is a LoDTensor with shape [N, 1].

  • gt_box (Variable) – The ground truth bounding box (bbox), which is a LoDTensor with shape [N, 4]. The layout is [xmin, ymin, xmax, ymax].

  • gt_difficult (Variable|None) – Whether this ground truth is a difficult bounding bbox, which can be a LoDTensor [N, 1] or not set. If None, it means all the ground truth labels are not difficult bbox.

  • class_num (int) – The class number.

  • background_label (int) – The index of background label, the background label will be ignored. If set to -1, then all categories will be considered, 0 by default.

  • overlap_threshold (float) – The threshold for deciding true/false positive, 0.5 by default.

  • evaluate_difficult (bool) – Whether to consider difficult ground truth for evaluation, True by default. This argument does not work when gt_difficult is None.

  • ap_version (string) – The average precision calculation ways, it must be ‘integral’ or ‘11point’. Please check for details. - 11point: the 11-point interpolated average precision. - integral: the natural integral of the precision-recall curve.


exe = fluid.executor(place)
map_evaluator = fluid.Evaluator.DetectionMAP(input,
    gt_label, gt_box, gt_difficult)
cur_map, accum_map = map_evaluator.get_map_var()
fetch = [cost, cur_map, accum_map]
for epoch in PASS_NUM:
    for data in batches:
        loss, cur_map_v, accum_map_v =

In the above example:

‘cur_map_v’ is the mAP of current mini-batch. ‘accum_map_v’ is the accumulative mAP of one pass.

eval ( executor, eval_program=None )


Evaluate the statistics merged by multiple mini-batches. :param executor: a executor for executing the eval_program :type executor: Executor|ParallelExecutor :param eval_program: a single Program for eval process :type eval_program: Program

reset ( executor, reset_program=None )


reset metric states at the begin of each pass/user specified batch

  • executor (Executor|ParallelExecutor) – a executor for executing the reset_program

  • reset_program (Program) – a single Program for reset process