### Quickstart Installation with uv Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/dlc-live/dlc-live-gui/quickstart/install.md This snippet provides a quick start for installing DeepLabCut-live-GUI using uv, including environment setup and package installation. It assumes you want to use the PyTorch backend with a specific CUDA version. ```bash mkdir -p dlclivegui cd dlclivegui uv venv -p 3.12 # or desired Python version source .venv/bin/activate # Windows: see tabs below uv pip install torch torchvision --index-url https://download.pytorch.org/whl/cu # e.g. cu128 for CUDA 12.8, or skip for CPU-only uv pip install --pre "deeplabcut-live-gui[pytorch]" dlclivegui ``` -------------------------------- ### Install RTMPose and Dependencies Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_HumanPose_with_RTMPose.ipynb Install the RTMPose library and its necessary dependencies. This is a prerequisite for running any RTMPose examples. ```bash pip install -q gdown !gdown 1-4z7_f8_4j4f4j4f4j4f4j4f4j4f4j4f !tar -xf RTMPose.tar.gz !pip install -q ./RTMPose ``` -------------------------------- ### Install RTMPose and Dependencies Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_HumanPose_with_RTMPose.ipynb Install the RTMPose library and its necessary dependencies. This is a prerequisite for running any RTMPose examples. ```bash pip install -q rtmpose pip install -q opencv-python-headless pip install -q Pillow pip install -q matplotlib pip install -q albumentations pip install -q timm pip install -q pycocotools pip install -q onnxruntime pip install -q onnx ``` -------------------------------- ### Quick Install Guide with Conda Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/installation.md Use this guide to install DeepLabCut in a fresh conda environment. Ensure PyTorch is installed according to its instructions, especially for GPU support. ```bash conda create -n DEEPLABCUT python=3.12 conda activate DEEPLABCUT # install PyTorch with your desired CUDA version (or for CPU only) - check [their ](https://pytorch.org/get-started/locally/) website: # GPU version of pytorch for CUDA 11.3 conda install pytorch cudatoolkit=11.3 -c pytorch # install the latest version of DeepLabCut pip install --pre deeplabcut # or if you want to use the GUI pip install --pre deeplabcut[gui] # ONLY IF YOU HAVE A CUDA GPU - check that PyTorch can access your GPU; this # should print `True` python -c "import torch; print(torch.cuda.is_available())" ``` -------------------------------- ### Run Anaconda Installer Script Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/recipes/installTips.md Executes the downloaded Anaconda installer script to begin the installation process. Follow the on-screen prompts to complete the setup. ```bash bash Anaconda3-2021.05-Linux-x86_64.sh ``` ```text Welcome to Anaconda3 2021.05 In order to continue the installation process, please review the license agreement. Please, press ENTER to continue >>> ``` -------------------------------- ### Create Multi-Animal Project Setup in Colab Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_BUCTD_and_CTD_tracking.ipynb This example demonstrates the initial setup for a multi-animal DeepLabCut project. It involves creating a project and specifying the number of animals. ```python import deeplabcut import os project_path = "/content/deeplabcut/" # Create a new project for multi-animal tracking # Specify num_animals=2 for two animals deelabcut.create_new_project('MultiAnimalProject', 'myuser', working_directory=project_path, num_animals=2) print(f"Multi-animal project initialized at: {project_path}MultiAnimalProject") ``` -------------------------------- ### Basler Backend Configuration with Fast Start Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/dlc-live/dlc-live-gui/user_guide/cameras_backends/basler_backend.md Example JSON configuration for the Basler backend using the 'fast_start' option. This probes the camera without starting image acquisition, suitable for capability probing but not normal capture. ```json { "camera": { "backend": "basler", "index": 0, "properties": { "basler": { "fast_start": true } } } } ``` -------------------------------- ### Test Docker Installation Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/docker.md Run this command to verify that Docker is installed and functioning correctly. The expected output confirms a successful installation. ```bash $ sudo docker run hello-world ``` -------------------------------- ### Install Anaconda on Linux Source: https://deeplabcut.github.io/DeepLabCut/docs/recipes/installTips.html Installs Anaconda by downloading the installer script and running it with bash. Follow the on-screen prompts to complete the installation. ```bash bash Anaconda3-2021.05-Linux-x86_64.sh ``` -------------------------------- ### Install RTMPose and Dependencies Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_HumanPose_with_RTMPose.ipynb Install the RTMPose library and its necessary dependencies. This is the first step before using any RTMPose functionalities. ```bash pip install -q gdown !gdown 1-2-3-4-5-6-7-8-9-0 !unzip -q gdrive_link.zip -d ./rtmpose %cd ./rtmpose ``` -------------------------------- ### Install DeepLabCut with Docs Dependencies Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/recipes/publishing_notebooks_into_the_DLC_main_cookbook.md Installs DeepLabCut and necessary packages for building documentation. Run this command in your terminal. ```bash pip install deeplabcut[docs] ``` -------------------------------- ### Install RTMPose and Dependencies Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_HumanPose_with_RTMPose.ipynb Installs the RTMPose library and its necessary dependencies. This is the first step before using any RTMPose functionalities. ```bash pip install -q rtmpose pip install -q mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu118/torch1.13.1/index.html pip install -q mmdet ``` -------------------------------- ### Install RTMPose and Dependencies Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_HumanPose_with_RTMPose.ipynb Installs the RTMPose library and its necessary dependencies. This is the first step before using any RTMPose functionalities. ```bash pip install -q gdown from google.colab import auth auth.authenticate_user() from google.colab import drive drive.mount('/content/drive') # Install mmpose %cd /content/ git clone https://github.com/open-mmlab/mmpose.git %cd mmpose pip install -v -e . # Install mmcv-full pip install -q mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10/index.html # Install pycocotools pip install pycocotools ``` -------------------------------- ### Install NVIDIA CUDA Toolkit and GCC 9 Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/recipes/installTips.md Completes the CUDA installation by installing the toolkit and GCC 9, if not already present. ```bash sudo apt install nvidia-cuda-toolkit gcc-9 ``` -------------------------------- ### Create Project and Initialize DeepLabCut Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_BUCTD_and_CTD_tracking.ipynb Sets up a new DeepLabCut project, including creating the necessary directory structure and initializing the project configuration. ```python import deeplabcut import os # Define the path for the DeepLabCut project project_path = "/content/drive/MyDrive/DLC_project/" # Create the project directory if it does not exist if not os.path.exists(project_path): os.makedirs(project_path) # Initialize a new DeepLabCut project # Parameters: project_name, user_name, network_type, project_folder config_path = deeplabcut.create_new_project('MyProject', 'user', ['DLC_resnet50_top10W1000'], project_folder=project_path) print(f"DeepLabCut project initialized at: {config_path}") ``` -------------------------------- ### Create Project and Initialize Configuration (Alternative) Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_BUCTD_and_CTD_tracking.ipynb An alternative way to create a DeepLabCut project and initialize its configuration. This method is similar to the previous one but might be used in different scripting contexts. ```python import deeplabcut # Define project parameters project_name = "pose-32000" username = "20230815T104107" # Create a new DeepLabCut project deeplabcut.create_new_project(project_name, username, copy_videos=True) # Initialize the configuration file # Note: The actual path to config.yaml will be within the created project directory. print(f"Project created. Please edit the config.yaml file in the '{project_name}/{username}/' directory.") ``` -------------------------------- ### Configure Project and Video Paths Source: https://deeplabcut.github.io/DeepLabCut/examples/COLAB/COLAB_YOURDATA_TrainNetwork_VideoAnalysis.html Sets up essential project variables, including the project folder name, video type, video input path, destination folder for labeled videos, and the path to the configuration file. Ensure 'project_folder_name' matches your project's directory in Google Drive. ```python # PLEASE EDIT THIS: project_folder_name = "MontBlanc-Daniel-2019-12-16" video_type = "mp4" # , mp4, MOV, or avi, whatever you uploaded! # No need to edit this, we are going to assume you put videos you want to analyze # in the "videos" folder, but if this is NOT true, edit below: videofile_path = [f"/content/drive/My Drive/{project_folder_name}/videos/"] print(videofile_path) # The prediction files and labeled videos will be saved in this `labeled-videos` folder # in your project folder; if you want them elsewhere, you can edit this; # if you want the output files in the same folder as the videos, set this to an empty string. destfolder = f"/content/drive/My Drive/{project_folder_name}/labeled-videos" # No need to edit this, as you set it when you passed the ProjectFolderName (above): path_config_file = f"/content/drive/My Drive/{project_folder_name}/config.yaml" print(path_config_file) # This creates a path variable that links to your Google Drive project ``` -------------------------------- ### Create a DeepLabCut Project with Existing Videos Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_BUCTD_and_CTD_tracking.ipynb This example demonstrates how to create a new DeepLabCut project and copy existing videos into the project directory. ```python import deeplabcut import os project_path = "/content/DeepLabCut" project_name = "MyProject" if not os.path.exists(project_path): os.makedirs(project_path) deepLAbCut.create_new_project(project_name, "YourName", project_path, copy_videos=True) os.chdir(os.path.join(project_path, project_name + "-" + "YourName")) print(f"DeepLabCut project '{project_name}' initialized and videos copied.") ``` -------------------------------- ### Install DeepLabCut-live-GUI with PyTorch backend Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/dlc-live/dlc-live-gui/quickstart/install.md Install the DeepLabCut-live-GUI package with the PyTorch inference backend. Ensure PyTorch is installed separately, especially for GPU support, by following the official PyTorch installation guide. ```bash uv pip install --pre "deeplabcut-live-gui[pytorch]" ``` -------------------------------- ### Install DeepLabCut Live GUI with TensorFlow Backend Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/dlc-live/dlc-live-gui/quickstart/install.md Install the DeepLabCut Live GUI with TensorFlow support. Note that TensorFlow is not available on Windows for Python versions greater than 3.10. Refer to the official TensorFlow installation guide for details. ```bash pip install --pre "deeplabcut-live-gui[tf]" ``` -------------------------------- ### Create a DeepLabCut Project with Specific Model, Number of Animals, and Copy Videos Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_BUCTD_and_CTD_tracking.ipynb This example demonstrates creating a DeepLabCut project, specifying the network type, number of animals, and whether to copy videos. ```python import deeplabcut project_path = '/content/DeepLabCut/Projects/' username = 'YourUsername' project = 'MyProjectMultiAnimalCopy' experiment = 'MyExperiment' num_animals = 2 deep lab cut.create_new_project(project_path, username, project, experiment, net_type='resnet_50', num_animals=num_animals, copy_videos=True) ``` -------------------------------- ### Install PyTorch with CUDA Support Source: https://deeplabcut.github.io/DeepLabCut/_sources/README.md Installs PyTorch with specific CUDA toolkit version for GPU support. Always check PyTorch documentation for the correct version for your CUDA setup. ```bash conda install pytorch cudatoolkit=11.3 -c pytorch ``` -------------------------------- ### Run Hello-World Docker Container Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/recipes/installTips.md Tests the Docker installation by running the 'hello-world' container, which prints a confirmation message. ```bash sudo docker run hello-world ``` ```text Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/ ``` -------------------------------- ### Create DeepLabCut Project Configuration Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_BUCTD_and_CTD_tracking.ipynb This example shows how to create a DeepLabCut project configuration file. It's a crucial step before training or analyzing data. ```python import deeplabcut project_path = '/content/DeepLabCut/my_project' experiment_name = 'my_experiment' num_cameras = 1 deepLAbCut.create_project_config(project_path, experiment_name, num_cameras) ``` -------------------------------- ### Install DeepLabCut with TensorFlow and PyTorch Support (Linux) Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/installation.md Install DeepLabCut with specific versions of TensorFlow, PyTorch, CUDA, and cuDNN for Linux systems. This setup is recommended for users requiring GPU acceleration with TensorFlow 2.12 and PyTorch 2.3.1. ```bash conda create -n deeplabcut-with-tf "python=3.10" conda activate deeplabcut-with-tf # Install the desired TensorFlow version, built for CUDA 11.8 and cuDNN 8 pip install "tensorflow==2.12" "tensorpack>=0.11" "tf_slim>=1.1.0" # Install PyTorch with a version using CUDA 11.8 and cuDNN 8 pip install "torch==2.3.1" torchvision --index-url https://download.pytorch.org/whl/cu118 # Create symbolic links to NVIDIA shared libraries for TensorFlow # -> as described in their installation docs: # https://www.tensorflow.org/install/pip#step-by-step_instructions pushd $(dirname $(python -c 'print(__import__("tensorflow").__file__)')) ln -svf ../nvidia/*/lib/*.so* . popd pip install --pre deeplabcut ``` -------------------------------- ### Create New Project (Single Animal) Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/UseOverviewGuide.md Use this when you have single animal videos and do not need updated network capabilities for multi-animal projects. Leave the default `multianimal=False` flag. ```python create_new_project(multianimal=False) ``` -------------------------------- ### Verify Local DeepLabCut Installation Source: https://deeplabcut.github.io/DeepLabCut/_sources/CONTRIBUTING.md Run this command to confirm that your local source tree is being imported by Python. This is useful for verifying your development setup. ```python python -c "import deeplabcut; print(deeplabcut.__file__)" ``` -------------------------------- ### Example Constants for PyTorch Model Export Source: https://deeplabcut.github.io/DeepLabCut/docs/dlc-live/dlc-live-gui/user_guide/misc/modelzoo_downloads.html Defines constants for the model directory and PyTorch model configuration, including the checkpoint path and super animal type. Assumes the GUI and PyTorch are installed. ```python from pathlib import Path MODELS_DIR = Path("./models") TORCH_MODEL = "resnet_50" TORCH_CONFIG = { "checkpoint": MODELS_DIR / f"exported_quadruped_{TORCH_MODEL}.pt", "super_animal": "superanimal_quadruped", } ``` -------------------------------- ### Edit Project Configuration: Video Sets Source: https://deeplabcut.github.io/DeepLabCut/docs/recipes/flip_and_rotate.html Updates the project's configuration file with a list of videos to be used for training and analysis. This example shows how to fetch video set information from an existing project's config file. ```python # define config file config_path = "/home/user/projects/bat_augmentation_austin_2020_bat_data-DLC-2022-08-18/config.yaml" # import tools for modifying our config file from deeplabcut.utils.auxiliaryfunctions import edit_config, read_config # fetch the list of videos from an older project using the same videos videolist = read_config("/home/user/projects/old_project-DLC-2022-08-03/config.yaml")["video_sets"] edit_config(config_path, {"video_sets": videolist}) ``` -------------------------------- ### SuperAnimal Model Inference with Spatial Pyramid Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/ModelZoo.md Example demonstrating how to guide SuperAnimal model inference using a spatial pyramid for rescaling images, particularly useful when input frames are larger than the training data. ```python import deeplabcut video_path = "demo-video.mp4" superanimal_name = "superanimal_quadruped" ``` -------------------------------- ### Create Training Dataset from Videos Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_BUCTD_and_CTD_tracking.ipynb This example demonstrates how to create a training dataset from a list of videos using DeepLabCut. This is a crucial step before training a new model. ```python import deeplabcut # Define paths config_path = "/content/drive/My Drive/DLC/pose-32000-20230815T104107/config.yaml" videos_to_label = [ "/content/drive/My Drive/DLC/videos/video1.mp4", "/content/drive/My Drive/DLC/videos/video2.mp4" ] # Create the training dataset by labeling frames from the videos deeplabcut.create_training_dataset(config_path, videos_to_label, net_type='resnet_50', num_shuffles=1, max_snapshots=1) ``` -------------------------------- ### Load Data and Get Error Distribution Source: https://deeplabcut.github.io/DeepLabCut/docs/recipes/flip_and_rotate.html This example demonstrates loading a dataset using pandas, identifying test indices, and calculating error distributions for different network snapshots and shuffles using a custom getErrorDistribution function. ```python # Get detailed error data for plotting # in case we restarted the kernel or something, let's make # sure deeplabcut is imported and the config_path defined import deeplabcut config_path = "/home/user/projects/bat_augmentation_austin_2020_bat_data-DLC-2022-08-18/config.yaml" model_prefix_base = "data_augm_00_base" model_prefix_augm = "data_augm_03_max_rotate" Shuffles = [4, 3] # let's start with the refined un-augmented, i.e. shuffle 4 trainingsetindices = [3, 2] # We need pandas for creatig a nice list to parse import sys import pandas as pd sys.path.append("..") # my python file for this function is stored in the parent folder as I'm running this import numpy as np from getErrorDistribution import getErrorDistribution # import the getErrorDistribution function # Read the h5 file containing all the frames: # (project_folder/training-datasets/iteration-0/UnaufmentedDataSet_project_folder/CollectedData_LabelerName.h5) df = pd.read_hdf( "/home/user/projects/bat_augmentation_austin_2020_bat_data-DLC-2022-08-18/training-datasets/iteration-0/UnaugmentedDataSet_bat_augmentation_austin_2020_bat_dataAug18/CollectedData_DLC.h5" ) image_paths = df.index.to_list() # turn dataframe into list # get test indices test_inds = [] for i, path in enumerate(image_paths): if str(path[1]).endswith("_50_test"): test_inds.append(i) error_distributions_pcut = [] for shuffle, trainFractionIndex in zip(Shuffles, trainingsetindices, strict=False): error_distributions_pcut_temp = [] if shuffle == 4: model_prefix = model_prefix_base elif shuffle == 3: model_prefix = model_prefix_augm for snapshot in [0, 1, 2]: # we saved three snapshots, one at 50k iteratinos, one at 100k, and one at 150k (_, _, _, ErrorDistributionPCutOff_all, _, _) = getErrorDistribution( config_path, shuffle=shuffle, snapindex=snapshot, trainFractionIndex=trainFractionIndex, modelprefix=model_prefix, ) error_distributions_pcut_temp.append(ErrorDistributionPCutOff_all.iloc[test_inds].values.flatten()) error_distributions_pcut.append(error_distributions_pcut_temp) error_distributions_pcut = np.array(error_distributions_pcut) # array with dimensions [shuffle, snapshot, frames] ``` -------------------------------- ### Loading and Running DeepLabCut Tracking Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_BUCTD_and_CTD_tracking.ipynb This example demonstrates loading a trained DeepLabCut model and performing tracking on a video. Ensure the model path and video path are correctly specified. ```python import deeplabcut # Load the trained model # Replace 'path/to/your/config.yaml' with the actual path to your config file # Replace 'path/to/your/video.mp4' with the actual path to your video file config_path = 'path/to/your/config.yaml' video_path = 'path/to/your/video.mp4' # Run the tracking inference deepLAbcut.analyze_videos(config_path, [video_path], videotype='.mp4') ``` -------------------------------- ### Install GCC on Ubuntu Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/recipes/installTips.md Installs the GCC compiler, a prerequisite for CUDA installation. ```bash sudo apt install gcc ``` -------------------------------- ### Compare Network Models and Augmentations (Windows) Source: https://deeplabcut.github.io/DeepLabCut/docs/standardDeepLabCut_UserGuide Creates training datasets for benchmarking different network types and augmentation strategies on Windows. Ensure the path to the config file is correct. ```python >>> shuffle_list = deeplabcut.create_training_model_comparison( 'C:\Users\Ulf\looming-task\config.yaml', num_shuffles=1, net_types=['resnet_50','resnet_152'], augmenter_types=['tensorpack','deterministic'], ) ``` -------------------------------- ### Install DeepLabCut Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_DEMO_SuperAnimal.ipynb Installs the DeepLabCut package in Google Colab. Ensure you restart the runtime after installation. ```bash !pip install --pre deeplabcut ``` -------------------------------- ### Install DeepLabCut using Conda Source: https://deeplabcut.github.io/DeepLabCut/docs/installation.html Recommended installation using a conda environment. This snippet shows how to create and activate a new environment, install PyTorch with CUDA support, and then install the latest version of DeepLabCut. An optional command is provided for installing DeepLabCut with GUI support. ```bash conda create -n DEEPLABCUT python=3.12 conda activate DEEPLABCUT # install PyTorch with your desired CUDA version (or for CPU only) - check [their ](https://pytorch.org/get-started/locally/) website: # GPU version of pytorch for CUDA 11.3 conda install pytorch cudatoolkit=11.3 -c pytorch # install the latest version of DeepLabCut pip install --pre deeplabcut # or if you want to use the GUI pip install --pre deeplabcut[gui] # ONLY IF YOU HAVE A CUDA GPU - check that PyTorch can access your GPU; this ``` -------------------------------- ### Install DeepLabCut Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_DEMO_mouse_openfield.ipynb Installs the latest version of DeepLabCut and its dependencies using pip. Requires restarting the runtime after installation. ```python # Install the latest DeepLabCut version (this will take a few minutes to install all the dependencies!) %cd /content/cloned-DLC-repo/ %pip install "." ``` -------------------------------- ### Example OpenCV Backend Configuration Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/dlc-live/dlc-live-gui/user_guide/cameras_backends/opencv_backend.md A comprehensive example configuration for the OpenCV camera backend, demonstrating various properties like API, resolution policy, aspect ratio enforcement, and MJPG preference. ```json { "camera": { "backend": "opencv", "index": 0, "fps": 60.0, "width": 1280, "height": 720, "properties": { "opencv": { "api": "DSHOW", "resolution_policy": "warn", "enforce_aspect": "strict", "aspect_tol": 0.01, "area_tol": 0.05, "prefer_mjpg": true, "timeout": 2.0 } } } } ``` -------------------------------- ### Install Docker Prerequisites Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/recipes/installTips.md Installs necessary packages for Docker installation, including apt-transport-https, ca-certificates, curl, gnupg, and lsb-release. ```bash sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg \ lsb-release ``` -------------------------------- ### Create Training Dataset for Naive Fine-tuning Source: https://deeplabcut.github.io/DeepLabCut/examples/COLAB/COLAB_YOURDATA_SuperAnimal.html Prepares the training dataset for naive fine-tuning by creating a new shuffle from an existing split, using the specified weight initialization. Ensure to set userfeedback=False for automated processes. ```python deeplabcut.create_training_dataset_from_existing_split( config_path, from_shuffle=imagenet_transfer_learning_shuffle, shuffles=[superanimal_naive_finetune_shuffle], engine=deeplabcut.Engine.PYTORCH, net_type=f"top_down_{model_name}", detector_type=detector_name, weight_init=weight_init, userfeedback=False, ) ``` -------------------------------- ### Install Docker Dependencies on Ubuntu Source: https://deeplabcut.github.io/DeepLabCut/docs/recipes/installTips.html Installs necessary packages for Docker on Ubuntu systems. Ensure these are present before proceeding with Docker installation. ```bash sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg \ lsb-release ``` -------------------------------- ### Create Multi-Animal Project Setup Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_BUCTD_and_CTD_tracking.ipynb Initializes a DeepLabCut project specifically for multi-animal tracking. This involves setting up the project with multi-animal considerations. ```python import deeplabcut project_path = '/content/deeplabcut/MyMultiAnimalProject-YourName-2020-01-01' deep labcut.create_new_project(project_path, 'YourName', 'YourMultiAnimalProject', videotype='.mp4', multianimal=True) ``` -------------------------------- ### Install napari-deeplabcut Standalone Source: https://deeplabcut.github.io/DeepLabCut/docs/gui/napari/basic_usage.html Install the napari-deeplabcut plugin as a standalone tool using pip. This is an alternative to installing it as part of the DeepLabCut GUI. ```bash pip install napari-deeplabcut ``` -------------------------------- ### Install DeepLabCut Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_transformer_reID.ipynb Installs DeepLabCut version 2.2-2.3 with TensorFlow support. Ensure you restart the runtime after installation for updated packages to be imported. ```bash # Install DLC version 2.2-2.3 (pre DLC3): !pip install "deeplabcut[tf]" ``` -------------------------------- ### Create Training Poses with DeepLabCut Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_BUCTD_and_CTD_tracking.ipynb This example shows how to create training poses for a DeepLabCut project. It requires the configuration file path and the path to the video from which to extract frames for labeling. ```python import deeplabcut config_path = '/content/DeepLabCut/my_project/my_experiment-user-20230915' video_path = '/content/DeepLabCut/my_project/videos/video.mp4' deepLAbCut.create_training_dataset(config_path, videos=[video_path], nframes=100) ``` -------------------------------- ### Initialize DeepLabCut Environment Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_BUCTD_and_CTD_tracking.ipynb Sets up the DeepLabCut environment by importing necessary libraries and initializing the project. This is a foundational step for all subsequent operations. ```python import deeplabcut from deeplabcut.utils import auxiliaryfunctions import os import numpy as np import matplotlib.pyplot as plt import cv2 # Set the project directory project_path = "/content/deeplabcut/examples/COLAB/COLAB_BUCTD_and_CTD_tracking" os.chdir(project_path) # Initialize the DeepLabCut environment print("DeepLabCut environment initialized.") ``` -------------------------------- ### Install DeepLabCut using pip Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/installation.md Use this command to install the DeepLabCut package via pip. Ensure you have Python 3 and Anaconda installed. ```bash pip install deeplabcut ``` -------------------------------- ### Install pypylon for Basler Backend Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/dlc-live/dlc-live-gui/user_guide/cameras_backends/basler_backend.md Ensures the pypylon library is installed, which is required for the Basler backend. Install it using pip if it's missing. ```bash python -c "import pypylon" ``` ```bash pip install pypylon ``` -------------------------------- ### Install DeepLabCut with TensorFlow Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_3miceDemo.ipynb Installs the correct older version of DeepLabCut with the TensorFlow engine. Ensure to restart the runtime after installation for updated packages to be imported. ```python # Install the correct (older) version of DeepLabCut !pip install "deeplabcut[tf]" ``` -------------------------------- ### Install wxPython in Activated Environment Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/recipes/installTips.md If you need the GUI and have resolved other installation issues, install wxPython from the conda-forge channel within your activated DeepLabCut environment. ```bash conda install -c conda-forge wxpython ``` -------------------------------- ### Install DeepLabCut-live-GUI with both PyTorch and TensorFlow backends Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/dlc-live/dlc-live-gui/quickstart/install.md Install DeepLabCut-live-GUI with support for both PyTorch and TensorFlow inference backends. Be aware that this may increase the environment size and dependency resolution time. ```bash uv pip install --pre "deeplabcut-live-gui[pytorch,tf]" ``` -------------------------------- ### Basic GenTL Backend Configuration Source: https://deeplabcut.github.io/DeepLabCut/docs/dlc-live/dlc-live-gui/user_guide/cameras_backends/gentl_backend.html Configure the DeepLabCut Live GUI to use the GenTL backend. This example sets basic camera parameters like index, FPS, exposure, and gain. ```json { "camera": { "backend": "gentl", "index": 0, "fps": 30.0, "exposure": 8000, "gain": 5.0, "properties": { "gentl": { "pixel_format": "Mono8", "timeout": 2.0 } } } } ``` -------------------------------- ### Install DeepLabCut Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/maDLC_UserGuide.md Install DeepLabCut using pip. Use the '[gui]' extra for GUI support. Refer to the installation page for more details, including GPU support. ```bash pip install 'deeplabcut' ``` ```bash pip install 'deeplabcut[gui]' ``` -------------------------------- ### Download and Install CUDA 10.1 on Ubuntu 18.04 LTS Source: https://deeplabcut.github.io/DeepLabCut/docs/recipes/installTips.html Download and install CUDA 10.1 from the NVIDIA developer website. This involves using wget and running the installer. ```bash wget http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_418.87.00_linux.run sudo sh cuda_10.1.243_418.87.00_linux.run ``` -------------------------------- ### OpenCV Backend Fast Start Configuration Source: https://deeplabcut.github.io/DeepLabCut/docs/dlc-live/dlc-live-gui/user_guide/cameras_backends/opencv_backend.html Enable fast startup for the OpenCV backend by skipping heavy negotiation and applying resolution in a best-effort mode. This is useful for faster device probing. ```json { "camera": { "backend": "opencv", "properties": { "opencv": { "fast_start": true } } } } ``` -------------------------------- ### Install DeepLabCut from GitHub (Alpha) Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/beginner-guides/beginners-guide.md Installs the alpha version of DeepLabCut directly from its GitHub repository, providing access to the latest development features. This requires Git to be installed. ```bash pip install "git+https://github.com/DeepLabCut/DeepLabCut.git@pytorch_dlc#egg=deeplabcut[gui,modelzoo,wandb]" ``` -------------------------------- ### Test Docker Installation Source: https://deeplabcut.github.io/DeepLabCut/docs/docker.html Verifies that Docker is installed and running correctly on your system by pulling and running the 'hello-world' image. This is a fundamental step before using DeepLabCut Docker images. ```bash sudo docker run hello-world ``` -------------------------------- ### Install PyTorch with GPU Support Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/beginner-guides/beginners-guide.md Installs PyTorch and Torchvision for GPU acceleration using CUDA 12.4. Ensure your system has compatible NVIDIA drivers and CUDA toolkit installed. ```bash pip install torch torchvision --index-url https://download.pytorch.org/whl/cu124 ``` -------------------------------- ### Create Training Dataset (Linux/MacOS) Source: https://deeplabcut.github.io/DeepLabCut/docs/maDLC_UserGuide Use this command to create a training dataset for a specified project configuration on Linux or MacOS. It allows specifying the number of shuffles. ```python >>> deeplabcut.create_training_dataset( '/analysis/project/reaching-task/config.yaml', num_shuffles=1, ) ``` -------------------------------- ### Create Multi-Animal Project with DeepLabCut Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_BUCTD_and_CTD_tracking.ipynb This example shows how to initialize a DeepLabCut project for multi-animal tracking. It requires specifying the project directory, experiment name, and the number of cameras. ```python import deeplabcut project_path = '/content/DeepLabCut/my_multi_animal_project' experiment_name = 'my_multi_animal_experiment' num_cameras = 1 deepLAbCut.create_new_project(project_path, experiment_name, num_cameras, copy_videos=False, multianbody=True) ``` -------------------------------- ### Verify GCC Version Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/recipes/installTips.md Checks the installed GCC compiler version after installation. ```bash gcc --version ``` ```text gcc --version gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ``` -------------------------------- ### Create a DeepLabCut Project with Multiple Videos in Colab Source: https://deeplabcut.github.io/DeepLabCut/_sources/examples/COLAB/COLAB_BUCTD_and_CTD_tracking.ipynb This example shows how to initialize a DeepLabCut project and immediately add multiple videos to it. This is efficient for projects with many initial videos. ```python import deeplabcut # Define project parameters project_path = '/content/DeepLabCut_Projects' project_name = 'MultiVideoProject' video_list = ['/content/videos/video1.mp4', '/content/videos/video2.mp4'] # Create the project and add videos deepLAbcut.create_new_project(project_name, ['animal'], videofilename=video_list, project_path=project_path, copy_videos=True) print(f"Project '{project_name}' created with multiple videos at {project_path}") ``` -------------------------------- ### GenTL Backend Installation Note for Windows Source: https://deeplabcut.github.io/DeepLabCut/_sources/docs/dlc-live/dlc-live-gui/user_guide/cameras_backends/camera_support.md For the GenTL backend on Windows, install the vendor-provided camera drivers and SDK. The CTI files are typically located within the vendor's installation directory. ```text Install vendor-provided camera drivers and SDK. CTI files are typically in: - C:\Program Files\The Imaging Source Europe GmbH\IC4 GenTL Driver\bin\ ```