Commit bea84a6f authored by David Novotny's avatar David Novotny Committed by Facebook GitHub Bot
Browse files

voxel_grid_if -> remove union type from the settings.

Summary: see title

Reviewed By: shapovalov

Differential Revision: D40803670

fbshipit-source-id: 211189167837af577d6502a698e2f3fb3aec3e30
parent f711c4bf
...@@ -420,7 +420,7 @@ model_factory_ImplicitronModelFactory_args: ...@@ -420,7 +420,7 @@ model_factory_ImplicitronModelFactory_args:
- 128 - 128
- 128 - 128
scaffold_empty_space_threshold: 0.001 scaffold_empty_space_threshold: 0.001
scaffold_occupancy_chunk_size: 'inf' scaffold_occupancy_chunk_size: -1
scaffold_max_pool_kernel_size: 3 scaffold_max_pool_kernel_size: 3
scaffold_filter_points: true scaffold_filter_points: true
volume_cropping_epochs: [] volume_cropping_epochs: []
......
...@@ -126,7 +126,8 @@ class VoxelGridImplicitFunction(ImplicitFunctionBase, torch.nn.Module): ...@@ -126,7 +126,8 @@ class VoxelGridImplicitFunction(ImplicitFunctionBase, torch.nn.Module):
every voxel, this calculation can be split into scaffold depth number of xy plane every voxel, this calculation can be split into scaffold depth number of xy plane
calculations if you want the lowest memory usage, one calculation to calculate the calculations if you want the lowest memory usage, one calculation to calculate the
whole scaffold, but with higher memory footprint or any other number of planes. whole scaffold, but with higher memory footprint or any other number of planes.
Setting to 'inf' calculates all planes at the same time. Defaults to 'inf'. Setting to a non-positive number calculates all planes at the same time.
Defaults to '-1' (=calculating all planes).
scaffold_max_pool_kernel_size (int): Size of the pooling region to use when scaffold_max_pool_kernel_size (int): Size of the pooling region to use when
calculating the scaffold. Defaults to 3. calculating the scaffold. Defaults to 3.
scaffold_filter_points (bool): If set to True the points will be filtered using scaffold_filter_points (bool): If set to True the points will be filtered using
...@@ -173,7 +174,7 @@ class VoxelGridImplicitFunction(ImplicitFunctionBase, torch.nn.Module): ...@@ -173,7 +174,7 @@ class VoxelGridImplicitFunction(ImplicitFunctionBase, torch.nn.Module):
scaffold_calculating_epochs: Tuple[int, ...] = () scaffold_calculating_epochs: Tuple[int, ...] = ()
scaffold_resolution: Tuple[int, int, int] = (128, 128, 128) scaffold_resolution: Tuple[int, int, int] = (128, 128, 128)
scaffold_empty_space_threshold: float = 0.001 scaffold_empty_space_threshold: float = 0.001
scaffold_occupancy_chunk_size: Union[str, int] = "inf" scaffold_occupancy_chunk_size: int = -1
scaffold_max_pool_kernel_size: int = 3 scaffold_max_pool_kernel_size: int = 3
scaffold_filter_points: bool = True scaffold_filter_points: bool = True
...@@ -199,11 +200,6 @@ class VoxelGridImplicitFunction(ImplicitFunctionBase, torch.nn.Module): ...@@ -199,11 +200,6 @@ class VoxelGridImplicitFunction(ImplicitFunctionBase, torch.nn.Module):
) )
# pyre-ignore[16] # pyre-ignore[16]
self._scaffold_ready = False self._scaffold_ready = False
if type(self.scaffold_occupancy_chunk_size) != int:
if self.scaffold_occupancy_chunk_size != "inf":
raise ValueError(
"`scaffold_occupancy_chunk_size` has to be int or 'inf'."
)
def forward( def forward(
self, self,
...@@ -504,7 +500,7 @@ class VoxelGridImplicitFunction(ImplicitFunctionBase, torch.nn.Module): ...@@ -504,7 +500,7 @@ class VoxelGridImplicitFunction(ImplicitFunctionBase, torch.nn.Module):
chunk_size = ( chunk_size = (
self.scaffold_occupancy_chunk_size self.scaffold_occupancy_chunk_size
if type(self.scaffold_occupancy_chunk_size) == int if self.scaffold_occupancy_chunk_size > 0
else points.shape[-1] else points.shape[-1]
) )
for k in range(0, points.shape[-1], chunk_size): for k in range(0, points.shape[-1], chunk_size):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment