mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-07 00:09:14 +08:00
updated benchmarking script (#32)
This commit is contained in:
1 parent
3949739449
commit
bed39763a1
1 file changed
+3
-3
@@ -51,15 +51,15 @@ def main():
|
|||||||
trainer = Trainer(config, local_rank=0, world_size=1)
|
trainer = Trainer(config, local_rank=0, world_size=1)
|
||||||
trainer.setup(test_mode=True)
|
trainer.setup(test_mode=True)
|
||||||
avg_psnr = 0
|
avg_psnr = 0
|
||||||
for step, image_idx in enumerate(config.data.val_image_indices):
|
for step, (camera_ray_bundle, batch) in enumerate(trainer.dataloader_eval):
|
||||||
with torch.no_grad():
|
with torch.no_grad():
|
||||||
psnr = trainer.test_image(image_idx=image_idx, step=step)
|
psnr = trainer.test_image(camera_ray_bundle, batch, step=step)
|
||||||
avg_psnr = (step * avg_psnr + psnr) / (step + 1)
|
avg_psnr = (step * avg_psnr + psnr) / (step + 1)
|
||||||
benchmarks[dataset] = (avg_psnr, ckpt)
|
benchmarks[dataset] = (avg_psnr, ckpt)
|
||||||
GlobalHydra.instance().clear()
|
GlobalHydra.instance().clear()
|
||||||
|
|
||||||
benchmark_info = {"bench": BENCH, "results": benchmarks}
|
benchmark_info = {"bench": BENCH, "results": benchmarks}
|
||||||
timestamp = date.today().strftime("%b-%d-%Y")
|
timestamp = BENCH["benchmark_date"]
|
||||||
json_file = os.path.join(BENCH["hydra_base_dir"], f"{timestamp}.json")
|
json_file = os.path.join(BENCH["hydra_base_dir"], f"{timestamp}.json")
|
||||||
with open(json_file, "w", encoding="utf8") as f:
|
with open(json_file, "w", encoding="utf8") as f:
|
||||||
json.dump(benchmark_info, f, indent=2)
|
json.dump(benchmark_info, f, indent=2)
|
||||||
|
|||||||
Reference in new issue
Block a user