-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Address comments to add benchmarkings for cameras and the new fisheye cameras. The dependency functions in test_cameras have been updated in Diff 1. The following two snapshots show benchmarking results. Reviewed By: kjchalup Differential Revision: D38991914 fbshipit-source-id: 51fe9bb7237543e4ee112c9f5068a4cf12a9d482
- Loading branch information
1 parent
2283c29
commit 03562d8
Showing
2 changed files
with
105 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
import itertools | ||
|
||
from fvcore.common.benchmark import benchmark | ||
from tests.test_cameras import TestCamerasCommon | ||
|
||
|
||
def _setUp(): | ||
case_grid = { | ||
"cam_type": [ | ||
"OpenGLOrthographicCameras", | ||
"OpenGLPerspectiveCameras", | ||
"SfMOrthographicCameras", | ||
"SfMPerspectiveCameras", | ||
"FoVOrthographicCameras", | ||
"FoVPerspectiveCameras", | ||
"OrthographicCameras", | ||
"PerspectiveCameras", | ||
"FishEyeCameras", | ||
], | ||
"batch_size": [1, 10], | ||
"num_points": [10, 100], | ||
"device": ["cpu", "cuda:0"], | ||
} | ||
test_cases = itertools.product(*case_grid.values()) | ||
kwargs_list = [dict(zip(case_grid.keys(), case)) for case in test_cases] | ||
return kwargs_list | ||
|
||
|
||
def _bm_cameras_project() -> None: | ||
kwargs_list = _setUp() | ||
benchmark( | ||
TestCamerasCommon.transform_points, | ||
"TEST_TRANSFORM_POINTS", | ||
kwargs_list, | ||
) | ||
|
||
|
||
def _bm_cameras_unproject() -> None: | ||
kwargs_list = _setUp() | ||
benchmark( | ||
TestCamerasCommon.unproject_points, | ||
"TEST_UNPROJECT_POINTS", | ||
kwargs_list, | ||
) | ||
|
||
|
||
def bm_cameras() -> None: | ||
_bm_cameras_project() | ||
_bm_cameras_unproject() | ||
|
||
|
||
if __name__ == "__main__": | ||
bm_cameras() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters