| title | Install MegaDetector: pip, Conda, and GPU Setup | ||||||
|---|---|---|---|---|---|---|---|
| description | Install MegaDetector via PyTorch-Wildlife for camera-trap detection: pip, conda, and Docker on Windows, macOS, and Linux, with optional CUDA GPU support. | ||||||
| tags |
|
MegaDetector is installed as part of the PyTorch-Wildlife framework. A single pip install PytorchWildlife pulls in the latest MegaDetector V6, and the model weights download automatically the first time you run a detection.
pip install PytorchWildlifeRequirements:
- Python 3.8+ (3.10+ recommended)
- Optional: NVIDIA GPU with CUDA for 10–50x speedup
conda create -n megadetector python=3.10 -y
conda activate megadetector
pip install PytorchWildlifeIf PyTorch installed without CUDA support, install the GPU-enabled build manually:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121Then reinstall PyTorch-Wildlife:
pip install PytorchWildlifeTo use the local megadetector command-line tool, or to fine-tune V6 weights on your own dataset, install this repository in editable mode:
git clone https://github.com/microsoft/MegaDetector
cd MegaDetector
pip install -e .This installs the megadetector_core package and registers the megadetector command (detect, train, validate, inference). The pyproject.toml declares the full dependency set, so there is no separate requirements.txt.
Prefer conda for a source install? The repository ships an environment.yaml you can build from directly:
conda env create -f environment.yaml
conda activate megadetector
pip install -e .Confirm the CLI is on your path:
megadetector --helpSee the CLI reference for the full command surface, and the Repository Architecture for how the megadetector_core package is organized.
from PytorchWildlife.models import detection as pw_detection
model = pw_detection.MegaDetectorV6()
print("MegaDetector loaded successfully.")Weights are downloaded automatically on first use.
- Hugging Face demo: upload images in your browser
- Google Colab notebook: free cloud GPU
- CLI Reference: run detection from the command line
- Model Zoo: choose the right MDV6 variant for your hardware
- Training Guide: fine-tune MegaDetector on your own data