MCPcopy Create free account
hub / github.com/DeepLabCut/DeepLabCut / train_network

Function train_network

deeplabcut/compat.py:66–312  ·  view source on GitHub ↗

Trains the network with the labels in the training dataset. Parameters ---------- config : string Full path of the config.yaml file as a string. shuffle: int, optional, default=1 Integer value specifying the shuffle index to select for training. trainingsetinde

(
    config: str | Path,
    shuffle: int = 1,
    trainingsetindex: int = 0,
    max_snapshots_to_keep: int | None = None,
    display_iters: int | None = None,
    save_iters: int | None = None,
    max_iters: int | None = None,
    epochs: int | None = None,
    save_epochs: int | None = None,
    allow_growth: bool = True,
    gputouse: str | None = None,
    autotune: bool = False,
    keepdeconvweights: bool = True,
    modelprefix: str = "",
    superanimal_name: str = "",
    superanimal_transfer_learning: bool = False,
    engine: Engine | None = None,
    device: str | None = None,
    snapshot_path: str | Path | None = None,
    detector_path: str | Path | None = None,
    batch_size: int | None = None,
    detector_batch_size: int | None = None,
    detector_epochs: int | None = None,
    detector_save_epochs: int | None = None,
    pose_threshold: float | None = 0.1,
    pytorch_cfg_updates: dict | None = None,
)

Source from the content-addressed store, hash-verified

64@renamed_parameter(old="saveiters", new="save_iters", since="3.0.0")
65@renamed_parameter(old="displayiters", new="display_iters", since="3.0.0")
66def train_network(
67 config: str | Path,
68 shuffle: int = 1,
69 trainingsetindex: int = 0,
70 max_snapshots_to_keep: int | None = None,
71 display_iters: int | None = None,
72 save_iters: int | None = None,
73 max_iters: int | None = None,
74 epochs: int | None = None,
75 save_epochs: int | None = None,
76 allow_growth: bool = True,
77 gputouse: str | None = None,
78 autotune: bool = False,
79 keepdeconvweights: bool = True,
80 modelprefix: str = "",
81 superanimal_name: str = "",
82 superanimal_transfer_learning: bool = False,
83 engine: Engine | None = None,
84 device: str | None = None,
85 snapshot_path: str | Path | None = None,
86 detector_path: str | Path | None = None,
87 batch_size: int | None = None,
88 detector_batch_size: int | None = None,
89 detector_epochs: int | None = None,
90 detector_save_epochs: int | None = None,
91 pose_threshold: float | None = 0.1,
92 pytorch_cfg_updates: dict | None = None,
93):
94 """Trains the network with the labels in the training dataset.
95
96 Parameters
97 ----------
98 config : string
99 Full path of the config.yaml file as a string.
100
101 shuffle: int, optional, default=1
102 Integer value specifying the shuffle index to select for training.
103
104 trainingsetindex: int, optional, default=0
105 Integer specifying which TrainingsetFraction to use.
106 Note that TrainingFraction is a list in config.yaml.
107
108 max_snapshots_to_keep: int or None
109 Sets how many snapshots are kept, i.e. states of the trained network. Every
110 saving iteration many times a snapshot is stored, however only the last
111 ``max_snapshots_to_keep`` many are kept! If you change this to None, then all
112 are kept.
113 See: https://github.com/DeepLabCut/DeepLabCut/issues/8#issuecomment-387404835
114
115 display_iters: optional, default=None
116 This variable is actually set in ``pose_config.yaml``. However, you can
117 overwrite it with this hack. Don't use this regularly, just if you are too lazy
118 to dig out the ``pose_config.yaml`` file for the corresponding project. If
119 ``None``, the value from there is used, otherwise it is overwritten!
120
121 save_iters: optional, default=None
122 Only for the TensorFlow engine (for the PyTorch engine see the ``torch_kwargs``:
123 you can use ``save_epochs``).

Callers

nothing calls this directly

Calls 3

get_shuffle_engineFunction · 0.90
train_networkFunction · 0.90
_load_configFunction · 0.85

Tested by

no test coverage detected