mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-06 15:59:16 +08:00
Merge branch 'main' of https://github.com/nerfstudio-project/nerfstudio
This commit is contained in:
commit
1182b18b48
4 files changed
+14
-10
No files matched your search
@@ -158,7 +158,7 @@ method_configs["nerfacto-huge"] = TrainerConfig(
|
|||||||
mixed_precision=True,
|
mixed_precision=True,
|
||||||
pipeline=VanillaPipelineConfig(
|
pipeline=VanillaPipelineConfig(
|
||||||
datamanager=VanillaDataManagerConfig(
|
datamanager=VanillaDataManagerConfig(
|
||||||
dataparser=NerfstudioDataParserConfig(downscale_factor=1),
|
dataparser=NerfstudioDataParserConfig(),
|
||||||
train_num_rays_per_batch=16384,
|
train_num_rays_per_batch=16384,
|
||||||
eval_num_rays_per_batch=4096,
|
eval_num_rays_per_batch=4096,
|
||||||
camera_optimizer=CameraOptimizerConfig(
|
camera_optimizer=CameraOptimizerConfig(
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
"""Helper utils for processing data into the nerfstudio format."""
|
"""Helper utils for processing data into the nerfstudio format."""
|
||||||
|
|
||||||
import math
|
import math
|
||||||
import os
|
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
@@ -348,11 +347,8 @@ def downscale_images(
|
|||||||
assert isinstance(downscale_factor, int)
|
assert isinstance(downscale_factor, int)
|
||||||
downscale_dir = image_dir.parent / f"{folder_name}_{downscale_factor}"
|
downscale_dir = image_dir.parent / f"{folder_name}_{downscale_factor}"
|
||||||
downscale_dir.mkdir(parents=True, exist_ok=True)
|
downscale_dir.mkdir(parents=True, exist_ok=True)
|
||||||
# Using %05d ffmpeg commands appears to be unreliable (skips images), so use scandir.
|
# Using %05d ffmpeg commands appears to be unreliable (skips images).
|
||||||
files = os.scandir(image_dir)
|
for f in list_images(image_dir):
|
||||||
for f in files:
|
|
||||||
if f.is_dir():
|
|
||||||
continue
|
|
||||||
filename = f.name
|
filename = f.name
|
||||||
nn_flag = "" if not nearest_neighbor else ":flags=neighbor"
|
nn_flag = "" if not nearest_neighbor else ":flags=neighbor"
|
||||||
ffmpeg_cmd = [
|
ffmpeg_cmd = [
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import threading
|
import threading
|
||||||
|
import time
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import TYPE_CHECKING, Any, Dict, Literal, Optional, Tuple, get_args
|
from typing import TYPE_CHECKING, Any, Dict, Literal, Optional, Tuple, get_args
|
||||||
|
|
||||||
@@ -97,12 +98,16 @@ class RenderStateMachine(threading.Thread):
|
|||||||
elif self.next_action == "rerender":
|
elif self.next_action == "rerender":
|
||||||
# never overwrite rerenders
|
# never overwrite rerenders
|
||||||
pass
|
pass
|
||||||
|
elif action.action == "static" and self.next_action.action == "move":
|
||||||
|
# don't overwrite a move action with a static: static is always self-fired
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
# monimal use case, just set the next action
|
# monimal use case, just set the next action
|
||||||
self.next_action = action
|
self.next_action = action
|
||||||
|
|
||||||
# handle interrupt logic
|
# handle interrupt logic
|
||||||
if self.state == "high" and self.next_action.action in ("move", "rerender"):
|
if self.state == "high" and self.next_action.action in ("move", "rerender"):
|
||||||
|
print("interrupting render", self.next_action.action)
|
||||||
self.interrupt_render_flag = True
|
self.interrupt_render_flag = True
|
||||||
self.render_trigger.set()
|
self.render_trigger.set()
|
||||||
|
|
||||||
@@ -176,7 +181,10 @@ class RenderStateMachine(threading.Thread):
|
|||||||
continue
|
continue
|
||||||
self._send_output_to_viewer(outputs)
|
self._send_output_to_viewer(outputs)
|
||||||
# if we rendered a static low res, we need to self-trigger a static high-res
|
# if we rendered a static low res, we need to self-trigger a static high-res
|
||||||
if self.state == "low_static":
|
if self.next_action is None:
|
||||||
|
# if there hasn't been an action, wait for 1/target_fps seconds in case we get another move command
|
||||||
|
time.sleep(1 / self.target_fps)
|
||||||
|
if self.state in ["low_static", "low_move"]:
|
||||||
self.action(RenderAction("static", action.camera_state))
|
self.action(RenderAction("static", action.camera_state))
|
||||||
|
|
||||||
def check_interrupt(self, frame, event, arg):
|
def check_interrupt(self, frame, event, arg):
|
||||||
|
|||||||
@@ -126,8 +126,8 @@ class Viewer:
|
|||||||
|
|
||||||
def _interrupt_render(self, _) -> None:
|
def _interrupt_render(self, _) -> None:
|
||||||
"""Interrupt current render."""
|
"""Interrupt current render."""
|
||||||
if self.camera_message is not None:
|
if self.camera_state is not None:
|
||||||
self.render_statemachine.action(RenderAction("rerender", self.camera_message))
|
self.render_statemachine.action(RenderAction("rerender", self.camera_state))
|
||||||
|
|
||||||
def _crop_params_update(self, _) -> None:
|
def _crop_params_update(self, _) -> None:
|
||||||
"""Update crop parameters"""
|
"""Update crop parameters"""
|
||||||
|
|||||||
Reference in new issue
Block a user