mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-07 00:09:14 +08:00
Tune proposal net eval (#585)
This commit is contained in:
1 parent
5d26f3d5c4
commit
5924802f5c
3 files changed
+58
-9
No files matched your search
@@ -57,7 +57,7 @@ base_configs["proposal"] = Config(
|
|||||||
datamanager=VanillaDataManagerConfig(
|
datamanager=VanillaDataManagerConfig(
|
||||||
dataparser=BlenderDataParserConfig(), train_num_rays_per_batch=4096, eval_num_rays_per_batch=8192
|
dataparser=BlenderDataParserConfig(), train_num_rays_per_batch=4096, eval_num_rays_per_batch=8192
|
||||||
),
|
),
|
||||||
model=ProposalModelConfig(eval_num_rays_per_chunk=8192),
|
model=ProposalModelConfig(eval_num_rays_per_chunk=1 << 16),
|
||||||
),
|
),
|
||||||
optimizers={
|
optimizers={
|
||||||
"proposal_networks": {
|
"proposal_networks": {
|
||||||
@@ -69,7 +69,7 @@ base_configs["proposal"] = Config(
|
|||||||
"scheduler": None,
|
"scheduler": None,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
viewer=ViewerConfig(num_rays_per_chunk=2 << 15),
|
viewer=ViewerConfig(num_rays_per_chunk=1 << 16),
|
||||||
vis=["viewer"],
|
vis=["viewer"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# Copyright 2022 The Plenoptix Team. All rights reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
"""Additional rich ui components"""
|
||||||
|
|
||||||
|
from rich.progress import ProgressColumn
|
||||||
|
from rich.text import Text
|
||||||
|
|
||||||
|
|
||||||
|
class ItersPerSecColumn(ProgressColumn):
|
||||||
|
"""Renders human readable fps."""
|
||||||
|
|
||||||
|
def __init__(self, suffix="it/s") -> None:
|
||||||
|
super().__init__()
|
||||||
|
self.suffix = suffix
|
||||||
|
|
||||||
|
def render(self, task: "Task") -> Text:
|
||||||
|
"""Show data transfer speed."""
|
||||||
|
speed = task.finished_speed or task.speed
|
||||||
|
if speed is None:
|
||||||
|
return Text("?", style="progress.data.speed")
|
||||||
|
return Text(f"{speed:.2f} {self.suffix}", style="progress.data.speed")
|
||||||
+23
-7
@@ -17,13 +17,20 @@ import mediapy as media
|
|||||||
import torch
|
import torch
|
||||||
import yaml
|
import yaml
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
from rich.progress import track
|
from rich.progress import (
|
||||||
|
BarColumn,
|
||||||
|
Progress,
|
||||||
|
TaskProgressColumn,
|
||||||
|
TextColumn,
|
||||||
|
TimeRemainingColumn,
|
||||||
|
)
|
||||||
from typing_extensions import assert_never
|
from typing_extensions import assert_never
|
||||||
|
|
||||||
from nerfactory.cameras.camera_paths import get_path_from_json, get_spiral_path
|
from nerfactory.cameras.camera_paths import get_path_from_json, get_spiral_path
|
||||||
from nerfactory.cameras.cameras import Cameras
|
from nerfactory.cameras.cameras import Cameras
|
||||||
from nerfactory.configs import base as cfg
|
from nerfactory.configs import base as cfg
|
||||||
from nerfactory.pipelines.base import Pipeline
|
from nerfactory.pipelines.base import Pipeline
|
||||||
|
from nerfactory.utils.rich import ItersPerSecColumn
|
||||||
|
|
||||||
console = Console(width=120)
|
console = Console(width=120)
|
||||||
|
|
||||||
@@ -73,12 +80,21 @@ def _render_trajectory_video(
|
|||||||
console.print("[bold green]Creating trajectory video")
|
console.print("[bold green]Creating trajectory video")
|
||||||
images = []
|
images = []
|
||||||
cameras.rescale_output_resolution(rendered_resolution_scaling_factor)
|
cameras.rescale_output_resolution(rendered_resolution_scaling_factor)
|
||||||
for camera_idx in track(range(cameras.size), description=":movie_camera: Rendering :movie_camera:"):
|
|
||||||
camera_ray_bundle = cameras.generate_rays(camera_indices=camera_idx).to(pipeline.device)
|
progress = Progress(
|
||||||
with torch.no_grad():
|
TextColumn(":movie_camera: Rendering :movie_camera:"),
|
||||||
outputs = pipeline.model.get_outputs_for_camera_ray_bundle(camera_ray_bundle)
|
BarColumn(),
|
||||||
image = outputs[rendered_output_name].cpu().numpy()
|
TaskProgressColumn(show_speed=True),
|
||||||
images.append(image)
|
ItersPerSecColumn(suffix="fps"),
|
||||||
|
TimeRemainingColumn(elapsed_when_finished=True, compact=True),
|
||||||
|
)
|
||||||
|
with progress:
|
||||||
|
for camera_idx in progress.track(range(cameras.size), description=""):
|
||||||
|
camera_ray_bundle = cameras.generate_rays(camera_indices=camera_idx).to(pipeline.device)
|
||||||
|
with torch.no_grad():
|
||||||
|
outputs = pipeline.model.get_outputs_for_camera_ray_bundle(camera_ray_bundle)
|
||||||
|
image = outputs[rendered_output_name].cpu().numpy()
|
||||||
|
images.append(image)
|
||||||
|
|
||||||
fps = len(images) / seconds
|
fps = len(images) / seconds
|
||||||
with console.status("[yellow]Saving video", spinner="bouncingBall"):
|
with console.status("[yellow]Saving video", spinner="bouncingBall"):
|
||||||
|
|||||||
Reference in new issue
Block a user