clinplayer / Point2Skeleton

Point2Skeleton: Learning Skeletal Representations from Point Clouds (CVPR2021)
MIT License
211 stars 38 forks source link

How to use the distance metrics set in the paper #28

Closed liuyx599 closed 6 months ago

liuyx599 commented 9 months ago

Hello, I've just recently started learning about point clouds, and now I'm learning about similarity metrics between point clouds, and in your paper you mention the following distances CD-Recon HD-Recon CD-MAT HD-MAT, and I'm trying to try to implement it in code with a result of failing, and I'm wondering if you guys have any relevant code for this. For example, if I have a set of points Points1, Points2, and I want to measure the distance between them, how can I implement it with your code?

clinplayer commented 9 months ago

Hi, please check https://github.com/clinplayer/Point2Skeleton/blob/master/src/DistFunc.py For instance, if you want to compute the Chamfer Distance between two point clouds, you can use

        cd1 = closest_distance_with_batch(Points1, Points2, is_sum=True)
        cd2 = closest_distance_with_batch(Points2, Points1, is_sum=True)
        loss_cd = cd1 + cd2

If you want to measure the reconstruction error between the reconstructed shape represented by a set of skeleton points (xyzr) and a point cloud (xyz), you can first densely sample a set of skeletal spheres and use:

        cd1 = point2sphere_distance_with_batch(xyz, xyzr)
        cd2 = sphere2point_distance_with_batch(xyzr, xyz)
        loss_recon = cd1 + cd2