microsoft/MegaDetector
Python
Captured source
source ↗microsoft/MegaDetector
Description: MegaDetector V6 — Microsoft AI for Good Lab's open-source model that detects animals, people, and vehicles in camera-trap images, filtering blanks to speed wildlife research.
Language: Python
License: MIT
Stars: 16
Forks: 2
Open issues: 2
Created: 2026-04-24T23:10:04Z
Pushed: 2026-06-04T22:35:52Z
Default branch: main
Fork: no
Archived: no
README:
MegaDetector
MegaDetector is an open-source AI model from the [Microsoft AI for Good Lab](https://www.microsoft.com/en-us/ai/ai-for-good) that detects animals, people, and vehicles in camera-trap images. Used by more than 80 conservation organizations worldwide, MegaDetector automates camera-trap image review so researchers can skip empty frames and focus on science. It is an animal detector, not a species classifier. It finds and boxes objects, then hands them to a downstream classifier for species identification.
MegaDetector is one project in the microsoft/Biodiversity ecosystem and is invoked through the PyTorch-Wildlife framework. It is free, open-source, and available under permissive licenses.

Quick Start
pip install PytorchWildlife
from PytorchWildlife.models import detection as pw_detection
# Load MegaDetector V6 (weights download automatically)
model = pw_detection.MegaDetectorV6()
# Run on a single image
results = model.single_image_detection("path/to/camera_trap_image.jpg")
# Run on a folder of images
results = model.batch_image_detection("path/to/image_folder/")That's it. Three lines to detect animals in your camera-trap images.
Need the local megadetector CLI or fine-tuning? See [Install from source](#install-from-source-for-fine-tuning-or-cli-use) and [Fine-Tuning](#fine-tuning) below.
Try it without installing anything:
- Hugging Face demo: upload images in your browser
- Google Colab notebook: free cloud GPU
What Does MegaDetector Do?
Camera traps generate millions of images, and in typical deployments 70–95% are empty, frames triggered by wind, rain, or moving vegetation. Sorting those by hand is one of the biggest bottlenecks in wildlife research, and it scales badly: more cameras mean exponentially more images to clear before any science can begin.
MegaDetector solves this. It scans your images and draws bounding boxes around every animal (mammals, birds, reptiles, insects, and more), person, and vehicle it finds. Each detection has a confidence score between 0 and 1. You set a threshold (typically 0.15–0.3), and anything above it is flagged. The output lets you sort images, filter blanks, separate human and vehicle traffic, or feed detected animals into a species classifier.
MegaDetector is intentionally a detector, not a classifier. "Animal vs. background" generalizes across ecosystems far better than species identification. For species classification, pair MegaDetector with a downstream classifier, see [Species Classification](#species-classification) below.
MegaDetector V6
The latest release focuses on efficiency and modern architectures, SMALLER, FASTER, BETTER.
Highlights
- 50x smaller: The compact YOLOv10 variant has 2.3M parameters, 2% of MegaDetector V5's 139.9M, with comparable accuracy
- Multiple architectures: YOLOv9, YOLOv10, and RT-DETR, so you can match the model to your hardware
- Ongoing fine-tuning: we keep retraining V6 on freshly collected public and private data to push generalization further
Model Variants
| Model | Params | Animal Recall | mAP50 | License | | --- | --- | --- | --- | --- | | MDV6-apa-rtdetr-e | 76M | 82.9% | 94.1% | Apache-2.0 | | MDV6-yolov10-e | 29.5M | 82.8% | 92.8% | AGPL-3.0 | | MDV6-yolov10-c | 2.3M | 76.8% | 87.2% | AGPL-3.0 | | MDV6-mit-yolov9-c | 9.7M | 74.8% | 87.6% | MIT |
This is a representative selection. The full nine-variant lineup (YOLOv9, YOLOv10, and RT-DETR, with MIT, Apache-2.0, and AGPL-3.0 options) and all metrics live in the Model Zoo. Variant names are standardized as MDV6-Compact and MDV6-Extra for the two sizes within each architecture.
Which should I use?
- Best accuracy:
MDV6-apa-rtdetr-e(82.9% recall, Apache-2.0) - Best for laptops/edge:
MDV6-yolov10-c(2.3M params, runs on CPU) - Permissive MIT license:
MDV6-mit-yolov9-c - Best via the `megadetector` CLI:
MDV6-yolov10-e. The CLI's--modelflag supportsMDV6-yolov9-c/e,MDV6-yolov10-c/e, andMDV6-rtdetr-c; the MIT and Apache variants load through PyTorch-Wildlife.
# Load a specific variant from PytorchWildlife.models import detection as pw_detection model = pw_detection.MegaDetectorV6(version="MDV6-yolov10-e")
Which MegaDetector Repo Should I Use?
Use this repository (`microsoft/MegaDetector`) for MegaDetector V6: the current models, the Model Zoo, the fine-tuning pipeline, and the documentation site. It is the official home maintained by the Microsoft AI for Good Lab.
If you are maintaining a legacy V5 workflow, the original models remain available: V5 weights live on the Biodiversity archive branch and load directly through PyTorch-Wildlife. For new projects, start with V6 here.
Installation
pip install PytorchWildlife
Requirements:
- Python 3.8+ (3.10+ recommended)
- Optional: NVIDIA GPU with CUDA for 10–50x speedup
Conda users:
conda create -n megadetector python=3.10 -y conda activate megadetector pip install PytorchWildlife
GPU setup (if PyTorch didn't install with CUDA):
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
Install from source (for fine-tuning or CLI use)
For the local megadetector command-line tool and 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…
Excerpt shown — open the source for the full document.
Notability
notability 3.0/10Low stars, routine new repo