mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-25 02:19:47 +08:00
updating metrics logging (#460)
* integrated changes * update * stratified * black * bump version * upgrade version * improved wandb logging * fix split for eval * comments
This commit is contained in:
1 parent
4c1e443a41
commit
e22eab8c86
22 files changed
+300
-219
No files matched your search
@@ -159,3 +159,8 @@ def scale_dict(dictionary: Dict[Any, Any], coefficients: Dict[str, float]) -> Di
|
||||
if key in coefficients:
|
||||
dictionary[key] *= coefficients[key]
|
||||
return dictionary
|
||||
|
||||
|
||||
def step_check(step, step_size, run_at_zero=False) -> bool:
|
||||
"""Returns true based on current step and step interval."""
|
||||
return (run_at_zero or step != 0) and step % step_size == 0
|
||||
@@ -22,7 +22,7 @@ import logging
|
||||
from abc import abstractmethod
|
||||
from pathlib import Path
|
||||
from time import time
|
||||
from typing import Any, Dict, List, Optional
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
import imageio
|
||||
import numpy as np
|
||||
@@ -79,7 +79,7 @@ def put_image(name, image: TensorType["H", "W", "C"], step: int):
|
||||
|
||||
|
||||
@check_main_thread
|
||||
def put_scalar(name: str, scalar: float, step: int):
|
||||
def put_scalar(name: str, scalar: Any, step: int):
|
||||
"""Setter function to place scalars into the queue to be written out
|
||||
|
||||
Args:
|
||||
@@ -209,7 +209,7 @@ class Writer:
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def write_scalar(self, name: str, scalar: float, step: int) -> None:
|
||||
def write_scalar(self, name: str, scalar: Union[float, torch.Tensor], step: int) -> None:
|
||||
"""Required method to write a single scalar value to the logger
|
||||
|
||||
Args:
|
||||
@@ -272,7 +272,7 @@ class WandbWriter(Writer):
|
||||
image = torch.permute(image, (2, 0, 1))
|
||||
wandb.log({name: wandb.Image(image)}, step=step)
|
||||
|
||||
def write_scalar(self, name: str, scalar: float, step: int) -> None:
|
||||
def write_scalar(self, name: str, scalar: Union[float, torch.Tensor], step: int) -> None:
|
||||
wandb.log({name: scalar}, step=step)
|
||||
|
||||
def write_config(self, name: str, config_dict: Dict[str, Any], step: int):
|
||||
@@ -298,7 +298,7 @@ class TensorboardWriter(Writer):
|
||||
image = to8b(image)
|
||||
self.tb_writer.add_image(name, image, step, dataformats="HWC")
|
||||
|
||||
def write_scalar(self, name: str, scalar: float, step: int) -> None:
|
||||
def write_scalar(self, name: str, scalar: Union[float, torch.Tensor], step: int) -> None:
|
||||
self.tb_writer.add_scalar(name, scalar, step)
|
||||
|
||||
def write_config(self, name: str, config_dict: Dict[str, Any], step: int): # pylint: disable=unused-argument
|
||||
|
||||
Reference in new issue
Block a user