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:
Ethan Weber authored and GitHub committed 2022-05-09 11:54:40 -07:00
1 parent e83ce4f61b
commit 5fb3d14304
26 files changed
+8526 -270

No files matched your search

+24
View File
@@ -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
+5 -2
View File
@@ -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} "