spine.utils.inference
Module with helper functions to run inference on a model configuration.
Functions
|
Turns a training configuration into an inference configuration. |
- spine.utils.inference.get_inference_cfg(cfg, file_keys=None, weight_path=None, batch_size=None, num_workers=None, cpu=False)[source]
Turns a training configuration into an inference configuration.
This script does the following: - Turn train to False - Set sequential sampling - Load the specified validation file_keys, if requested - Load the specified set of weight_path, if requested - Reset the batch_size to a different value, if requested - Sets num_workers to a different value, if requested - Make the model run in CPU mode, if requested
- Parameters:
cfg (Union[str, dict]) – Configuration file or Path to the configuration file
file_keys (str, optional) – Path to the dataset to use for inference
weight_path (str, optional) – Path to the weigths to use for inference
batch_size (int, optional) – Number of data samples per batch
num_workers (int, optional) – Number of workers that load data
cpu (bool, default False) – Whether or not to execute the inference on CPU
- Returns:
Dictionary of parameters to initialize handlers
- Return type:
dict