NVIDIAGameWorks / kaolin

A PyTorch Library for Accelerating 3D Deep Learning Research
Apache License 2.0
4.31k stars 535 forks source link

Point Cloud IoU #271

Open evinpinar opened 4 years ago

evinpinar commented 4 years ago

Hi, what is the design idea behind IoU metric implemented for point clouds? There is a threshold but the output IoU score increases when we decrease the threshold. Should not it be the opposite, since the intersection region would decrease when threshold is decreased?

Another thing: IoU is not consistent with F score. Normally, they should be aligning within different inputs: if one is higher on sample A than sample B, the other one should also be higher.

Possible solution: Use the extended version of F-Score calculation, and calculate the IoU as in:

    pred_distances = torch.sqrt(directed_distance(gt_points, pred_points, mean=False))
    gt_distances = torch.sqrt(directed_distance(pred_points, gt_points, mean=False))

    fp = (gt_distances > radius).float().sum()
    tp = (gt_distances <= radius).float().sum()
    precision = tp / (tp + fp)
    tp = (pred_distances <= radius).float().sum()
    fn = (pred_distances > radius).float().sum()
    recall = tp / (tp + fn)

    f_score = 2 * (precision * recall) / (precision + recall + 1e-8)
    iou = tp / (tp + fp + fn + 1e-8)
Caenorst commented 3 years ago

Hi @evinpinar , Thank you for your interest in Kaolin, there is indeed a problem with our IoU for point cloud metric, we will reformat this part.