nerfbaselines.training

class nerfbaselines.training.MetricsAccumulator(options: Dict[str, Literal['average', 'last', 'sum']] | None = None)[source]

Bases: object

pop() Dict[str, float | int][source]
update(metrics: Dict[str, float | int]) None[source]
class nerfbaselines.training.ResourcesUtilizationInfo[source]

Bases: TypedDict

gpu_memory: int
gpu_name: str
memory: int
class nerfbaselines.training.Trainer(*, train_dataset: ~nerfbaselines._types.Dataset, test_dataset: ~nerfbaselines._types.Dataset | None = None, method: ~nerfbaselines._types.Method, output: str = '.', save_iters: ~nerfbaselines.utils.Indices = ::10000, eval_few_iters: ~nerfbaselines.utils.Indices = 2000::2000, eval_all_iters: ~nerfbaselines.utils.Indices = -1, logger: ~typing.Callable[[str], ~nerfbaselines._types.Logger] | ~nerfbaselines._types.Logger | None = None, generate_output_artifact: bool | None = None, config_overrides: ~typing.Dict[str, ~typing.Any] | None = None, applied_presets: ~typing.FrozenSet[str] | None = None)[source]

Bases: object

eval_all()[source]
eval_few()[source]
get_logger() Logger[source]
property num_iterations
save()[source]
train()[source]
train_iteration()[source]
nerfbaselines.training.build_logger(loggers: FrozenSet[str]) Callable[[str], Logger][source]

Validates the list of loggers and builds a logger object. It returns a lazy function that initializes the logger when called.

Parameters:

loggers – Set of loggers to use

Returns:

A function that initializes the logger when called. It takes the output directory as it’s argument

nerfbaselines.training.eval_all(method: Method, logger: Logger | None, dataset: Dataset, *, output: str, step: int, evaluation_protocol: EvaluationProtocol, split: str, nb_info)[source]
nerfbaselines.training.eval_few(method: Method, logger: Logger, dataset: Dataset, *, split: str, step, evaluation_protocol: EvaluationProtocol)[source]
nerfbaselines.training.get_presets_and_config_overrides(method_spec: MethodSpec, dataset_metadata: Dict, *, presets=None, config_overrides=None)[source]

Given a method spec, dataset metadata, and the optional list of presets from the user, this function computes the list of presets that should be applied. The presets are then applied to obtain config_overrides which are merged with the provided config_overrides.

Parameters:
  • method_spec – Method spec

  • dataset_metadata – Dataset metadata

  • presets – List of presets to apply or a special “@auto” preset that will automatically apply presets based on the dataset metadata

  • config_overrides – Config overrides to be applied after all presets were processed

Returns:

List of applied presets, final config overrides

Return type:

Tuple

nerfbaselines.training.get_resources_utilization_info(pid: int | None = None) ResourcesUtilizationInfo[source]
nerfbaselines.training.make_image_grid(*images: ndarray, ncol=None, padding=2, max_width=1920, background: None | Tuple[float, float, float] | ndarray = None)[source]