Installation¶
Prerequisites¶
- Python 3.8+ (3.10+ recommended)
- Optional: NVIDIA GPU with CUDA 12.1 for 10–50x speedup
pip¶
Conda¶
conda create -n pytorch-wildlife python=3.10 -y
conda activate pytorch-wildlife
pip install PytorchWildlife
Windows users: Use the Anaconda Prompt if using Anaconda, otherwise use PowerShell.
GPU Setup¶
Check if CUDA is available¶
Install GPU-enabled PyTorch (CUDA 12.1)¶
If torch.cuda.is_available() returns False on a CUDA machine:
pip uninstall torch torchvision torchaudio
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install PytorchWildlife
Ubuntu — OpenCV dependency¶
macOS — ffmpeg for video decoding¶
Windows¶
See the Windows installation guide for a step-by-step walkthrough.
Verify Installation¶
from PytorchWildlife.models import detection as pw_detection
model = pw_detection.MegaDetectorV6()
print("PyTorch-Wildlife loaded successfully.")
Model weights download automatically on first use.
Try Without Installing¶
- Hugging Face demo — upload images in your browser
- Google Colab notebook — free cloud GPU
Docker¶
docker pull andreshdz/pytorchwildlife:1.0.2.3
docker run -p 80:80 andreshdz/pytorchwildlife:1.0.2.3 python demo/gradio_demo.py
Jupyter Notebooks¶
To use the demo notebooks with Jupyter:
conda install ipykernel
python -m ipykernel install --user --name pytorch-wildlife --display-name "Python (PytorchWildlife)"
Then select the Python (PytorchWildlife) kernel when running notebooks.