Align_corners switch in Volumes

Summary:
Porting this commit by davnov134 .
93a3a62800 (diff-a8e107ebe039de52ca112ac6ddfba6ebccd53b4f53030b986e13f019fe57a378)

Capability to interpret world/local coordinates with various align_corners semantics.

Reviewed By: bottler

Differential Revision: D51855420

fbshipit-source-id: 834cd220c25d7f0143d8a55ba880da5977099dd6
This commit is contained in:
Roman Shapovalov
2023-12-07 03:07:41 -08:00
committed by Facebook GitHub Bot
parent fbc6725f03
commit 94da8841af
5 changed files with 91 additions and 9 deletions

View File

@@ -291,6 +291,7 @@ def add_pointclouds_to_volumes(
mask=mask,
mode=mode,
rescale_features=rescale_features,
align_corners=initial_volumes.get_align_corners(),
_python=_python,
)
@@ -310,6 +311,7 @@ def add_points_features_to_volume_densities_features(
grid_sizes: Optional[torch.LongTensor] = None,
rescale_features: bool = True,
_python: bool = False,
align_corners: bool = True,
) -> Tuple[torch.Tensor, torch.Tensor]:
"""
Convert a batch of point clouds represented with tensors of per-point
@@ -356,6 +358,7 @@ def add_points_features_to_volume_densities_features(
output densities are just summed without rescaling, so
you may need to rescale them afterwards.
_python: Set to True to use a pure Python implementation.
align_corners: as for grid_sample.
Returns:
volume_features: Output volume of shape `(minibatch, feature_dim, D, H, W)`
volume_densities: Occupancy volume of shape `(minibatch, 1, D, H, W)`
@@ -409,7 +412,7 @@ def add_points_features_to_volume_densities_features(
grid_sizes,
1.0, # point_weight
mask,
True, # align_corners
align_corners, # align_corners
splat,
)