biapy.config.config

Configuration management for BiaPy.

This module defines the Config class, which encapsulates all configuration options for BiaPy workflows using a YACS CfgNode. It provides default values and hierarchical organization for system, data, augmentation, model, loss, training, inference, post-processing, and logging parameters. Utility functions are included for updating dependent configuration variables after merging user-provided configs.

class biapy.config.config.Config(job_dir: str, job_identifier: str)[source]

Bases: object

BiaPy configuration handler.

This class manages the hierarchical configuration for BiaPy experiments, including system resources, problem specification, data loading, augmentation, model architecture, loss functions, training, inference, post-processing, and logging. It uses YACS CfgNode for flexible and robust configuration management.

Variables:

_C (CN) – The root YACS configuration node containing all experiment parameters.

get_cfg_defaults() CfgNode[source]

Get a clone of the default configuration.

Returns:

A cloned YACS CfgNode object with default values.

Return type:

CN

to_dict()[source]

Convert the configuration to a Python dictionary.

Returns:

Dictionary representation of the configuration.

Return type:

dict

copy()[source]

Create a deep copy of the Config object.

Returns:

A deep copy of the current Config instance.

Return type:

Config

biapy.config.config.update_dependencies(cfg) None[source]

Update dependent configuration variables after merging user config.

This function should be called after merging a user-provided .cfg file to ensure that all dependent paths and variables are updated accordingly. That is, this function should be called after YACS’s merge_from_file().

Parameters:

cfg (Config or CN) – The configuration object to update.