mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-03 22:38:48 +08:00
Fixed testing and added graph abstractions (#64)
* abstracted some test logic and actually using test images now * moved logging from trainer to graph * fixing dataset path * refactored instant ngp code to use inheritance * fixed my run_train * fixed data path * fixed data dir
This commit is contained in:
1 parent
e83ce4f61b
commit
5fb3d14304
26 files changed
+8526
-270
No files matched your search
@@ -2,6 +2,8 @@
|
||||
Miscellaneous helper code.
|
||||
"""
|
||||
|
||||
import torch
|
||||
|
||||
|
||||
class DotDict(dict):
|
||||
"""
|
||||
@@ -13,3 +15,25 @@ class DotDict(dict):
|
||||
|
||||
__setattr__ = dict.__setitem__
|
||||
__delattr__ = dict.__delitem__
|
||||
|
||||
|
||||
def get_dict_to_torch(stuff, device="cpu"):
|
||||
"""Set everything in the dict to the specified torch device."""
|
||||
if isinstance(stuff, dict):
|
||||
for k, v in stuff.items():
|
||||
stuff[k] = get_dict_to_torch(v, device)
|
||||
return stuff
|
||||
if isinstance(stuff, torch.Tensor):
|
||||
return stuff.to(device)
|
||||
return stuff
|
||||
|
||||
|
||||
def get_dict_to_cpu(stuff):
|
||||
"""Set everything in the dict to CPU."""
|
||||
if isinstance(stuff, dict):
|
||||
for k, v in stuff.items():
|
||||
stuff[k] = get_dict_to_cpu(v)
|
||||
return stuff
|
||||
if isinstance(stuff, torch.Tensor):
|
||||
return stuff.detach().cpu()
|
||||
return stuff
|
||||
@@ -44,8 +44,8 @@ class Stats(enum.Enum):
|
||||
enum (_type_): _description_
|
||||
"""
|
||||
|
||||
ITER_LOAD_TIME = "Data Load (time)"
|
||||
ITER_TRAIN_TIME = "Train Iter (time)"
|
||||
ITER_LOAD_TIME = "Data Load (ms)"
|
||||
ITER_TRAIN_TIME = "Train Iter (ms)"
|
||||
TOTAL_TRAIN_TIME = "Train Total (time)"
|
||||
RAYS_PER_SEC = "Rays Per Sec (1/s)"
|
||||
CURR_TEST_PSNR = "Test PSNR"
|
||||
@@ -145,6 +145,9 @@ class StatsTracker:
|
||||
for k, v in self.stats_dict.items():
|
||||
if "(time)" in k.value:
|
||||
v = str(datetime.timedelta(seconds=v))
|
||||
elif "(ms)" in k.value:
|
||||
ms = v * 1e3
|
||||
v = f"{ms:0.4f}"
|
||||
else:
|
||||
v = f"{v:0.4f}"
|
||||
curr_mssg += f"{v:<20} "
|
||||
|
||||
Reference in new issue
Block a user