Merge pull request #190 from plenoptix/origamiman72/rays-formatting

Changed Rays / Sec formatting
This commit is contained in:
Abhik Ahuja authored and GitHub committed 2022-07-24 02:19:45 -07:00
commit 31b52ae186
3 files changed
+13 -3

No files matched your search

+2 -2
View File
@@ -67,7 +67,7 @@ Supported Models
+------------------------+------------------------------+----------------------------+
| | PSNR | Rays per sec. |
| | PSNR | Rays / sec. |
+========================+==============================+============================+
| NeRF | |:hourglass_flowing_sand:| | |:hourglass_flowing_sand:| |
+------------------------+------------------------------+----------------------------+
@@ -83,4 +83,4 @@ Indices and Tables
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
* :ref:`search`
+9
View File
@@ -21,6 +21,7 @@ import json
from pydoc import locate
from typing import Any, Dict
from math import floor, log
import torch
from omegaconf import DictConfig
@@ -90,3 +91,11 @@ def get_hash_str_from_dict(dictionary: Dict[str, Any]) -> str:
encoded = json.dumps(dictionary, sort_keys=True).encode()
dhash.update(encoded)
return dhash.hexdigest()
def human_format(num):
"""Format a number in a more human readable way"""
units = ["", "K", "M", "B", "T", "P"]
k = 1000.0
magnitude = int(floor(log(num, k)))
return f"{(num / k**magnitude):.2f} {units[magnitude]}"
+2 -1
View File
@@ -15,6 +15,7 @@ from tqdm import tqdm
from pyrad.cameras.camera_paths import CameraPath, get_interpolated_camera_path, get_spiral_path
from pyrad.data.dataloader import EvalDataloader, setup_dataset_eval, setup_dataset_train
from pyrad.graphs.base import Graph, setup_graph
from pyrad.utils.misc import human_format
from pyrad.utils.writer import TimeWriter
@@ -201,7 +202,7 @@ def main(
avg_rays_per_sec = stats_dict["avg rays per sec"]
avg_fps = stats_dict["avg fps"]
print(f"Avg. PSNR: {avg_psnr:0.4f}")
print(f"Avg. Rays per sec: {avg_rays_per_sec:0.4f}")
print(f"Avg. Rays / Sec: {human_format(avg_rays_per_sec)}")
print(f"Avg. FPS: {avg_fps:0.4f}")
elif method == MethodType.TRAJ:
# TODO(ethan): pass in camera information into argparse parser