chamfer
Chamfer distance between batched point sets.
Functions:
-
chamfer_distance–Symmetric Chamfer distance between two batched point sets.
chamfer_distance
¶
Symmetric Chamfer distance between two batched point sets.
Set-to-set reconstruction objective introduced for point cloud generation in
Fan et al., 2017 and standard for masked point
modeling pretraining (the SSL pretraining models return (pred, target) group coordinates in
exactly this layout). For each point the squared euclidean distance to its nearest neighbor in
the other set is computed, then reduced over all points and batches:
The "l2" variant sums the two directed means of squared distances (no square root, no
halving); the "l1" variant averages the two directed means of euclidean distances. Both
follow the reference pretraining convention, so losses are comparable with published values.
Parameters:
-
pred(Tensor) –Predicted point sets of shape \((B, N, 3)\).
-
target(Tensor) –Target point sets of shape \((B, M, 3)\).
-
norm(Literal['l1', 'l2'], default:'l2') –Distance variant,
"l1"(euclidean) or"l2"(squared euclidean).
Returns:
-
Tensor–Scalar Chamfer distance averaged over all points and batches.
Shape
- Input: \((B, N, 3)\) and \((B, M, 3)\).
- Output: scalar.