We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, Would you guide me on how to calculate mAP of the final logits? I am using the below function to do so but it doesnt work:
averaged_logits = torch.mean(per_frame_logits,-1) predictions = F.softmax(averaged_logits,-1) print(charades_mAP(predictions,torch.max(labels,dim=2)[0]))
def charades_mAP(y_true, y_pred):
y_true = y_true.cpu().detach().numpy().astype(np.int32) y_pred = y_pred.cpu().detach().numpy() m_aps = [] n_classes = y_pred.shape[1] for oc_i in range(n_classes): pred_row = y_pred[:, oc_i] sorted_idxs = np.argsort(-pred_row) true_row = y_true[:, oc_i] tp = true_row[sorted_idxs] == 1 fp = np.invert(tp) n_pos = tp.sum() if n_pos < 0.1: m_aps.append(float('nan')) continue f_pcs = np.cumsum(fp) t_pcs = np.cumsum(tp) prec = t_pcs / (f_pcs + t_pcs).astype(float) avg_prec = 0 for i in range(y_pred.shape[0]): if tp[i]: avg_prec += prec[i] m_aps.append(avg_prec / n_pos.astype(float)) m_aps = np.array(m_aps) m_ap = np.mean(m_aps) return m_ap
Would you please share your mAP calculation code? Thanks a lot
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
Would you guide me on how to calculate mAP of the final logits?
I am using the below function to do so but it doesnt work:
averaged_logits = torch.mean(per_frame_logits,-1)
predictions = F.softmax(averaged_logits,-1)
print(charades_mAP(predictions,torch.max(labels,dim=2)[0]))
def charades_mAP(y_true, y_pred):
Would you please share your mAP calculation code?
Thanks a lot
The text was updated successfully, but these errors were encountered: