Closed GeoffreyChen777 closed 3 years ago
Hi @GeoffreyChen777 , sorry for the late reply.
This is how I compute the metrics. Note that I decompose the factors of predicted boxes into IoU and box accuracy. For these predicted boxes with low IoU, I still compute its classification accuracy. You could try to further improve this metric by removing these low IoU boxes.
Let me know if you have other questions, thanks!
# gt_pps: all ground-truth boxes
# pred_pps: all predicted boxes/ pseudo-boxes
def probe_iou_acc(self, gt_pps, pred_pps, name=''):
mean_iou = 0.0
pred_acc = 0.0
for gt_pp, pred_pp in zip(gt_pps, pred_pps):
if len(pred_pp)!= 0 :
max_iou, max_idx = pairwise_iou(gt_pp.gt_boxes, pred_pp.pred_boxes).max(0)
mean_iou += max_iou.mean()
gt_cls = gt_pp.gt_classes[max_idx]
pred_acc += (gt_cls == pred_pp.pred_classes).sum().float() / gt_cls.numel()
raise ValueError('Unknown name for comparing gt and pseudo roi bbox.')
else:
mean_iou += torch.tensor(0).cuda()
pred_acc += torch.tensor(0).cuda()
metric = {}
metric['bbox_prob_gt&'+name+'/mean_iou'] = mean_iou.item() / len(gt_pps)
metric['bbox_prob_gt&'+name+'/accuracy'] = pred_acc.item() / len(gt_pps)
return metric
@ycliu93 thanks for your help!
Anybody knows how to calculate this metric?
Thanks!