pytorch3d/tests/bm_marching_cubes.py
Nikhila Ravi ebac66daeb Classic Marching Cubes algorithm implementation
Summary:
Defines a function to run marching cubes algorithm on a single or batch of 3D scalar fields. Returns a mesh's faces and vertices.

UPDATES (12/18)
- Input data is now specified as a (B, D, H, W) tensor as opposed to a (B, W, H, D) tensor. This will now be compatible with the Volumes datastructure.
- Add an option to return output vertices in local coordinates instead of world coordinates.
Also added a small fix to remove the dype for device in Transforms3D - if passing in a torch.device instead of str it causes a pyre error.

Reviewed By: jcjohnson

Differential Revision: D24599019

fbshipit-source-id: 90554a200319fed8736a12371cc349e7108aacd0
2020-12-18 07:25:50 -08:00

26 lines
642 B
Python

# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
from fvcore.common.benchmark import benchmark
from test_marching_cubes import TestMarchingCubes
def bm_marching_cubes() -> None:
kwargs_list = [
{"batch_size": 1, "V": 5},
{"batch_size": 1, "V": 10},
{"batch_size": 1, "V": 20},
{"batch_size": 1, "V": 40},
{"batch_size": 5, "V": 5},
{"batch_size": 20, "V": 20},
]
benchmark(
TestMarchingCubes.marching_cubes_with_init,
"MARCHING_CUBES",
kwargs_list,
warmup_iters=1,
)
if __name__ == "__main__":
bm_marching_cubes()