martinnormark / neural-mesh-simplification

Un-official and WIP Implementation of the Neural Mesh Simplification paper
MIT License
10 stars 0 forks source link

Implement Probabilistic Chamfer Distance loss #20

Closed martinnormark closed 3 months ago

martinnormark commented 3 months ago

From the paper:

The Probabilistic Chamfer Distance (PCD) is introduced as a modification to the standard Chamfer distance to improve uniform sampling. It's designed to force the Point Selector to assign high probabilities to points that cover the surface of the point cloud.

Mathematical Formulation:

The PCD is defined as:

d(P, Ps) = Σy∈Ps p(y) minx∈P ||x - y||² + Σx∈P p(y) miny∈Ps ||x - y||²

Where:

Steps to implement the Probabilistic Chamfer Distance loss:

  1. Define the loss function class: Create a new file losses/chamfer_distance_loss.py and define a ProbabilisticChamferDistanceLoss class.

  2. Initialize the loss function: The initialization should take any necessary parameters, such as the number of points to sample.

  3. Implement the forward method: This method will compute the actual loss given the input and sampled point sets, along with their probabilities.

  4. Compute the bidirectional distances: Calculate the minimum distances from each point in Ps to P and vice versa.

  5. Weight the distances: Multiply the distances by the corresponding probabilities.

  6. Sum the weighted distances: Add up all the weighted distances to get the final loss value.