Troubleshooting & FAQ¶
Hit an error or seeing unexpected detections on your field footage? Start with the symptom that matches what you see below. Most setup and field-data issues take under two minutes to fix.
Installation & Environment¶
Wrong Python version or NumPy 2.x errors¶
PrimateFace requires Python >= 3.9 (Python 3.10 recommended) and pins numpy==1.26.4 because current OpenMMLab (mmcv / mmpose) packages are not yet compatible with NumPy 2.x. If you see AttributeError: _ARRAY_API not found or ImportError inside cv2 / mmcv:
ModuleNotFoundError: No module named 'rfdetr'¶
The default v1.0.0 Apache-2.0 face detector (RF-DETR-M) is installed via the [rfdetr] optional extra:
mmcv / mmpose installation or compiled-extension errors¶
OpenMMLab packages require matched versions (mmengine==0.10.3, mmcv==2.1.0, mmdet==3.2.0, mmpose==1.3.2). Always install them via openmim (which fetches prebuilt binary wheels—pre-compiled packages matching your PyTorch/CUDA version) rather than compiling from source. Because mim calls pip internally, create uv environments with --seed so pip is installed inside .venv:
uv venv --python 3.10 --seed
source .venv/bin/activate
uv pip install -U pip openmim "numpy==1.26.4"
mim install mmengine==0.10.3 mmcv==2.1.0 mmdet==3.2.0 mmpose==1.3.2
For full step-by-step setup on Linux, macOS, Windows, and Google Colab, see Installation.
GPU & Memory¶
No GPU / running on a laptop¶
You do not need a GPU to run PrimateFace on photos or short clips. Pass device="cpu" with the lightweight 41 MB HRNet pose model, or switch to free cloud GPUs in Google Colab:
import primateface
pf = primateface.PrimateFace(device="cpu", pose_model="hrnet")
faces = pf.analyze("monkey.jpg")
CUDA out of memory (OOM)¶
ViTPose-L is our largest checkpoint (1.23 GB) and uses the most GPU memory (VRAM). If your GPU runs out of VRAM (GPU memory):
- Switch to a lighter pose model:
PrimateFace(pose_model="hrnet")(41 MB) orPrimateFace(pose_model="rtmpose")(62 MB, fastest). - In batch scripts (
gui.pseudolabel,dinov2.dinov2_cli, or training scripts), lower--batch-size(for example, from32to8) or--max-instances.
Model Downloads & Checksums¶
Running on an offline HPC cluster (no internet on compute nodes)¶
On university computing clusters, the login node (where you sign in) usually has internet access, while the compute node (the GPU worker node running your job) is offline. Download the models once on a login node, then point PrimateFace at that folder using model_dir:
# On the offline GPU worker (compute) node (skips Hugging Face network access):
import primateface
pf = primateface.PrimateFace(model_dir="./models")
ValueError: SHA-256 mismatch¶
Every v1.0.0 checkpoint is verified against a SHA-256 checksum (a digital fingerprint that detects corrupted or incomplete downloads). If a Wi-Fi drop cut a download short, re-download cleanly with --force:
Detection & Landmark Quality in Field Data¶
False positives on empty camera-trap frames¶
Default detection confidence is det_threshold=0.5, which favors catching hard partial faces. On empty or cluttered forest backgrounds, raise the threshold to 0.70 or 0.75:
Missing very small or distant faces (< 32 pixels wide)¶
Face detectors struggle when a face spans fewer than ~32 pixels across. Whenever possible:
- Run inference on the original full-resolution frame (do not downscale video before detection).
- If animals consistently stay in one region of a wide-angle enclosure camera, crop that region first so faces occupy a larger fraction of the image.
Jittery landmarks across consecutive video frames¶
Frame-by-frame landmark estimation can produce slight 1–2 pixel jitter in video. Enable our built-in temporal filter (Median + Savitzky-Golay smoothing), which removes single-frame spikes without blurring fast mouth or brow movements:
Blurry, occluded, or extreme-profile faces¶
Before computing downstream kinematics (such as mouth aperture or head pose), filter out low-quality detections using the built-in quality score and mean landmark confidence:
See Scope & Limitations for expected accuracy across species, lighting, and extreme profiles.
Still Stuck?¶
Please open a ticket on GitHub Issues and include:
- Your OS, Python version (
python --version), and whether you are using CPU or a GPU (nvidia-smi). - The exact command or minimal Python snippet that triggered the problem.
- The full error traceback (or a description of the visual failure on your footage).