-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Implement create_pretrained_project() for Pytorch engine #2897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement create_pretrained_project() for Pytorch engine #2897
Conversation
create_pretrained_project() for Pytorch engine
create_pretrained_project() for Pytorch engine|
The Tensorflow implementation of |
ae721ac to
ea78c81
Compare
9324d57 to
48f0fd4
Compare
n-poulsen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @maximpavliv, thanks! just one minor comment
48f0fd4 to
0c4db27
Compare
In original/tf methods (f.ex. analyze_videos), default value of videotype was "", this default value was not treated properly in list_videos_in_folder()
Move read_config_as_dict, write_config and pretty_print to core
When calling read_config, the superanimal yaml config in the repo was modified
0c4db27 to
a67974b
Compare
This Pull Request adds Pytorch support for the
create_pretrained_project()method (and closes #2732)Specifically:
create_pretrained_project()becomes acompat.py-like method, and calls the specific method implementation based on the specifiedengineparameter.The old
create_pretrained_project()is renamed tocreate_pretrained_project_tensorflow()and a newcreate_pretrained_project_pytorch()method with the Pytorch-shuffle logic is added.The existing usages of
create_pretrained_project()are also adapted.create_pretrained_project_*implementations call_create_training_datasets_metadata().This method has been cherry-picked from [WIP] DLC 3.0 - Review documentation #2881(where a first version,
_create_and_save_fake_metadata(), has been implemented as a temporary fix), and adapted to work with both Tensorflow and Pytorch. It creates themetadata.yamlfile in the training-datasets directory, and fills it with a first shuffle corresponding to the downloaded modelzoo model._process_videos(), and called by bothcreate_pretrained_project_*implementations.individualsparameter is added tocreate_new_project()and tocreate_pretrained_project(), so that the list of individuals can be automatically filled in the different configuration files of the new project.create_pretrained_project(engine=Engine.PYTORCH)is added.This Pull Request also does some fixes to issues that have been spotted during its development:
list_videos_in_folder(): in original (Tensorflow-implementation) methods (f.ex.analyze_videos()),videotypeargument's value by default was""(instead ofNone), and this default argument value was not treated properly.get_super_animal_project_cfg()was usingread_config()to read the superanimal project configuration template embedded into the DeepLabCut repository, which then modified the file in the DeepLabCut codebase. Now, the method reads the template withread_config_as_dict(), which doesn't modify the file.read_config_as_dict(),write_config()andpretty_print()methods todeeplabcut.core.config_utils.pymodule.testscript_superanimal_adaptation.py,testscript_superanimal_inference.pyandtestscript_superanimal_transfer_learning.py) have been fixed.