### Install Miniforge on Windows Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Installs Miniforge for Windows (x86_64) using PowerShell. It downloads the installer, executes it silently, and then cleans up the installer file. ```powershell Invoke-WebRequest -Uri "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Windows-x86_64.exe" -OutFile "$env:UserProfile/Downloads/Miniforge3-Windows-x86_64.exe"; Start-Process -FilePath "$env:UserProfile/Downloads/Miniforge3-Windows-x86_64.exe" -ArgumentList "/InstallationType=JustMe /RegisterPython=1 /S" -Wait; Remove-Item -Path "$env:UserProfile/Downloads/Miniforge3-Windows-x86_64.exe" ``` -------------------------------- ### Pip Installation from Repository (Specific Branch) Source: https://github.com/talmolab/sleap/wiki/Installation-methods Installs a specific branch (e.g., 'develop') of the sleap package from its GitHub repository using Pip. ```shell pip install git+https://github.com/murthylab/sleap.git@develop ``` -------------------------------- ### Install Miniforge on Linux Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Installs Miniforge for Linux (x86_64) using bash. It downloads the installer script, makes it executable, runs it, removes the script, and initializes conda for the current shell. ```bash curl -fsSL --compressed https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -o "~/Downloads/Miniforge3-Linux-x86_64.sh" && chmod +x "~/Downloads/Miniforge3-Linux-x86_64.sh" && "~/Downloads/Miniforge3-Linux-x86_64.sh" -b -p ~/miniforge3 && rm "~/Downloads/Miniforge3-Linux-x86_64.sh" && ~/miniforge3/bin/conda init "$(basename "${SHELL}")" && source "$HOME/.$(basename "${SHELL}")rc" ``` -------------------------------- ### Install SLEAP Source: https://github.com/talmolab/sleap/blob/develop/docs/notebooks/Training_and_inference_on_an_example_dataset.ipynb Installs the SLEAP library and its dependencies using pip. It first uninstalls potentially conflicting OpenCV versions and then installs SLEAP with the recommended PyPI package. ```shell !pip uninstall -qqq -y opencv-python opencv-contrib-python !pip install -qqq "sleap[pypi]>=1.3.3" ``` -------------------------------- ### Install Miniconda on Linux Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Installs Miniconda for Linux (x86_64) using bash. It creates a directory, downloads the installer script, executes it, removes the script, and initializes conda for the current shell. ```bash mkdir -p ~/miniconda3 && wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh && bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3 && rm ~/miniconda3/miniconda.sh && ~/miniconda3/bin/conda init "$(basename "${SHELL}")" && source "$HOME/.$(basename "${SHELL}")rc" ``` -------------------------------- ### Clone SLEAP Repository Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Clones the SLEAP source code from GitHub and navigates into the cloned directory. This is the first step for installing SLEAP from source. ```bash git clone https://github.com/talmolab/sleap && cd sleap ``` -------------------------------- ### Development Installation from Repository Source: https://github.com/talmolab/sleap/wiki/Installation-methods Installs sleap from its GitHub repository for development purposes. This involves cloning the repo, creating a dedicated Conda environment ('sleap_dev'), and installing the package in editable mode. ```shell git clone https://github.com/murthylab/sleap.git cd sleap conda env create -n sleap_dev -f environment.yml conda activate sleap_dev pip install -r dev_requirements.txt pip install --no-deps -e . ``` -------------------------------- ### Pip Installation from Repository (Windows Dependencies) Source: https://github.com/talmolab/sleap/wiki/Installation-methods Installs sleap from the repository, specifically addressing Windows users who need to install 'tensorflow-gpu' and 'Shapely' via Conda first. It then installs sleap using Pip. ```shell conda env create -n sleap_env python=3.6 tensorflow-gpu=2 Shapely conda activate sleap_env pip install git+https://github.com/murthylab/sleap.git ``` -------------------------------- ### Pip Installation from Test PyPi Source: https://github.com/talmolab/sleap/wiki/Installation-methods Installs the sleap package from the test PyPI repository. This method requires creating a Conda environment first and then using Pip to install from the specified index URL. ```shell conda env create -n sleap_env python=3.6 conda activate sleap_env pip install --extra-index-url https://test.pypi.org/simple/ sleap ``` -------------------------------- ### Launch SLEAP GUI Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Launches the SLEAP graphical labeling interface. This command is used to verify that the GUI component of SLEAP is installed and functioning correctly. ```bash sleap-label ``` -------------------------------- ### Install Miniforge on Mac (Intel) Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Installs Miniforge for macOS on Intel (x86_64) using bash. It downloads the installer script, makes it executable, runs it, removes the script, and initializes conda for the current shell. ```bash curl -fsSL --compressed https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-x86_64.sh -o "~/Downloads/Miniforge3-MacOSX-x86_64.sh" && chmod +x "~/Downloads/Miniforge3-MacOSX-x86_64.sh" && "~/Downloads/Miniforge3-MacOSX-x86_64.sh" -b -p ~/miniforge3 && rm "~/Downloads/Miniforge3-MacOSX-x86_64.sh" && ~/miniforge3/bin/conda init "$(basename "${SHELL}")" && source "$HOME/.$(basename "${SHELL}")rc" ``` -------------------------------- ### List Installed Conda Packages Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Activates the SLEAP conda environment and lists all installed packages with their versions. This is crucial for reporting installation problems, as it provides essential dependency information. ```bash conda list ``` -------------------------------- ### Download Sample Training Data Source: https://github.com/talmolab/sleap/blob/develop/docs/notebooks/Training_and_inference_on_an_example_dataset.ipynb Downloads a sample dataset for demonstration purposes. It installs the 'tree' utility, downloads a zip file containing the dataset, extracts it, and then displays the directory structure. ```shell !apt-get install tree !wget -O dataset.zip https://github.com/talmolab/sleap-datasets/releases/download/dm-courtship-v1/drosophila-melanogaster-courtship.zip !mkdir dataset !unzip dataset.zip -d dataset !rm dataset.zip !tree dataset ``` -------------------------------- ### Install Miniconda on Windows Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Installs Miniconda for Windows (x86_64) using PowerShell. It downloads the latest installer, executes it silently, and then removes the downloaded installer file. ```powershell curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -o miniconda.exe; Start-Process -FilePath ".\miniconda.exe" -ArgumentList "/S" -Wait; del miniconda.exe ``` -------------------------------- ### Install Miniconda on Mac (Intel) Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Installs Miniconda for macOS on Intel (x86_64) using bash. It downloads the installer script, makes it executable, runs it, removes the script, and initializes conda for the current shell. ```bash curl -fsSL --compressed https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o "~/Downloads/Miniconda3-latest-MacOSX-x86_64.sh" && chmod +x "~/Downloads/Miniconda3-latest-MacOSX-x86_64.sh" && "~/Downloads/Miniconda3-latest-MacOSX-x86_64.sh" -b -u -p ~/miniconda3 && rm "~/Downloads/Miniconda3-latest-MacOSX-x86_64.sh" && ~/miniconda3/bin/conda init "$(basename "${SHELL}")" && source "$HOME/.$(basename "${SHELL}")rc" ``` -------------------------------- ### Install SLEAP via Pip Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Installs SLEAP version 1.4.1 from PyPI using pip. This command should be run after activating the appropriate conda environment. ```bash pip install sleap[pypi]==1.4.1 ``` -------------------------------- ### Install Miniforge on Mac (Apple Silicon) Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Installs Miniforge for macOS on Apple Silicon (arm64) using bash. It downloads the installer script, makes it executable, runs it, removes the script, and initializes conda for the current shell. ```bash curl -fsSL --compressed https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh -o "~/Downloads/Miniforge3-MacOSX-arm64.sh" && chmod +x "~/Downloads/Miniforge3-MacOSX-arm64.sh" && "~/Downloads/Miniforge3-MacOSX-arm64.sh" -b -p ~/miniforge3 && rm "~/Downloads/Miniforge3-MacOSX-arm64.sh" && ~/miniforge3/bin/conda init "$(basename "${SHELL}")" && source "$HOME/.$(basename "${SHELL}")rc" ``` -------------------------------- ### Import and Verify SLEAP Installation Source: https://github.com/talmolab/sleap/blob/develop/docs/notebooks/Interactive_and_resumable_training.ipynb Imports the SLEAP library and calls functions to display version information and system summary. This step confirms the installation was successful and provides diagnostic details about the system's configuration. ```Python import sleap sleap.versions() sleap.system_summary() ``` -------------------------------- ### Install SLEAP from Source (Mac OS) Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Creates a conda environment named 'sleap' from the 'environment_mac.yml' file for Mac OS installations. This is part of the 'conda from source' installation method. ```bash conda env create -f environment_mac.yml -n sleap ``` -------------------------------- ### Install Miniconda on Mac (Apple Silicon) Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Installs Miniconda for macOS on Apple Silicon (arm64) using bash. It downloads the installer script, makes it executable, runs it, removes the script, and initializes conda for the current shell. ```bash curl -fsSL --compressed https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o "~/Downloads/Miniconda3-latest-MacOSX-arm64.sh" && chmod +x "~/Downloads/Miniconda3-latest-MacOSX-arm64.sh" && "~/Downloads/Miniconda3-latest-MacOSX-arm64.sh" -b -u -p ~/miniconda3 && rm "~/Downloads/Miniconda3-latest-MacOSX-arm64.sh" && ~/miniconda3/bin/conda init "$(basename "${SHELL}")" && source "$HOME/.$(basename "${SHELL}")rc" ``` -------------------------------- ### Install Conda Package Source: https://github.com/talmolab/sleap/wiki/Installation-methods Creates a Conda environment named 'sleap_env' with the sleap package installed. This environment can be used to run the 'sleap-label' application. ```shell conda create -n sleap_env -c defaults -c sleap sleap python=3.6 -y ``` -------------------------------- ### List Conda Environments Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Lists all conda environments currently installed on the system. This is useful for verifying environment names before activation or troubleshooting. ```bash conda env list ``` -------------------------------- ### Download Example Data Source: https://github.com/talmolab/sleap/blob/develop/docs/notebooks/Post_inference_tracking.ipynb This snippet downloads an example `.mp4` video file and a `.slp` file containing pre-computed predictions using `wget`. These files are used as input for the tracking demonstration. ```bash !wget -q -O fly_clip.mp4 https://github.com/talmolab/sleap-tutorial-uo/blob/main/data/fly_clip.mp4?raw=true !wget -q -O predictions.slp https://github.com/talmolab/sleap-tutorial-uo/blob/main/data/predictions.slp?raw=true ``` -------------------------------- ### Install SLEAP from Source (Windows/Linux CPU) Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Creates a conda environment named 'sleap' from the 'environment_no_cuda.yml' file, suitable for CPU-only execution. This is part of the 'conda from source' installation method. ```bash conda env create -f environment_no_cuda.yml -n sleap ``` -------------------------------- ### Check SLEAP and System Versions Source: https://github.com/talmolab/sleap/blob/develop/docs/notebooks/Post_inference_tracking.ipynb This snippet imports the SLEAP library and calls `sleap.versions()` and `sleap.system_summary()` to display information about the installed SLEAP version and the system environment. This is useful for debugging and verifying the setup. ```python import sleap sleap.versions() sleap.system_summary() ``` -------------------------------- ### Verify SLEAP Installation and Versions Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Checks if SLEAP is installed correctly in non-interactive environments by importing the library and calling the versions() function. It displays SLEAP version along with its key dependencies like TensorFlow, Numpy, and Python. ```python python -c "import sleap; sleap.versions()" ``` -------------------------------- ### Install SLEAP and Download Data Source: https://github.com/talmolab/sleap/blob/develop/docs/notebooks/Model_evaluation.ipynb Installs the SLEAP library and necessary dependencies, then downloads and unzips sample data for model evaluation. ```shell !pip uninstall -qqq -y opencv-python opencv-contrib-python !pip install -qqq "sleap[pypi]>=1.3.3" !apt -qq install tree !wget -q https://storage.googleapis.com/sleap-data/reference/flies13/td_fast.210505_012601.centered_instance.n%3D1800.zip !unzip -qq -o -d "td_fast.210505_012601.centered_instance.n=1800" "td_fast.210505_012601.centered_instance.n=1800.zip" ``` -------------------------------- ### Continuous Integration and Coverage Reporting Source: https://github.com/talmolab/sleap/wiki/Developer-Guide Details the CI setup using AppVeyor and coverage reporting via Coveralls with coverage.py integration. This ensures code quality and test coverage are maintained. ```yaml # Example AppVeyor configuration snippet (conceptual) # build: ... # test: # - commands: # - coverage run -m pytest # - coveralls ``` ```python # Example coveralls-python configuration (conceptual) # .coveralls.yml repo_token: YOUR_REPO_TOKEN ``` -------------------------------- ### Run SLEAP Diagnostics Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Executes the SLEAP diagnostic tool to identify potential system issues or configuration problems. This command helps gather information about your environment that can be useful for troubleshooting. ```bash sleap-diagnostic ``` -------------------------------- ### Re-install Development Package Source: https://github.com/talmolab/sleap/wiki/Installation-methods Re-runs the editable installation command for the sleap package. This is necessary if the directory path changes or submodules are added/modified. ```shell pip install --no-deps -e . ``` -------------------------------- ### Start Training Source: https://github.com/talmolab/sleap/blob/develop/docs/notebooks/Interactive_and_resumable_training.ipynb Initiates the training process using the configured `Trainer`. This command starts the model training, allowing it to improve over time based on the provided data and configuration. ```Python trainer.train() ``` -------------------------------- ### Create Conda Environment for Pip Install (CPU) Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Creates a new conda environment named 'sleap' with Python 3.7 and pip, suitable for installing SLEAP via pip on CPU-only systems. ```bash conda create --name sleap pip python=3.7.12 ``` -------------------------------- ### Install SLEAP with Conda Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Commands to create a new conda environment named 'sleap' with SLEAP version 1.4.1. These commands include necessary dependencies from specified channels and are tailored for different operating systems. ```Windows and Linux conda create -y -n sleap -c conda-forge -c nvidia -c sleap/label/dev -c sleap -c anaconda sleap=1.4.1 ``` ```Mac OS conda create -y -n sleap -c conda-forge -c anaconda -c sleap sleap=1.4.1 ``` -------------------------------- ### SLEAP Training Script Example Source: https://github.com/talmolab/sleap/blob/develop/docs/guides/custom-training.md An example of a shell script command that can be used to initiate SLEAP training with custom profiles and dataset packages. ```bash #!/bin/bash # Path to the custom training profile CUSTOM_PROFILE="path/to/custom/profile.json" # Path to the SLEAP dataset package DATASET_PACKAGE="path/to/dataset.pkg.slp" # Execute the sleap-train command sleap-train "${CUSTOM_PROFILE}" "${DATASET_PACKAGE}" ``` -------------------------------- ### Install SLEAP from Source (Windows/Linux NVIDIA GPU) Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Creates a conda environment named 'sleap' from the 'environment.yml' file, which includes dependencies for NVIDIA GPU support. This is part of the 'conda from source' installation method. ```bash conda env create -f environment.yml -n sleap ``` -------------------------------- ### Configure Conda Solver to libmamba Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Steps to update conda, install the libmamba solver, and set it as the default. This is recommended for older Anaconda installations to leverage faster dependency resolution. ```bash conda update -n base conda conda install -n base conda-libmamba-solver conda config --set solver libmamba ``` -------------------------------- ### Install SLEAP and Dependencies Source: https://github.com/talmolab/sleap/blob/develop/docs/notebooks/Post_inference_tracking.ipynb This snippet installs the SLEAP library and its dependencies using pip. It also includes commands to uninstall potentially conflicting OpenCV packages. This is a prerequisite for running the tracking examples. ```bash !pip uninstall -qqq -y opencv-python opencv-contrib-python !pip install -qqq "sleap[pypi]>=1.3.3" ``` -------------------------------- ### Install SLEAP Source: https://github.com/talmolab/sleap/blob/develop/docs/notebooks/Training_and_inference_using_Google_Drive.ipynb Installs the SLEAP library and its dependencies using pip. It first uninstalls potentially conflicting OpenCV packages to ensure a clean installation. ```python !pip uninstall -qqq -y opencv-python opencv-contrib-python !pip install -qqq "sleap[pypi]>=1.3.3" ``` -------------------------------- ### Install SLEAP and Dependencies Source: https://github.com/talmolab/sleap/blob/develop/docs/notebooks/Interactive_and_resumable_training.ipynb Installs the SLEAP library and its dependencies using pip. It also uninstalls conflicting OpenCV packages to ensure a clean installation, which is crucial for setting up the environment correctly. ```Python # This should take care of all the dependencies on colab: !pip uninstall -qqq -y opencv-python opencv-contrib-python !pip install -qqq "sleap[pypi]>=1.3.3" # But to do it locally, we'd recommend the conda package (available on Windows + Linux): # conda create -n sleap -c sleap -c conda-forge -c nvidia sleap ``` -------------------------------- ### Install SLEAP and Dependencies Source: https://github.com/talmolab/sleap/blob/develop/docs/notebooks/Data_structures.ipynb Installs SLEAP and necessary dependencies using pip. Includes commands to uninstall conflicting packages and install a specific version of SLEAP with PyPI support. ```python # This should take care of all the dependencies on colab: !pip uninstall -qqq -y opencv-python opencv-contrib-python !pip install -qqq "sleap[pypi]>=1.3.3" ``` -------------------------------- ### Install SLEAP via Conda (Windows/Linux GPU) Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Installs SLEAP version 1.4.1 with GPU support using conda. This method requires an NVIDIA GPU and updated drivers. It creates a new conda environment named 'sleap'. ```bash conda create -y -n sleap -c conda-forge -c nvidia -c sleap/label/dev -c sleap -c anaconda sleap=1.4.1 ``` -------------------------------- ### List Conda Environments Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md A utility command to display all available conda environments on the system. This helps users identify which environments exist before performing operations like removal or activation. ```bash conda env list ``` -------------------------------- ### SLEAP Training Profile Examples Source: https://github.com/talmolab/sleap/blob/develop/docs/guides/remote.md Examples of built-in SLEAP training profile filenames that can be specified when running training. These files define training parameters like learning rate and augmentation methods. ```text baseline_medium_rf.bottomup.json ``` -------------------------------- ### Install SLEAP and Dependencies Source: https://github.com/talmolab/sleap/blob/develop/docs/notebooks/Interactive_and_realtime_inference.ipynb Installs the SLEAP library and its dependencies using pip. It also includes commands to uninstall conflicting OpenCV packages to ensure proper installation. ```python # This should take care of all the dependencies on colab: !pip uninstall -qqq -y opencv-python opencv-contrib-python !pip install -qqq "sleap[pypi]>=1.3.3" # But to do it locally, we'd recommend the conda package (available on Windows + Linux): # conda create -n sleap -c sleap -c conda-forge -c nvidia sleap ``` -------------------------------- ### Install Linux xcb Plugin Dependency Source: https://github.com/talmolab/sleap/wiki/Problems---workarounds Install the 'libx11-xcb1' package on Ubuntu-based Linux systems using apt-get. This library is often required by Qt's xcb platform plugin when it's not bundled with PySide2. ```Shell sudo apt-get install libx11-xcb1 ``` -------------------------------- ### Pre-commit Hook Management Source: https://github.com/talmolab/sleap/wiki/Developer-Guide Utilizes pre-commit to automate code quality checks before commits. This includes running formatters like 'black' and linters. A guide for specific integration with black is available. ```bash pre-commit install pre-commit run --all-files ``` -------------------------------- ### Configure LD_LIBRARY_PATH for SLEAP on Linux Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md This set of commands configures the LD_LIBRARY_PATH environment variable for SLEAP on Linux systems to ensure CUDA libraries are found. It involves creating activation and deactivation scripts within the conda environment for persistent setup. ```bash mkdir -p $CONDA_PREFIX/etc/conda/activate.d echo '#!/bin/sh' >> $CONDA_PREFIX/etc/conda/activate.d/sleap_activate.sh echo 'export SLEAP_OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH' >> $CONDA_PREFIX/etc/conda/activate.d/sleap_activate.sh echo 'export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH' >> $CONDA_PREFIX/etc/conda/activate.d/sleap_activate.sh source $CONDA_PREFIX/etc/conda/activate.d/sleap_activate.sh ``` ```bash mkdir -p $CONDA_PREFIX/etc/conda/deactivate.d echo '#!/bin/sh' >> $CONDA_PREFIX/etc/conda/deactivate.d/sleap_deactivate.sh echo 'export LD_LIBRARY_PATH=$SLEAP_OLD_LD_LIBRARY_PATH' >> $CONDA_PREFIX/etc/conda/deactivate.d/sleap_deactivate.sh ``` -------------------------------- ### Build Sleap Documentation Locally Source: https://github.com/talmolab/sleap/wiki/Updating-website This snippet contains the shell commands required to build the Sleap project's documentation locally. It includes navigating to the correct directory and initiating the Sphinx build process. ```shell cd sleap/docs make html ``` -------------------------------- ### Launch SLEAP GUI (Command Line) Source: https://github.com/talmolab/sleap/blob/develop/docs/tutorials/new-project.md Launches the SLEAP graphical user interface from the command line. This command should be run after activating the SLEAP environment. The GUI allows users to manage projects, load videos, and label data. ```shell sleap-label ``` -------------------------------- ### Initialize SLEAP Trainer Source: https://github.com/talmolab/sleap/blob/develop/docs/notebooks/Interactive_and_resumable_training.ipynb Creates a SLEAP `Trainer` instance from the specified configuration object. The `Trainer` handles the backend mechanics for setting up and managing the training process. ```Python trainer = sleap.nn.training.Trainer.from_config(cfg) ``` -------------------------------- ### Activate Conda Environment Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Activates the 'sleap' conda environment. This isolates the SLEAP installation and its dependencies from other projects or the base system environment. ```bash conda activate sleap ``` -------------------------------- ### Download Training Data Source: https://github.com/talmolab/sleap/blob/develop/docs/notebooks/Interactive_and_resumable_training.ipynb Downloads a sample training dataset package (`.pkg.slp`) using `curl` and lists the files in the current directory. This prepares the necessary data for the training process. ```Python # !curl -L --output labels.pkg.slp https://www.dropbox.com/s/b990gxjt3d3j3jh/210205.sleap_wt_gold.13pt.pkg.slp?dl=1 !curl -L --output labels.pkg.slp https://storage.googleapis.com/sleap-data/datasets/wt_gold.13pt/tracking_split2/train.pkg.slp !ls -lah ``` -------------------------------- ### Install SLEAP via Conda (Mac OS CPU) Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Installs SLEAP version 1.4.1 for Mac OS, which operates in CPU mode. This command creates a new conda environment named 'sleap' without GPU-specific dependencies. ```bash conda create -y -n sleap -c conda-forge -c anaconda -c sleap sleap=1.4.1 ``` -------------------------------- ### Activate SLEAP Environment Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Activates the SLEAP conda environment. This command is used after installing SLEAP with conda to ensure the correct environment is active for using the software. ```bash conda activate sleap ``` -------------------------------- ### Uninstall SLEAP Environment Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Command to remove an existing SLEAP conda environment. It's recommended to install SLEAP in a fresh environment when updating to avoid dependency conflicts. ```bash conda env remove -n sleap ``` -------------------------------- ### Create Conda Environment for Pip Install (NVIDIA GPU) Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Creates a new conda environment named 'sleap' with Python 3.7, pip, CUDA Toolkit v11.3, and cuDNN v8.2, specifically for installing SLEAP via pip with GPU support. ```bash conda create --name sleap pip python=3.7.12 cudatoolkit=11.3 cudnn=8.2 -c conda-forge -c nvidia ``` -------------------------------- ### View Inference Predictions Directory Source: https://github.com/talmolab/sleap/blob/develop/docs/notebooks/Training_and_inference_on_an_example_dataset.ipynb Shows the directory structure of the sample dataset, including the location where the inference predictions file (`.predictions.slp`) is saved. ```shell !tree dataset/drosophila-melanogaster-courtship ``` -------------------------------- ### Downgrade TensorFlow for CUDA Compatibility Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Provides a command to install a specific older version of TensorFlow (2.6.3) which is known to be compatible with CUDA Toolkit v11.3 and cuDNN v8.2. This addresses potential detection issues with newer TensorFlow versions. ```bash pip install tensorflow==2.6.3 ``` -------------------------------- ### Update Conda Package Source: https://github.com/talmolab/sleap/wiki/Installation-methods Updates the sleap package to the latest version within an existing Conda environment. ```shell conda update -c sleap sleap ``` -------------------------------- ### Train Centered-Instance Model Source: https://github.com/talmolab/sleap/blob/develop/docs/notebooks/Training_and_inference_on_an_example_dataset.ipynb Trains a centered-instance model for pose estimation using the SLEAP command-line interface. It uses a different training profile, the same dataset labels, a distinct run name, and the video path. ```shell !sleap-train baseline_medium_rf.topdown.json "dataset/drosophila-melanogaster-courtship/courtship_labels.slp" --run_name "courtship.topdown_confmaps" --video-paths "dataset/drosophila-melanogaster-courtship/20190128_113421.mp4" ``` -------------------------------- ### Import SLEAP and System Information Source: https://github.com/talmolab/sleap/blob/develop/docs/notebooks/Interactive_and_realtime_inference.ipynb Imports the SLEAP library, disables GPU memory preallocation for better resource management, and prints system and SLEAP version information. ```python import sleap sleap.disable_preallocation() # This initializes the GPU and prevents TensorFlow from filling the entire GPU memory sleap.versions() sleap.system_summary() ``` -------------------------------- ### Check SLEAP GPU Detection Source: https://github.com/talmolab/sleap/blob/develop/docs/installation.md Verifies if SLEAP can detect available GPUs on the system using a Python command. This is a primary check to confirm GPU enablement within the SLEAP environment. ```bash python -c "import sleap; sleap.system_summary()" ``` -------------------------------- ### Download Trained Models Source: https://github.com/talmolab/sleap/blob/develop/docs/notebooks/Training_and_inference_on_an_example_dataset.ipynb Zips the 'models/' directory containing the trained models and then uses Google Colab's file download utility to allow the user to download the archive. ```python # Zip up the models directory !zip -r trained_models.zip models/ # Download. from google.colab import files files.download("/content/trained_models.zip") ```