mAP
mAP copied to clipboard
Different result compared to sklearn.metric.auc calculated
in main.py, function, voc_ap();
I tried to add the following lines of codes there
auc_ap = metrics.auc(rec, prec) print(ap, auc_ap)
However, I found the result is hugely different.
In python, I found that
iw = bi[2] - bi[0] + 1 ih = bi[3] - bi[1] + 1 if iw > 0 and ih > 0: # compute overlap (IoU) = area of intersection / area of union ua = (bb[2] - bb[0] + 1) * (bb[3] - bb[1] + 1) + (bbgt[2] - bbgt[0] + 1) * (bbgt[3] - bbgt[1] + 1) - iw * ih ov = iw * ih / ua if ov > ovmax: ovmax = ov gt_match = obj
I wonder why the +1 in the end is necessary?
In python, I found that
iw = bi[2] - bi[0] + 1 ih = bi[3] - bi[1] + 1 if iw > 0 and ih > 0: # compute overlap (IoU) = area of intersection / area of union ua = (bb[2] - bb[0] + 1) * (bb[3] - bb[1] + 1) + (bbgt[2] - bbgt[0] + 1) * (bbgt[3] - bbgt[1] + 1) - iw * ih ov = iw * ih / ua if ov > ovmax: ovmax = ov gt_match = obj
I wonder why the +1 in the end is necessary?
for example, one bbox is like this
[xmin, ymin, xmax, ymax] = [3, 4, 5, 6]
so compute the witdth like this
# 3 4 5
width = 5 - 3 + 1 = 3
in main.py, function, voc_ap(); I tried to add the following lines of codes there
auc_ap = metrics.auc(rec, prec) print(ap, auc_ap)
However, I found the result is hugely different.
same question
in main.py, function, voc_ap(); I tried to add the following lines of codes there
auc_ap = metrics.auc(rec, prec) print(ap, auc_ap)
However, I found the result is hugely different.same question
sklearn.metric.auc works for ROC-curve
import numpy as np
from sklearn import metrics
y = np.array([1, 1, 2, 2])
pred = np.array([0.1, 0.4, 0.35, 0.8])
fpr, tpr, thresholds = metrics.roc_curve(y, pred, pos_label=2)
metrics.auc(fpr, tpr)
refer to sklearn.metrics.auc