mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-02 13:59:10 +08:00
added flag to view dataset from get-go (#366)
* added logic to comp rays/s on train and vis * added test and fixed vis rays/sec * added flag to just visualize dataset * added new script for viewing only dataset
This commit is contained in:
1 parent
e344396153
commit
e7cca834c8
4 files changed
+56
-4
No files matched your search
@@ -338,6 +338,7 @@ class ViewerConfig(PrintableConfig):
|
||||
|
||||
log_filename: Optional[Path] = None
|
||||
enable: bool = False
|
||||
train: bool = True
|
||||
zmq_url: str = "tcp://127.0.0.1:6000"
|
||||
launch_bridge_server: bool = True
|
||||
websocket_port: int = 7007
|
||||
|
||||
@@ -116,7 +116,9 @@ class Trainer:
|
||||
"""Train the model."""
|
||||
assert self.pipeline.datamanager.train_input_dataset is not None, "Missing DatsetInputs"
|
||||
|
||||
self.visualizer_state.init_scene(dataset=self.pipeline.datamanager.train_input_dataset)
|
||||
self.visualizer_state.init_scene(
|
||||
dataset=self.pipeline.datamanager.train_input_dataset, start_train=self.config.viewer.train
|
||||
)
|
||||
with TimeWriter(writer, EventName.TOTAL_TRAIN_TIME):
|
||||
num_iterations = self.config.trainer.max_num_iterations
|
||||
for step in range(self.start_step, self.start_step + num_iterations):
|
||||
|
||||
@@ -234,13 +234,12 @@ class VisualizerState:
|
||||
|
||||
self.outputs_set = False
|
||||
|
||||
def init_scene(self, dataset: InputDataset) -> None:
|
||||
def init_scene(self, dataset: InputDataset, start_train=True) -> None:
|
||||
"""Draw some images and the scene aabb in the viewer.
|
||||
|
||||
Args:
|
||||
dataset: dataset to render in the scene
|
||||
"""
|
||||
|
||||
# clear the current scene
|
||||
self.vis["sceneState/sceneBounds"].delete()
|
||||
self.vis["sceneState/cameras"].delete()
|
||||
@@ -257,6 +256,9 @@ class VisualizerState:
|
||||
json_ = dataset.dataset_inputs.scene_bounds.to_json()
|
||||
self.vis["sceneState/sceneBounds"].write(json_)
|
||||
|
||||
# set the initial state whether to train or not
|
||||
self.vis["renderingState/isTraining"].write(start_train)
|
||||
|
||||
# set the properties of the camera
|
||||
# self.vis["renderingState/camera"].write(json_)
|
||||
|
||||
@@ -284,7 +286,7 @@ class VisualizerState:
|
||||
local_step = step
|
||||
run_loop = not is_training
|
||||
while run_loop:
|
||||
if self._is_render_step(local_step):
|
||||
if self._is_render_step(local_step) and step > 0:
|
||||
self._render_image_in_viewer(graph)
|
||||
is_training = self.vis["renderingState/isTraining"].read()
|
||||
run_loop = not is_training
|
||||
|
||||
Reference in new issue
Block a user