Hi, I’m student and my teacher told me to present how to calculate mAP. After read many topic and some repo, I saw that there are 2 way to chose boxes (if I don’t missunderstood) to calculate mAP.
Let assume that model predicted two tensor as below:
boxes : shape [nbox, 4] # coordinate of bouding box
conf : shape [nbox, num_class] # confidence score for num_class each box
In the first way:
box_to_calc_mAP = []
conf, labels = torch.max(conf, dim=1)
for cur_class in range(num_class):
mask = (labels == cur_class)
cur_boxes = boxes[mask]
cur_conf = conf[mask]
box_to_calc_mAP.append(non_max_suppression(cur_boxes, cur_conf))
mAP = calc_mAP(box_to_calc_mAP)
But the second way:
box_to_calc_mAP = []
for cur_class in range(num_class):
box_to_calc_mAP.append(non_max_suppression(boxes, conf[:, cur_class]))
mAP = calc_mAP(box_to_calc_mAP)
I feel that the first way is correct, but I saw a repo use the second way, so which is actually true ?