R users who are new to Python

We expect that most people using Pyseter will be familiar with R, and completely new to Python. This raises the question: why release Pyseter as a Python package? The answer is that Python is much more suited to deep learning than R, and most of the new developments in automated photo-identification rely on deep learning.

As such, Pyseter users will have to familiarize themselves with a few Python concepts, such as conda and Jupyter, before getting started.

Install conda

Conda is an important tool for managing packages in Python. While R, for the most part, handles packages for you behind the scenes, Python requires a more hands on approach.

To get started, we first need to install a package manager called conda. There are many forms of conda, with Anaconda being the most popular. For several reasons, we prefer another form of conda called Miniforge.

  • Download and install Miniforge (a form of conda)

After installing, you can verify your installation by opening the command line interface (CLI), which will depend on your operating system. Are you on Windows? Open the “miniforge prompt” in your start menu. Are you on Mac? Open the Terminal application. Then, type the following command into the CLI and hit return.

conda --version

You should see something like conda 25.5.1. Of course, Anaconda, miniconda, mamba, or any other form of conda will work too.

Create a new environment

Then, you’ll create an environment for the package will live in. Environments are walled off areas where we can install packages. This allows you to have multiple versions of the same package installed on your machine, which can help prevent conflicts.

Enter the following two commands into the CLI:

conda create -n pyseter_env
conda activate pyseter_env

Here, I name (hence the -n) the environment pyseter_env, but you can call it anything you like!

Now your environment is ready to go! Try installing your first package, pip. Pip is another way of installing Python packages, and will be helpful for installing PyTorch and Pyseter (see below). To do so, enter the following command into the CLI.

conda install pip -y

In this case, we include the -y argument so we don’t have to immediately answer yes to the next question. Once this is working, you’re ready to proceed to the next section.

Install PyTorch

Installing PyTorch will allow users to extract features from images, i.e., identify individuals in images. Extracting features should be reasonably quick for users with an NVIDIA GPU (e.g., 2 minutes per 1000 images). In our testing, feature extraction takes about 5 times longer for users with Apple Silicon (e.g., 10 minutes per 1000 images).

Warning

Feature extraction will be extremely slow for users who do not have access to an NVIDIA GPU or Apple Silicon. Users may want to check if their university or agency has access to GPUs via a high performance computing cluster (HPC). Also, Google Colab and other similar services (e.g., Kaggle) allow users to rent GPU resources.

PyTorch installation can be a little finicky. Essentially, it depends on what operating system you’re using, and what version of CUDA you’re using. CUDA is the technology that turns your NVIDIA GPU into a deep learning machine. To install PyTorch, I recommend following these instructions.

Windows users

Below is an example for Windows users. This relies on CUDA 12.8, which should work for most people. If you haven’t already, open the CLI (e.g., the miniforge prompt). Then activate your environment before installing.

conda activate pyseter_env
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu128

PyTorch is pretty big (over a gigabyte), so this may take a few minutes.

Mac users

Below is an example for Mac users. The Mac version of PyTorch relies on MPS acceleration, which is good but not at the level of CUDA. If you haven’t already, open you’re command line interface (e.g., the miniforge prompt). Then activate your environment before installing.

conda activate pyseter_env
pip3 install torch torchvision 

PyTorch is pretty big (over a gigabyte), so this may take a few minutes.

Warning

Mac users will need to have an Apple Silicon processor, e.g., an M1 chip. Additionally, they will need at least 16 GB of memory (RAM) to use AnyDorsal.

Install Pyseter

Now, install Pyseter. If you haven’t already, activate your environment before installing.

conda activate pyseter_env
pip3 install pyseter

Now you’re ready to go!

Install VS Code or Positron

Most users will interact with Pyseter via a Jupyter Notebook. There are many methods for opening, editing, running, and saving Jupyter Notebooks. We are personally biased towards VS Code. Alternatively, R users might also try out Positron. The team at Posit (formerly, R Studio) developed Positron from the open source version of VS Code, but with R users in mind. As such, it might be a nice hybrid option. That said, we have found Positron to throw confusing errors and have found VS Code to be more stable.

Open VS Code, then click “File -> Open Folder”. Navigate to wherever you’d like to work, then click “New Folder.” You can call this folder something like “learn-pyseter” or “pyseter-jobs”. Open the new folder. Click “File -> New File” then select Jupyter Notebook. Click “Select Kernel” in the top right corner, select “Python environments” and then “pyseter_env”, or whatever you named your environment. For more information, check out this great overview of using Jupyter Notebooks in VS Code.

Now you’re ready to proceed to the next section.

Verify the installation

Verify the Pyseter installation by running the following cell in your notebook.

import pyseter
pyseter.verify_pytorch()

If you’re on a windows computer with an NVIDIA GPU, you should see something like

✓ PyTorch 2.7.1+cu126 detected
✓ CUDA GPU available: NVIDIA A30 MIG 2g.12gb

Once this is working, you’re ready to check out the “General Overview” notebook in the examples folder of this repository!

AnyDorsal weights

Pyseter relies on the AnyDorsal algorithm to extract features from images. The first time you use the FeatureExtractor, Pyseter will download the AnyDorsal weights from Hugging Face. The weights take up roughly 4.5 GB. As such, to use the FeatureExtractor, users must have enough storage space to accommodate the weights.