Load a config from file filename and merge it into the default options.
Source code in deeplabcut/pose_estimation_tensorflow/config.py
| def cfg_from_file(filename):
"""Load a config from file filename and merge it into the default options."""
with open(filename) as f:
yaml_cfg = yaml.load(f, Loader=yaml.SafeLoader)
# Update the snapshot path to the corresponding path!
trainpath = str(filename).split("pose_cfg.yaml")[0]
yaml_cfg["snapshot_prefix"] = trainpath + "snapshot"
# the default is: "./snapshot"
# reloading defaults, as they can bleed over from a previous run otherwise
import importlib
from . import default_config
importlib.reload(default_config)
default_cfg = default_config.cfg
_merge_a_into_b(yaml_cfg, default_cfg)
logging.info("Config:\n" + pprint.pformat(default_cfg))
return default_cfg # updated
|