fix broken `train_network` argument `display_iters` in the GUI by n-poulsen · Pull Request #2865 · DeepLabCut/DeepLabCut

Hello,

Sorry this is indeed confusing, I agree with you.

Basically:

  • When there was only Tensorflow as DeepLearning engine (before DLC 3.0), the naming was not consistent: the train_network() method exposed this argument as displayiters, but inside the method itself (and in the model configuration file, pose_cfg.yaml), the variable is named display_iters.
  • When Pytorch support has been added (DLC 3.0), the variable has been consistently named display_iters inside the pose_estimation_pytorch submodule. This means that inside pytorch_config.yaml, it is named display_iters, and if you call the Pytorch-specific train_network() method implementation (deeplabcut.pose_estimation_pytorch.train_network()), you specify display_iters.
  • To route API-level methods calls to their implementation with the right Deep Learning Engine, there is the compat.py module. For example, when you call deeplabcut.train_network(), you actually call deeplabcut.compat.train_network(), which itself then calls either deeplabcut.pose_estimation_tensorflow.train_network.py if you have a Tensorflow-based model, or deeplabcut.pose_estimation_pytorch.train_network.py if you have a Pytorch-based model. And in order to stay backwards-compatible with the previous DeepLabCut versions, we had to name the argument displayiters in deeplabcut.compat.train_network() (so that, if a user had a script that was doing deeplabcut.train_network(displayiters=9999) with DLC 2.0, they can still run their script after updating their DLC version to 3.0).

To summarize:

  • When you do deeplabcut.train_network() - pass displayiters
  • In your pytorch_config.yaml, specify display_iters
  • If you use the pytorch module directly (import deeplabcut.pose_estimation_pytorch as dlc_torch, and then dlc_torch.train_network()), pass display_iters.

Thanks for spotting the error in the deeplabcut.train_network() docstring, I opened a PR to fix it, and sorry for the confusing naming. Unfortunately we cannot refactor to make it consistent everywhere, because ensuring full backwards compatibility is a strict requirement of DeepLabCut.