def compute_IoU_mask(prediction, gt, overlap_threshold): IoU = jaccard(prediction, gt) # for each prediction select gt with the largest IoU and ignore the others for i in range(len(prediction)): maxj = IoU[i, :].argmax() IoU[i, :maxj] = 0 IoU[i, (maxj + 1):] = 0 # make a mask of all "matched" predictions vs gt return IoU >= overlap_threshold
def compute_IoU(prediction, gt, confidence, confidence_threshold): IoU = jaccard(prediction, gt) IoU[confidence < confidence_threshold, :] = 0 return IoU