Skip to content

Commit 89a63e7

Browse files
Merge pull request #20 from TravisWheelerLab/installation-instructions
Installation instructions
2 parents 39984be + d9c48e1 commit 89a63e7

File tree

3 files changed

+112
-27
lines changed

3 files changed

+112
-27
lines changed

README.md

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,7 @@ DIPLOMAT provides a multi-animal pose estimation and editing interface. It relie
2121
| ![Example of tracking 2 Degus](https://raw.githubusercontent.com/TravisWheelerLab/DIPLOMAT/main/docs/source/_static/imgs/example1.png) | ![Example of tracking 3 Rats](https://raw.githubusercontent.com/TravisWheelerLab/DIPLOMAT/main/docs/source/_static/imgs/example2.png) |
2222
## Installation
2323

24-
DIPLOMAT also includes four environment configuration files for setting up DIPLOMAT with
25-
[mamba](https://mamba.readthedocs.io/en/latest/installation/mamba-installation.html), which can
26-
be installed on Windows, Linux, or MacOS using the [Miniforge](https://github.com/conda-forge/miniforge) installer.
27-
To create an environment using mamba, run one of these four commands:
28-
```bash
29-
# Create the environment for using DIPLOMAT with DeepLabCut
30-
# GPU:
31-
mamba env create -f https://raw.githubusercontent.com/TravisWheelerLab/DIPLOMAT/main/conda-environments/DIPLOMAT-DEEPLABCUT.yaml
32-
# CPU only:
33-
mamba env create -f https://raw.githubusercontent.com/TravisWheelerLab/DIPLOMAT/main/conda-environments/DIPLOMAT-DEEPLABCUT-CPU.yaml
34-
# OR Create an environment for using DIPLOMAT with SLEAP instead...
35-
# GPU:
36-
mamba env create -f https://raw.githubusercontent.com/TravisWheelerLab/DIPLOMAT/main/conda-environments/DIPLOMAT-SLEAP.yaml
37-
# CPU only:
38-
mamba env create -f https://raw.githubusercontent.com/TravisWheelerLab/DIPLOMAT/main/conda-environments/DIPLOMAT-SLEAP-CPU.yaml
39-
```
40-
And then activate the environment with one of these two commands:
41-
```bash
42-
# Activate the DeepLabCut/DIPLOMAT environment...
43-
mamba activate DIPLOMAT-DEEPLABCUT
44-
# Activate the SLEAP/DIPLOMAT environment...
45-
mamba activate DIPLOMAT-SLEAP
46-
```
47-
48-
For a more thorough explanation of the installation process and alternative installation methods, see the
49-
[documentation](https://diplomat.readthedocs.io/en/latest/installation.html).
24+
For detailed installation instructions, please refer to the [documentation](https://diplomat.readthedocs.io/en/latest/installation.html)!
5025

5126
## Usage
5227

diplomat/predictors/fpe/frame_passes/repair_clusters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class RepairClusters(FramePass):
1919
def __init__(self, *args, **kwargs):
2020
super().__init__(*args, **kwargs)
2121

22+
@classmethod
2223
def get_config_options(cls) -> ConfigSpec:
2324
import diplomat.processing.type_casters as tc
2425

docs/source/installation.rst

Lines changed: 110 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,44 @@ DIPLOMAT with DeepLabCut support by simply using pip, using one of the two comma
7070
# Install DIPLOMAT with DeepLabCut without UI support.
7171
pip install diplomat-track[dlc]
7272
73+
Troubleshooting for DIPLOMAT-DLC
74+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
75+
76+
If the standard methods fail to install DIPLOMAT and DLC, you can install from
77+
the Github source code. This method requires `git <https://git-scm.com/downloads>`_, as well
78+
as Miniforge.
79+
80+
.. code-block:: sh
81+
82+
# Clone the DIPLOMAT repository and navigate into it.
83+
git clone https://github.com/TravisWheelerLab/DIPLOMAT
84+
cd DIPLOMAT
85+
# With Miniforge, create a Python 3.10 environment and activate it.
86+
conda create -n py310 python==3.10
87+
conda activate py310
88+
# Use the environment you just activated to create a virtual environment ("venv") containing Python 3.10.
89+
python -m venv venv
90+
# Fully deactivate the Miniforge environment.
91+
# (run the command twice)
92+
conda deactivate
93+
conda deactivate
94+
# Now, activate the virtual environment.
95+
## On Windows, the first time you activate the venv, you may need to configure your execution policy.
96+
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
97+
## Activate the venv on Windows.
98+
venv/scripts/Activate
99+
## Activate the venv on Mac/Linux.
100+
source venv/bin/activate
101+
# Finally, install DIPLOMAT and DLC. The installation may take several minutes to complete.
102+
python -m pip install -e .[dlc,gui] --ignore-installed
103+
# Verify that the installation was successful. The following command should output the current version number.
104+
diplomat --version
105+
106+
On Windows, if DIPLOMAT crashes with "OSError: [WinError 126]", you need the libomp DLL.
107+
Download the .zip from https://www.dllme.com/dll/files/libomp140_x86_64/versions, extract
108+
it, and copy the .dll file to the torch libraries folder of your virtual environment, which
109+
should be located at ``.\venv\lib\site-packages\torch\lib`` within the DIPLOMAT directory.
110+
If you named your virtual environment something other than ``venv``, change the path accordingly.
73111

74112
With Support for SLEAP Projects
75113
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -119,4 +157,75 @@ trying to install DIPLOMAT with SLEAP support on Windows, prefer using the mamba
119157
# Install DIPLOMAT with SLEAP with GUI support.
120158
pip install diplomat-track[sleap, gui]
121159
# Install DIPLOMAT with SLEAP without UI support.
122-
pip install diplomat-track[sleap]
160+
pip install diplomat-track[sleap]
161+
162+
Troubleshooting for DIPLOMAT-SLEAP
163+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
164+
165+
If the Mamba method fails to install DIPLOMAT and SLEAP, you may need to downgrade the
166+
numpy version manually. Activate the mamba environment with ``mamba activate DIPLOMAT-SLEAP``,
167+
then downgrade numpy with ``pip install numpy<1.23.0``.
168+
169+
Verifying the DIPLOMAT installation
170+
-----------------------------------
171+
172+
Downloading the Sample data
173+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
174+
175+
Sample models and a video are provided `on Zenodo <https://zenodo.org/records/14232002>`_ for
176+
verifying the installation. Download the video clip `N5PZS.avi` and the model corresponding to
177+
your installation (DLC_5bp.zip for DeepLabCut, SLEAP_5bp.zip for SLEAP.) Unzip the model. Your
178+
working directory should now contain both the video file `N5PZS.avi` and the model folder, either
179+
`test_dlc_5/` or `test_sleap_5/`. Verify that both are present by running ``ls``.
180+
181+
Activating the environment
182+
^^^^^^^^^^^^^^^^^^^^^^^^^^
183+
184+
Next, you will activate the environment for DIPLOMAT. Unless you installed with the
185+
`Using PIP` method, you have to activate the environment that was created for DIPLOMAT in
186+
a previous step.
187+
188+
Activating with Mamba
189+
~~~~~~~~~~~~~~~~~~~~~
190+
If you used the mamba installation
191+
process, you'll run
192+
``mamba activate DIPLOMAT-DEEPLABCUT`` or
193+
``mamba activate DIPLOMAT-SLEAP``.
194+
195+
Activating with venv
196+
~~~~~~~~~~~~~~~~~~
197+
If you followed the virtual environment-based methods (DLC troubleshooting or developer
198+
install) you'll run ``venv/scripts/Activate`` on Windows or ``source venv/bin/activate``
199+
on Mac/Linux (replacing `venv` with whatever you named the virtual environment.)
200+
201+
Activating with PIP
202+
~~~~~~~~~~~~~~~~~~~
203+
If you followed the PIP-only method and installed DIPLOMAT to your default environment,
204+
no action is necessary.
205+
206+
Verify
207+
^^^^^^
208+
In the directory containing the sample video and model, you can run track to verify that
209+
all of DIPLOMAT's functionality were installed properly.
210+
211+
Verify tracking without GUI
212+
~~~~~~~~~~~~~~~~~~~~
213+
For DeepLabCut, run
214+
``diplomat track -c test_dlc_5 -v N5PZS.avi``.
215+
216+
For SLEAP, run
217+
``diplomat track -c test_sleap_5 -v N5PZS.avi``.
218+
219+
If the tracking completes successfully, a new file ending with extension either `.h5` or
220+
`.slp` will now be present.
221+
222+
Verify tracking with GUI
223+
~~~~~~~~~~~~~~~~~
224+
For DeepLabCut, run
225+
``diplomat track_and_interact -c test_dlc_5 -v N5PZS.avi``.
226+
227+
For SLEAP, run
228+
``diplomat track_and_interact -c test_sleap_5 -v N5PZS.avi``.
229+
230+
After tracking completes, the manual annotation window will be opened and you should be
231+
able to make changes to the automated results.

0 commit comments

Comments
 (0)