haidongz-usc / Curriculum-DeepSDF

Implementation for Curriculum DeepSDF
MIT License
86 stars 12 forks source link

Evaluation problem #2

Open novauto-nju opened 3 years ago

novauto-nju commented 3 years ago

could you please provide other evaluation indicators? Such as EMD, mesh acc...

haidongz-usc commented 3 years ago

Please check the following code

import numpy as np
import trimesh
from scipy.spatial.distance import cdist
from scipy.optimize import linear_sum_assignment

def EMD(Y1, Y2): 
    # input - two N x 3 numpy array
    d = cdist(Y1, Y2)
    assignment = linear_sum_assignment(d)
    return d[assignment].sum() / Y1.shape[0]

def mesh_acc(mesh, sampled_points):
    # input - mesh : trimesh.base.Trimesh of the input mesh
    #         sampled_points : sampled points with N x 3 numpy array format
    dist = trimesh.proximity.signed_distance(mesh, sampled_points)
    dist = np.abs(dist)
    dist.sort()
    return dist[dist.shape[0] * 9 // 10]

Please let me know if there is any further question. Thanks!