DataJoint U24 - Workflow DeepLabCut¶
Download example data¶
These notebooks are built around data provided by DataJoint, including a well-trained model. For similar content using data from DeepLabCut, see 09-AlternateDataset.
DataJoint provides various datasets via djarchive
. To pip install...
pip install git+https://github.com/datajoint/djarchive-client.git
import os; import djarchive_client
client = djarchive_client.client()
We can browse available datasets:
list(client.datasets())
['t', 'workflow-array-ephys-benchmark', 'workflow-calcium-imaging-test-set', 'workflow-dlc-data', 'workflow-facemap', 'workflow-trial']
Datasets have different versions available:
list(client.revisions())
[('t', '1'), ('workflow-array-ephys-benchmark', '0.1.0a4'), ('workflow-array-ephys-benchmark', 'v1'), ('workflow-calcium-imaging-test-set', '0_1_0a2'), ('workflow-dlc-data', 'v1'), ('workflow-facemap', '0.0.0'), ('workflow-trial', '0.0.0b1')]
We can make a directory for downloading:
os.makedirs('/tmp/test_data', exist_ok=True)
Then run download for a given set and the revision:
client.download('workflow-dlc-data',
target_directory='/tmp/test_data/',
revision='v1')
(79, 0)
Directory organization¶
After downloading, the directory will be organized as follows:
/tmp/test_data/from_top_tracking/
- config.yml
- dlc-models/iteration-0/from_top_trackingFeb23-trainset95shuffle1/
- test/pose_cfg.yaml
- train/
- checkpoint
- checkpoint_orig
─ learning_stats.csv
─ log.txt
─ pose_cfg.yaml
─ snapshot-10300.data-00000-of-00001
─ snapshot-10300.index
─ snapshot-10300.meta # same for 103000
- labeled-data/
- train1/
- CollectedData_DJ.csv
- CollectedData_DJ.h5
- img00674.png # and others
- train2/ # similar to above
- videos/
- test.mp4
- train1.mp4
We will use this dataset as an example across this series of notebooks. If you use another dataset, change the path accordingly.
config.yaml
contains key parameters of the projectlabeled-data
includes pixel coordinates for each body partvideos
includes the full training and inference videos
This workflow contains additional functions for setting up this demo data, including adding absolute paths to config files and shortening the inference video to speed up pose estimation.
from workflow_deeplabcut.load_demo_data import setup_bare_project, shorten_video
setup_bare_project(project="/tmp/test_data/from_top_tracking",
net_type = "mobilenet_v2_1.0") # sets paths
shorten_video("/tmp/test_data/from_top_tracking/videos/test.mp4",
output_path=None,first_n_sec=2) # makes test-2s.mp4
Loading DLC 2.2.1.1... DLC loaded in light mode; you cannot use any GUI (labeling, relabeling and standalone GUI)
For your own data, we recommend using the DLC gui to intitialize your project and label the data.
In the next notebook, 01-Configure, we'll set up the DataJoint config file with a pointer to your root data directory.