threedb.result_logging.json_logger¶
Subclass of threedb.result_logging.base_logger.BaseLogger.
-
threedb.result_logging.json_logger.clean_key(k: Iterable[str]) → str¶ Utility function for formatting keys. This is a no-op if the input is a string, otherwise expects an iterable of strings, which it joins with a period.
-
threedb.result_logging.json_logger.clean_value(val: Any)¶ Utility function for formatting tensors. Converts torch tensors to numpy, is a no-op for all other types.
-
threedb.result_logging.json_logger.json_default(obj: numpy.ndarray) → str¶ Another utility function; turns floats into strings, otherwise (if the input does not have type
np.float64raises aTypeError.
-
threedb.result_logging.json_logger.clean_log(log_d: dict, key_blacklist: Tuple[str, str] = ('image', 'result_ix')) → dict¶ Cleans a dictionary for log-writing. In particular, all keys (expected to be either strings or iterables of strings) are converted to strings, and all torch tensors are converted to numpy arrays.
-
class
threedb.result_logging.json_logger.JSONLogger(root_dir: str, result_buffer: threedb.utils.CyclicBuffer, config: Dict[str, Dict[str, Any]])¶ Bases:
threedb.result_logging.base_logger.BaseLogger-
__init__(root_dir: str, result_buffer: threedb.utils.CyclicBuffer, config: Dict[str, Dict[str, Any]]) → None¶ A logger that logs all an experiments meta-data and results into a JSON file.
-
log(item: Dict[str, Any]) → None¶ Concrete implementation of
threedb.result_logging.base_logger.BaseLogger.log().- Parameters
item (Dict[str, Any]) – The item to be logged.
-
end()¶ Concrete implementation of
threedb.result_logging.base_logger.BaseLogger.end().Closes the necessary file handle.
-
-
threedb.result_logging.json_logger.Logger¶