I think, the Average Precision(AP) is defined for one class. Then Mean Average Precision(MAP) should simply be the mean($\mu$) over multiple classes, say 10 or so.
I think the accepted answer direct the wrong way to compute mAP. Because even for each class, the AP is the average product. In my answer I will still include the interpretation of IOU so the beginners will have no hardness to understand it.
For a given task of object detection, participants will submit a list of bounding boxes with confidence(the predicted probability) of each class. To be considered as a valid detection, the proportion of the area of overlap $a_o$ between predicted bounding box $b_p$ and ground true bounding $b_t$ to the overall area have to exceeds 0.5. The corresponding formula will be:
$$
a_o = \frac{Area(b_p \cap b_t)}{Area(b_p \cup b_t)}
$$
After we sift out a list of valid $M$ predicted bounding boxes, then we will evaluate each class as a two-class problem independently. So for a typical evaluation process of 'human' class. We may first list these $M$ bounding box as following:
Index of Object, Confidence, ground truth
Bounding Box 1, 0.8, 1
Bounding Box 1, 0.7, 1
Bounding Box 2, 0.1, 0
Bounding Box 3, 0.9, 1
And then, you need to rank them by the confidence from high to low. Afterwards, you just need to compute the PR curve as usual and figure out 11 interpolated precision results at these 11 points of recall equals to [0, 0.1, ..., 1].(The detailed calculated methods is in here) Worth mentioning for multiple detections of a single bounding box, e.g. the bounding box 1 in my example, We will at most count it as correct once and all others as False. Then you iterate through 20 classes and compute the average of them. Then you get your mAP.
And also, for now we twist this method a little to find our mAP. Instead of using 10 breaking points of recall, we will use the true number K of specific class and compute the interpolated precison. i.e. [0,1/K,2/K...]
Best Answer
See mean-average-precision library here: https://pypi.org/project/mean-average-precision/