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
Make code compatible with TF2 🔥 #1323
Conversation
# Conflicts: # conda-environments/DLC-CPU.yaml # deeplabcut/pose_estimation_tensorflow/__init__.py # deeplabcut/pose_estimation_tensorflow/core/predict.py # deeplabcut/pose_estimation_tensorflow/core/train.py # deeplabcut/pose_estimation_tensorflow/core/train_multianimal.py # deeplabcut/pose_estimation_tensorflow/dataset/factory.py # deeplabcut/pose_estimation_tensorflow/dataset/pose_dataset_scalecrop.py # deeplabcut/pose_estimation_tensorflow/datasets/pose_defaultdataset.py # deeplabcut/pose_estimation_tensorflow/datasets/pose_deterministic.py # deeplabcut/pose_estimation_tensorflow/datasets/pose_imgaug.py # deeplabcut/pose_estimation_tensorflow/datasets/pose_multianimal_imgaug.py # deeplabcut/pose_estimation_tensorflow/datasets/pose_tensorpack.py # deeplabcut/pose_estimation_tensorflow/nnet/efficientnet_builder.py # deeplabcut/pose_estimation_tensorflow/nnet/efficientnet_model.py # deeplabcut/pose_estimation_tensorflow/nnet/net_factory.py # deeplabcut/pose_estimation_tensorflow/nnet/pose_net.py # deeplabcut/pose_estimation_tensorflow/nnet/pose_net_efficientnet.py # deeplabcut/pose_estimation_tensorflow/nnet/pose_net_mobilenet.py # deeplabcut/pose_estimation_tensorflow/nnet/utils.py # deeplabcut/pose_estimation_tensorflow/predict_videos.py # setup.py
# Conflicts: # deeplabcut/pose_estimation_tensorflow/core/evaluate_multianimal.py # deeplabcut/pose_estimation_tensorflow/core/predict.py # deeplabcut/pose_estimation_tensorflow/core/train_multianimal.py # setup.py
This reverts commit 2aac0d0
Not sure why it's failing ... I attempted to pin tables, yet:
|
Yeah, that's odd; locally it builds fine with the same settings though (macOS/python3.9.5/updated pip). I also confirm that |
Alright; order of operations matters here; and seems pytables might not have wheels for the latest 3.9. That being said, as Jessy mentions above, using the conda file for installation works, as tables is built from conda forge. Tests pass on ubuntu for 3.9. For now, we will pin 3.8 in the conda file but to users, it is compatible with 3.9. Otherwise, all testscripts pass for me on MacOS and Ubuntu 20.04 LTS; for future ubunut 20.04 users, note there can be issues with wxPython wheels, so I made a how-to here: https://github.com/DeepLabCut/Docker4DeepLabCut2.0/wiki/ubuntu-20.04-LTS-fresh-install-guide Next, I used a TF1 project and analyzed a video without issue in TF2.5; i.e., it's backwards compatible for single animal and latest maDLC projects. Thus, to use TF the only change is a fresh install with the new DEEPLABCUT.yaml is required. |
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.
Great job @jeylau!
Refactored PoseDatasets and PoseNets and made code TensorFlow 2 compatible.
Benchmarked on 4 datasets (single- and multi-animal, w/ grayscale and color images) with TensorFlow (TF)1.15.5 (which serves as reference), TF2.3, and TF2.5; batch size 8, 30k iterations (except for the marmosets: 20k); 3 backbones (resnet_50, mobilenet_v2_0.5, efficientnet-b0); 2 GPU devices (TITAN RTX & GEFORCE GTX 1080). No significant main effects of either backbone or tf version were found. Training duration is reported relative to TF1 training time (Y axis, and value printed above each bar), and in seconds (underneath/within the bar).
Not shown here is training with batch size 1 and TF2.5 with a single-animal project (openfield), which is ~4 min (~15%) slower than with TF1. Note that this is not observed with TF2.3.