mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-02 05:48:57 +08:00
1 parent
def6ba5c51
commit
eae6bcb627
1 file changed
+3
-3
+3
-3
@@ -18,7 +18,7 @@ CONSOLE = Console(width=120)
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class ComputePSNR:
|
class ComputePSNR:
|
||||||
"""Load a checkpoint, compute some PSNR metrics, and save to a JSON."""
|
"""Load a checkpoint, compute some PSNR metrics, and save it to a JSON file."""
|
||||||
|
|
||||||
# Path to config YAML file.
|
# Path to config YAML file.
|
||||||
load_config: Path
|
load_config: Path
|
||||||
@@ -28,17 +28,17 @@ class ComputePSNR:
|
|||||||
def main(self) -> None:
|
def main(self) -> None:
|
||||||
"""Main function."""
|
"""Main function."""
|
||||||
config, pipeline, checkpoint_path = eval_setup(self.load_config)
|
config, pipeline, checkpoint_path = eval_setup(self.load_config)
|
||||||
|
|
||||||
assert self.output_path.suffix == ".json"
|
assert self.output_path.suffix == ".json"
|
||||||
metrics_dict = pipeline.get_average_eval_image_metrics()
|
metrics_dict = pipeline.get_average_eval_image_metrics()
|
||||||
# save output to some file
|
|
||||||
self.output_path.parent.mkdir(parents=True, exist_ok=True)
|
self.output_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
# Get the output and define the names to save to
|
||||||
benchmark_info = {
|
benchmark_info = {
|
||||||
"experiment_name": config.experiment_name,
|
"experiment_name": config.experiment_name,
|
||||||
"method_name": config.method_name,
|
"method_name": config.method_name,
|
||||||
"checkpoint": str(checkpoint_path),
|
"checkpoint": str(checkpoint_path),
|
||||||
"results": metrics_dict,
|
"results": metrics_dict,
|
||||||
}
|
}
|
||||||
|
# Save output to output file
|
||||||
self.output_path.write_text(json.dumps(benchmark_info, indent=2), "utf8")
|
self.output_path.write_text(json.dumps(benchmark_info, indent=2), "utf8")
|
||||||
CONSOLE.print(f"Saved results to: {self.output_path}")
|
CONSOLE.print(f"Saved results to: {self.output_path}")
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user