def evaluate(self, target, pred, cfg):
        results = {}

        if target.voxel is not None:
            val_jaccard = jaccard_index(
                target.voxel, pred.voxel, cfg.num_classes)
            results['jaccard'] = val_jaccard[0]

            # inter, union = inter_and_union(target.voxel, pred.voxel)
            # results['jaccard'] = inter/union

        # if target.mesh is not None: TODO
        #     target_points = target.points
        #     pred_points = pred.mesh
        #     val_chamfer_weighted_symmetric = np.zeros(len(target_points))

        #     for i in range(len(target_points)):
        #         val_chamfer_weighted_symmetric[i] = chamfer_weighted_symmetric(target_points[i].cpu(), pred_points[i]['vertices'])

        #     results['chamfer_weighted_symmetric'] = val_chamfer_weighted_symmetric

        if target.points is not None:
            results['chamfer_weighted_symmetric'] = chamfer_distance(
                target.points, pred.points)[0].item()

        return results
Esempio n. 2
0
    def evaluate(self, target, pred, cfg):
        results = {}


        if target.voxel is not None: 
            val_jaccard = jaccard_index(target.voxel, pred.voxel, cfg.num_classes)
            results['jaccard'] = val_jaccard

        if target.mesh is not None:
            target_points = target.points
            pred_points = pred.mesh
            val_chamfer_weighted_symmetric = np.zeros(len(target_points))

            for i in range(len(target_points)):
                val_chamfer_weighted_symmetric[i] = chamfer_weighted_symmetric(target_points[i].cpu(), pred_points[i]['vertices'])

            results['chamfer_weighted_symmetric'] = val_chamfer_weighted_symmetric

        return results