MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / cfg_from_file

Function cfg_from_file

deeplabcut/pose_estimation_tensorflow/config.py:43–64  ·  view source on GitHub ↗

Load a config from file filename and merge it into the default options.

(filename)

Source from the content-addressed store, hash-verified

41
42
43def cfg_from_file(filename):
44 """Load a config from file filename and merge it into the default options."""
45 with open(filename) as f:
46 yaml_cfg = yaml.load(f, Loader=yaml.SafeLoader)
47
48 # Update the snapshot path to the corresponding path!
49 trainpath = str(filename).split("pose_cfg.yaml")[0]
50 yaml_cfg["snapshot_prefix"] = trainpath + "snapshot"
51 # the default is: "./snapshot"
52
53 # reloading defaults, as they can bleed over from a previous run otherwise
54 import importlib
55
56 from . import default_config
57
58 importlib.reload(default_config)
59
60 default_cfg = default_config.cfg
61 _merge_a_into_b(yaml_cfg, default_cfg)
62
63 logging.info("Config:\n" + pprint.pformat(default_cfg))
64 return default_cfg # updated
65
66
67def load_config(filename="pose_cfg.yaml"):

Callers 1

load_configFunction · 0.85

Calls 3

_merge_a_into_bFunction · 0.85
loadMethod · 0.80
splitMethod · 0.45

Tested by

no test coverage detected