mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 20:02:49 +08:00
Summary: The iterative closest point algorithm - point-to-point version. Output of `bm_iterative_closest_point`: Argument key: `batch_size dim n_points_X n_points_Y use_pointclouds` ``` Benchmark Avg Time(μs) Peak Time(μs) Iterations -------------------------------------------------------------------------------- IterativeClosestPoint_1_3_100_100_False 107569 111323 5 IterativeClosestPoint_1_3_100_1000_False 118972 122306 5 IterativeClosestPoint_1_3_1000_100_False 108576 110978 5 IterativeClosestPoint_1_3_1000_1000_False 331836 333515 2 IterativeClosestPoint_1_20_100_100_False 134387 137842 4 IterativeClosestPoint_1_20_100_1000_False 149218 153405 4 IterativeClosestPoint_1_20_1000_100_False 414248 416595 2 IterativeClosestPoint_1_20_1000_1000_False 374318 374662 2 IterativeClosestPoint_10_3_100_100_False 539852 539852 1 IterativeClosestPoint_10_3_100_1000_False 752784 752784 1 IterativeClosestPoint_10_3_1000_100_False 1070700 1070700 1 IterativeClosestPoint_10_3_1000_1000_False 1164020 1164020 1 IterativeClosestPoint_10_20_100_100_False 374548 377337 2 IterativeClosestPoint_10_20_100_1000_False 472764 476685 2 IterativeClosestPoint_10_20_1000_100_False 1457175 1457175 1 IterativeClosestPoint_10_20_1000_1000_False 2195820 2195820 1 IterativeClosestPoint_1_3_100_100_True 110084 115824 5 IterativeClosestPoint_1_3_100_1000_True 142728 147696 4 IterativeClosestPoint_1_3_1000_100_True 212966 213966 3 IterativeClosestPoint_1_3_1000_1000_True 369130 375114 2 IterativeClosestPoint_10_3_100_100_True 354615 355179 2 IterativeClosestPoint_10_3_100_1000_True 451815 452704 2 IterativeClosestPoint_10_3_1000_100_True 511833 511833 1 IterativeClosestPoint_10_3_1000_1000_True 798453 798453 1 -------------------------------------------------------------------------------- ``` Reviewed By: shapovalov, gkioxari Differential Revision: D19909952 fbshipit-source-id: f77fadc88fb7c53999909d594114b182ee2a3def
73 lines
2.1 KiB
Python
73 lines
2.1 KiB
Python
#!/usr/bin/env python3
|
|
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
|
|
|
|
from copy import deepcopy
|
|
from itertools import product
|
|
|
|
from fvcore.common.benchmark import benchmark
|
|
from test_points_alignment import TestCorrespondingPointsAlignment, TestICP
|
|
|
|
|
|
def bm_iterative_closest_point() -> None:
|
|
|
|
case_grid = {
|
|
"batch_size": [1, 10],
|
|
"dim": [3, 20],
|
|
"n_points_X": [100, 1000],
|
|
"n_points_Y": [100, 1000],
|
|
"use_pointclouds": [False],
|
|
}
|
|
|
|
test_args = sorted(case_grid.keys())
|
|
test_cases = product(*case_grid.values())
|
|
kwargs_list = [dict(zip(test_args, case)) for case in test_cases]
|
|
|
|
# add the use_pointclouds=True test cases whenever we have dim==3
|
|
kwargs_to_add = []
|
|
for entry in kwargs_list:
|
|
if entry["dim"] == 3:
|
|
entry_add = deepcopy(entry)
|
|
entry_add["use_pointclouds"] = True
|
|
kwargs_to_add.append(entry_add)
|
|
kwargs_list.extend(kwargs_to_add)
|
|
|
|
benchmark(
|
|
TestICP.iterative_closest_point,
|
|
"IterativeClosestPoint",
|
|
kwargs_list,
|
|
warmup_iters=1,
|
|
)
|
|
|
|
|
|
def bm_corresponding_points_alignment() -> None:
|
|
|
|
case_grid = {
|
|
"allow_reflection": [True, False],
|
|
"batch_size": [1, 10, 100],
|
|
"dim": [3, 20],
|
|
"estimate_scale": [True, False],
|
|
"n_points": [100, 10000],
|
|
"random_weights": [False, True],
|
|
"use_pointclouds": [False],
|
|
}
|
|
|
|
test_args = sorted(case_grid.keys())
|
|
test_cases = product(*case_grid.values())
|
|
kwargs_list = [dict(zip(test_args, case)) for case in test_cases]
|
|
|
|
# add the use_pointclouds=True test cases whenever we have dim==3
|
|
kwargs_to_add = []
|
|
for entry in kwargs_list:
|
|
if entry["dim"] == 3:
|
|
entry_add = deepcopy(entry)
|
|
entry_add["use_pointclouds"] = True
|
|
kwargs_to_add.append(entry_add)
|
|
kwargs_list.extend(kwargs_to_add)
|
|
|
|
benchmark(
|
|
TestCorrespondingPointsAlignment.corresponding_points_alignment,
|
|
"CorrespodingPointsAlignment",
|
|
kwargs_list,
|
|
warmup_iters=1,
|
|
)
|