mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 03:42:50 +08:00
Rename mesh I/O benchmarks and associated methods
Summary: Rename mesh I/O benchmarks and associated methods: - add `simple` qualifier (benchmark on more realistic mesh data to be added later) - align naming between OBJ and PLY - prefix with `bm_` to make the benchmarking purpose clear(er) Reviewed By: nikhilaravi Differential Revision: D20390764 fbshipit-source-id: 7714520abfcfe1125067f3c52f7ce19bca359574
This commit is contained in:
parent
3c71ab64cc
commit
797e468e45
@ -7,26 +7,32 @@ from test_ply_io import TestMeshPlyIO
|
||||
|
||||
|
||||
def bm_save_load() -> None:
|
||||
kwargs_list = [
|
||||
simple_kwargs_list = [
|
||||
{"V": 100, "F": 300},
|
||||
{"V": 1000, "F": 3000},
|
||||
{"V": 10000, "F": 30000},
|
||||
]
|
||||
benchmark(
|
||||
TestMeshObjIO.load_obj_with_init,
|
||||
"LOAD_OBJ",
|
||||
kwargs_list,
|
||||
TestMeshObjIO.bm_load_simple_obj_with_init,
|
||||
"LOAD_SIMPLE_OBJ",
|
||||
simple_kwargs_list,
|
||||
warmup_iters=1,
|
||||
)
|
||||
benchmark(
|
||||
TestMeshObjIO.save_obj_with_init,
|
||||
"SAVE_OBJ",
|
||||
kwargs_list,
|
||||
TestMeshObjIO.bm_save_simple_obj_with_init,
|
||||
"SAVE_SIMPLE_OBJ",
|
||||
simple_kwargs_list,
|
||||
warmup_iters=1,
|
||||
)
|
||||
benchmark(
|
||||
TestMeshPlyIO.load_ply_bm, "LOAD_PLY", kwargs_list, warmup_iters=1
|
||||
TestMeshPlyIO.bm_load_simple_ply_with_init,
|
||||
"LOAD_SIMPLE_PLY",
|
||||
simple_kwargs_list,
|
||||
warmup_iters=1,
|
||||
)
|
||||
benchmark(
|
||||
TestMeshPlyIO.save_ply_bm, "SAVE_PLY", kwargs_list, warmup_iters=1
|
||||
TestMeshPlyIO.bm_save_simple_ply_with_init,
|
||||
"SAVE_SIMPLE_PLY",
|
||||
simple_kwargs_list,
|
||||
warmup_iters=1,
|
||||
)
|
||||
|
@ -602,7 +602,7 @@ class TestMeshObjIO(TestCaseMixin, unittest.TestCase):
|
||||
self.assertClose(cow3_tea.faces_list()[3], mesh_teapot.faces_list()[0])
|
||||
|
||||
@staticmethod
|
||||
def save_obj_with_init(V: int, F: int):
|
||||
def bm_save_simple_obj_with_init(V: int, F: int):
|
||||
verts_list = torch.tensor(V * [[0.11, 0.22, 0.33]]).view(-1, 3)
|
||||
faces_list = torch.tensor(F * [[1, 2, 3]]).view(-1, 3)
|
||||
obj_file = StringIO()
|
||||
@ -613,7 +613,7 @@ class TestMeshObjIO(TestCaseMixin, unittest.TestCase):
|
||||
return save_mesh
|
||||
|
||||
@staticmethod
|
||||
def load_obj_with_init(V: int, F: int):
|
||||
def bm_load_simple_obj_with_init(V: int, F: int):
|
||||
obj = "\n".join(["v 0.1 0.2 0.3"] * V + ["f 1 2 3"] * F)
|
||||
|
||||
def load_mesh():
|
||||
|
@ -407,7 +407,7 @@ class TestMeshPlyIO(TestCaseMixin, unittest.TestCase):
|
||||
load_ply(StringIO("\n".join(lines2)))
|
||||
|
||||
@staticmethod
|
||||
def save_ply_bm(V: int, F: int):
|
||||
def bm_save_simple_ply_with_init(V: int, F: int):
|
||||
verts_list = torch.tensor(V * [[0.11, 0.22, 0.33]]).view(-1, 3)
|
||||
faces_list = torch.tensor(F * [[0, 1, 2]]).view(-1, 3)
|
||||
|
||||
@ -418,7 +418,7 @@ class TestMeshPlyIO(TestCaseMixin, unittest.TestCase):
|
||||
return save_mesh
|
||||
|
||||
@staticmethod
|
||||
def load_ply_bm(V: int, F: int):
|
||||
def bm_load_simple_ply_with_init(V: int, F: int):
|
||||
verts = torch.tensor([[0.1, 0.2, 0.3]]).expand(V, 3)
|
||||
faces = torch.tensor([[0, 1, 2]], dtype=torch.int64).expand(F, 3)
|
||||
ply_file = StringIO()
|
||||
|
Loading…
x
Reference in New Issue
Block a user