Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: "Getting Started with MegaDetector-Acoustic: Audio Species Classification"
description: "Getting started with MegaDetector-Acoustic: install the toolkit, prepare audio into spectrograms, train a classifier, and run sliding-window inference."
slug: getting-started
tags:
- getting started
- MegaDetector-Acoustic
- bioacoustics
- audio species classification
- passive acoustic monitoring
---

# Getting Started with MegaDetector-Acoustic

New to MegaDetector-Acoustic? This page is the short path from raw recordings to species predictions. It runs four steps: install the toolkit, turn audio into spectrograms, train a classifier, and run inference on long recordings. Each step points to the deeper reference when you want more detail.

If you would rather see the whole pipeline end to end first, the demo notebook walks through it on real bird recordings.

## Is MegaDetector-Acoustic right for my project?

MegaDetector-Acoustic is the Microsoft AI for Good Lab toolkit for training, evaluating, and deploying deep learning models on passive acoustic monitoring recordings. It is built on the [PyTorch-Wildlife](https://github.com/microsoft/Pytorch-Wildlife) framework and turns raw audio into structured, per-window species predictions.

Reach for it when you:

- Work with passive acoustic recordings rather than camera-trap images.
- Want to train a classifier on your own taxa and habitats.
- Need to scan long field recordings and get probabilities you can review.

If your data is imagery instead of audio, [MegaDetector](https://github.com/microsoft/MegaDetector) is the camera-trap counterpart, and the [microsoft/Biodiversity](https://github.com/microsoft/Biodiversity) hub maps the rest of the ecosystem.

## Step 1: Install

Clone the repository and install its dependencies:

```bash
git clone https://github.com/microsoft/MegaDetector-Acoustic
cd MegaDetector-Acoustic
pip install -r requirements.txt
```

You need Python 3.9+ and PyTorch 2.0+. A CUDA GPU is optional but recommended, since spectrogram generation and training run much faster on one. The full requirements list, a verification snippet, and GPU notes are on the [Installation](installation.md) page.

## Step 2: Prepare your audio

The toolkit converts raw `.wav` and `.flac` recordings into model-ready input. First it slices each recording into sliding windows. Then it builds GPU-accelerated mel spectrograms from those windows. This preparation pass feeds both training and inference, so run it on a small sample first and confirm the windows and spectrograms look right before you commit to a full dataset.

## Step 3: Train a classifier

With spectrograms ready, train a classifier. MegaDetector-Acoustic uses ResNet backbones. It supports both binary classification (is this one target species present or not) and multiclass classification (which of several species is calling), and spectrogram augmentation such as SpecAugment and MixUp helps the model generalize from the limited labeled audio that bioacoustic projects usually have. Copy `template.yaml` as the starting point for your domain configuration.

## Step 4: Run inference and review

Point a trained model at long recordings to get predictions. Inference runs as a sliding window across each file and exports a CSV with per-window probabilities. The output is probabilities, not hard labels. That gives you room to choose: set a confidence cutoff, aggregate adjacent windows, or send the uncertain ones to a human for review, depending on how much precision your study needs.

## Next steps and help

- Run the [demo notebook](https://github.com/microsoft/MegaDetector-Acoustic/blob/main/demo/bioacoustics_demo.ipynb) for an end-to-end walkthrough on real bird recordings.
- See the [README](https://github.com/microsoft/MegaDetector-Acoustic#quick-start) for full command-line usage.
- File questions and issues at [microsoft/MegaDetector-Acoustic](https://github.com/microsoft/MegaDetector-Acoustic).

MegaDetector-Acoustic is part of the [microsoft/Biodiversity](https://github.com/microsoft/Biodiversity) umbrella, which links every tool in the AI for Good Lab wildlife ecosystem.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ MegaDetector-Acoustic turns raw audio recordings into structured species predict

## Get Started

See the [Installation](installation.md) page, then run the demo notebook:
New here? The [Getting Started](getting-started.md) guide walks the full path from install to running inference. For a quick start, see the [Installation](installation.md) page, then run the demo notebook:

```bash
git clone https://github.com/microsoft/MegaDetector-Acoustic
Expand Down
2 changes: 2 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ tags:

# Installation

New to MegaDetector-Acoustic? The [Getting Started](getting-started.md) guide puts this install step in the full path from audio to species predictions.

## Requirements

- Python 3.9+
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ theme:
nav:
- MegaDetector-Acoustic:
- Overview: index.md
- Getting Started: getting-started.md
- Installation: installation.md
- Tags: tags.md
- Cite Us: cite.md
Expand Down
38 changes: 38 additions & 0 deletions overrides/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,44 @@
</script>
{%- endif %}

{%- if page and page.file and page.file.src_path == "getting-started.md" and page.canonical_url %}
{#- Getting Started page only: HowTo. Steps mirror the visible getting-started.md headings. -#}
<script type="application/ld+json">
{{- {
"@context": "https://schema.org",
"@type": "HowTo",
"name": "Getting Started with MegaDetector-Acoustic",
"description": "How to get started with MegaDetector-Acoustic: install the toolkit, prepare audio into spectrograms, train a classifier, and run sliding-window inference on long recordings.",
"step": [
{
"@type": "HowToStep",
"name": "Install",
"text": "Clone the MegaDetector-Acoustic repository and install its requirements with pip. Python 3.9+ and PyTorch 2.0+ are required; a CUDA GPU is optional but recommended.",
"url": page.canonical_url ~ "#step-1-install"
},
{
"@type": "HowToStep",
"name": "Prepare your audio",
"text": "Convert raw .wav and .flac recordings into sliding windows and GPU-accelerated mel spectrograms, the model-ready input for training and inference.",
"url": page.canonical_url ~ "#step-2-prepare-your-audio"
},
{
"@type": "HowToStep",
"name": "Train a classifier",
"text": "Train a ResNet classifier for binary or multiclass species classification, using SpecAugment and MixUp augmentation and a domain configuration from template.yaml.",
"url": page.canonical_url ~ "#step-3-train-a-classifier"
},
{
"@type": "HowToStep",
"name": "Run inference and review",
"text": "Run sliding-window inference on long recordings to export a CSV of per-window probabilities, then threshold, aggregate, or review the windows as your study requires.",
"url": page.canonical_url ~ "#step-4-run-inference-and-review"
}
]
} | tojson -}}
</script>
{%- endif %}

{%- if page and page.file and page.file.src_path != "index.md" and page.canonical_url %}
<script type="application/ld+json">
{{- {
Expand Down