Skip to content

Commit

Permalink
render_flyaround allow forwarding args from visualize_reconstruction
Browse files Browse the repository at this point in the history
Summary: Allows to send kwargs to render_flyaround from visualize_reconstruction

Reviewed By: bottler, shapovalov

Differential Revision: D41157683

fbshipit-source-id: 74d8d7de4e991a31b14e72d76de5efdb8ab4b2c5
  • Loading branch information
davnov134 authored and facebook-github-bot committed Jan 23, 2023
1 parent b95535c commit 1de2d0c
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions projects/implicitron_trainer/visualize_reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def visualize_reconstruction(
visdom_server: str = "http://127.0.0.1",
visdom_port: int = 8097,
visdom_env: Optional[str] = None,
**render_flyaround_kwargs,
) -> None:
"""
Given an `exp_dir` containing a trained Implicitron model, generates videos consisting
Expand All @@ -60,6 +61,8 @@ def visualize_reconstruction(
visdom_server: The address of the visdom server.
visdom_port: The port of the visdom server.
visdom_env: If set, defines a custom name for the visdom environment.
render_flyaround_kwargs: Keyword arguments passed to the invoked `render_flyaround`
function (see `pytorch3d.implicitron.models.visualization.render_flyaround`).
"""

# In case an output directory is specified use it. If no output_directory
Expand Down Expand Up @@ -115,20 +118,22 @@ def visualize_reconstruction(
# iterate over the sequences in the dataset
for sequence_name in dataset.sequence_names():
with torch.no_grad():
render_flyaround(
dataset=dataset,
sequence_name=sequence_name,
model=model,
output_video_path=os.path.join(output_directory, "video"),
n_source_views=n_source_views,
visdom_show_preds=visdom_show_preds,
n_flyaround_poses=n_eval_cameras,
visdom_server=visdom_server,
visdom_port=visdom_port,
visdom_environment=visdom_env,
video_resize=video_size,
device=device,
)
render_kwargs = {
"dataset": dataset,
"sequence_name": sequence_name,
"model": model,
"output_video_path": os.path.join(output_directory, "video"),
"n_source_views": n_source_views,
"visdom_show_preds": visdom_show_preds,
"n_flyaround_poses": n_eval_cameras,
"visdom_server": visdom_server,
"visdom_port": visdom_port,
"visdom_environment": visdom_env,
"video_resize": video_size,
"device": device,
**render_flyaround_kwargs,
}
render_flyaround(**render_kwargs)


enable_get_default_args(visualize_reconstruction)
Expand Down

0 comments on commit 1de2d0c

Please sign in to comment.