DeepLabCut demonstration for the Hands-on, Neural, Behavioural and Histological Data Analysis Workshop by the UBC Dynamic Brain Circuit Cluster as a part of CAN 2024 meeting.
- Click the green "Code" button at the top of the page and select "Download Zip". This will download "dlc_demo-main.zip" onto your computer. Unzip this file.
- Open Terminal/Anaconda Prompt and navigate to the "dlc_demo-main" folder that you just unzipped.
NOTE: use the commands
ls
to see subdirectories andcd <subdirectory>
to navigate through your files. You can usecd ..
to go to the parent directory.
-
In your Terminal/Anaconda Prompt, enter one of these commands:
conda env create -f DEEPLABCUT.yaml # for Windows/Linux/Intel Mac
conda env create -f DEEPLABCUT_M1.yaml # for Apple Silicon Mac
All of the data used for this tutorial can be found here.
- Sample Videos
For this workshop, you will download some sample videos to try implementing the deeplabcut tool.
4 sample videos have been made available; however the steps for all 4 videos will be the same in our workshop. In the interest of time, we recommend downloading only '00602.avi'.
- Click "00602.avi" and select "Download" to download it (258 MB).
- Move the video file into "DLC_DEMO" > "my_files" > "videos".
- Pre-Trained Model (in the Trained Model OSF Componant)
In the interest of time, a pre-trained model has been provided to use in the second half of the workshop.
- Click "dlc_trained_model.zip" and select "Download" to download it (2.17 GB zipped, 2.33 GB unzipped).
- Move the unzipped "test-AshliandJeff-2021-03-17" folder into "DLC_Demo" > "my_files" > "working_dir"
Ensure you either install Anaconda or install miniconda on your computer.
You can verify that you have Anaconda if you have Anaconda Navigator in your applications. You can also verify by running the command conda --version
in the Terminal (Mac/Linux) or the Anaconda Prompt application (Windows).
Activate environment with conda activate DEEPLABCUT
or conda activate DEEPLABCUT_M1
, depending on the YAML file you installed.
To activate Jupyter Notebooks, you can either:
- Open the Anaconda Navigator application and press "Launch" on Jupyter Notebook.
- Open Terminal/Anaconda Prompt and run this command in the deeplabcut environment:
jupyter notebook
This will open up the Jupyter Notebook Home Page in your default browser. You will need to navigate to where "dlc_demo" is located on your computer. In this folder, open "dlc_tutorial.ipynb" to start.
Then, you need to run the Jupyter Notebook using the deeplabcut environment we just created. You can modify this by going Kernel > Change Kernel > Python [conda env:DEEPLABCUT] or Python [conda env:DEEPLABCUT_M1] option in the menu bar.
Start with the 'dlc-tutorial_part-1.ipynb' notebook. This will teach you the basics of setting up labelled data in order to train the model. Afterwards, you can start on the second notebook, dlc-tutorial_part-2.ipynb, where you will make use of a model that has already been trained to analyze a video and label it accordingly.
If you use DeepLabCut in your future research projects, please read the information here and reference the original papers as per the author's request.