• Haritha Jayasinghe's avatar
    add None option for chamfer distance point reduction (#1605) · d84f274a
    Haritha Jayasinghe authored
    Summary:
    The `chamfer_distance` function currently allows `"sum"` or `"mean"` reduction, but does not support returning unreduced (per-point) loss terms. Unreduced losses could be useful if the user wishes to inspect individual losses, or perform additional modifications to loss terms before reduction. One example would be implementing a robust kernel over the loss.
    
    This PR adds a `None` option to the `point_reduction` parameter, similar to `batch_reduction`. In case of bi-directional chamfer loss, both the forward and backward distances are returned (a tuple of Tensors of shape `[D, N]` is returned). If normals are provided, similar logic applies to normals as well.
    
    This PR addresses issue https://github.com/facebookresearch/pytorch3d/issues/622.
    
    Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/1605
    
    Reviewed By: jcjohnson
    
    Differential Revision: D48313857
    
    Pulled By: bottler
    
    fbshipit-source-id: 35c824827a143649b04166c4817449e1341b7fd9
    d84f274a
test_chamfer.py 42.2 KB