batdetect2/docs/source/how_to/inference/tune-detection-threshold.md
mbsantiago 67aee0b79c
Some checks failed
CI / Checks (push) Has been cancelled
Docs Pages / Build Docs (push) Has been cancelled
CI / Tests (Python ${{ matrix.python-version }}) (3.10) (push) Has been cancelled
CI / Tests (Python ${{ matrix.python-version }}) (3.11) (push) Has been cancelled
CI / Tests (Python ${{ matrix.python-version }}) (3.12) (push) Has been cancelled
Docs Pages / Deploy Docs (push) Has been cancelled
Update structure
2026-06-02 13:42:05 +01:00

1.4 KiB

How to tune detection threshold

Use this guide to compare detection outputs at different threshold values.

The goal is not to find a universal threshold.

The goal is to choose a threshold that fits your reviewed local data and the project trade-off between missed calls and false positives.

1) Start with a baseline run

Run an initial prediction workflow and keep outputs in a dedicated folder.

2) Sweep threshold values

Run process multiple times with different thresholds (for example 0.1, 0.3, 0.5) and compare output counts and quality on the same validation subset.

batdetect2 process directory \
  path/to/model.ckpt \
  path/to/audio_dir \
  path/to/outputs_thr_03 \
  --detection-threshold 0.3

Keep each threshold run in a separate output directory.

That makes it easier to compare counts and inspect example files without mixing results.

3) Validate against known calls

Use files with trusted annotations or expert review to select a threshold that fits your project goals.

Check both:

  • obvious false positives,
  • obvious missed calls.

If class interpretation matters downstream, inspect class ranking behavior as well, not just detection counts.

4) Record your chosen setting

Write down the chosen threshold and rationale so analyses are reproducible.

For conceptual trade-offs, see {doc}../explanation/model-output-and-validation.