Skip to content

Conversation

@n-poulsen
Copy link
Contributor

This pull request implements features for API methods that were not yet available for PyTorch models.

deeplabcut.analyze_images

The analyze_time_lapse_frames method is added to the PyTorch API, such that it can be called with PyTorch models in the same way as it was for TensorFlow models. Below the hood, it calls the analyze_images method.

The analyze_images (which can only be called for PyTorch models - analyze_time_lapse_frames should still be used for TensorFlow models) is added to the compat.py so that it can be called as:

import deeplabcut

deeplabcut.analyze_images(
    config="path/to/my/project/config.yaml",
    images="/my/image/dir",
    shuffle=12,
)

New features are also added to the analyze_images method as well:

  • Predictions can directly be plot onto images through the plotting parameter. Predictions are plot in the same format as when called with evaluate_network, the only difference being there is no ground truth to plot. The plotting parameters are taken from the project configuration file, and pcutoff, bbox_pcutoff and plot_skeleton allow to dynamically edit some of the parameters controlling plotting.
  • The predictions are now stored as a pandas DataFrame, as with other outputs in DeepLabCut. The predictions can also be saved in CSV files with the save_as_csv parameter.

deeplabcut.analyze_videos

The in_random_order and n_tracks parameters are implemented for video analysis with PyTorch models.

Dynamic cropping (through the dynamic argument) is now available for analyze_videos with PyTorch models. This function is implemented through a DynamicCropper cropper class, which is fully tested.

The greedy, calibrate and window_size arguments still need to be implemented. They are only valid for PAF-models, and require that more information is added to the _full.pickle file when running video analysis. This will be done in a subsequent pull request.

deeplabcut.train_network

The keepdeconvweights argument is implemented, which allows to continue. Two additional arguments are added to the method: epochs and save_epochs. These arguments could already be passed, but making them explicit makes it clearer for users how they can be used.

Copy link
Contributor

@maximpavliv maximpavliv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@MMathisLab MMathisLab merged commit 2fe72e3 into pytorch_dlc Dec 19, 2024
1 check passed
@MMathisLab MMathisLab deleted the niels/missing_torch_api_args branch April 15, 2025 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants