Skip to content

Birdnet 3#47

Open
Josef-Haupt wants to merge 5 commits into
geomodel-3.0from
birdnet-3
Open

Birdnet 3#47
Josef-Haupt wants to merge 5 commits into
geomodel-3.0from
birdnet-3

Conversation

@Josef-Haupt
Copy link
Copy Markdown
Member

No description provided.

@Josef-Haupt Josef-Haupt marked this pull request as ready for review May 12, 2026 19:45
Copilot AI review requested due to automatic review settings May 12, 2026 19:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds BirdNET acoustic model v3.0 support to the codebase, introducing PyTorch (TorchScript) and ONNX backends alongside the existing TF/PB model infrastructure.

Changes:

  • Introduce new acoustic v3.0 model implementation and download/label generation logic.
  • Add Torch and ONNX runtime backends, loader support, and optional dependency extras.
  • Expand the test suite to cover v3.0 loading, custom loading, and PT-vs-ONNX output comparisons.

Reviewed changes

Copilot reviewed 16 out of 25 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/birdnet/utils/local_data.py Adds .pt and .onnx model path resolution for new backends.
src/birdnet/model_loader.pyi Updates typing overloads to expose v3.0 acoustic model backends (pt, onnx).
src/birdnet/model_loader.py Implements v3.0 acoustic loading + optional runtime availability checks and clearer unsupported-backend errors.
src/birdnet/globals.py Adds acoustic v3.0 version constant and expands backend literals to include pt/onnx.
src/birdnet/core/backends.py Introduces TorchBackend and OnnxBackend, plus runtime detection utilities and model loaders.
src/birdnet/acoustic/models/v3_0/model.py Adds v3.0 acoustic model API + label/taxonomy download and per-language label generation.
src/birdnet/acoustic/models/v3_0/pt.py Adds TorchScript downloader + backend adapter for v3.0 acoustic model.
src/birdnet/acoustic/models/v3_0/onnx.py Adds ONNX downloader + backend adapter for v3.0 acoustic model.
src/birdnet/acoustic/models/v3_0/init.py Declares the v3.0 acoustic models package.
src/birdnet_tests/model_loader_py/acoustic/test_acoustic_load_v3_0.py Tests v3.0 loader behavior, runtime gating, and backend selection.
src/birdnet_tests/model_loader_py/acoustic/test_acoustic_load_custom_v3_0.py Tests custom model loading and suffix validation for v3.0.
src/birdnet_tests/helper.py Adds skip helpers for torch/onnxruntime and improves array closeness assertions.
src/birdnet_tests/acoustic_models/v3_0/test_model_v3_0.py Tests language-file generation from taxonomy/labels inputs.
src/birdnet_tests/acoustic_models/v3_0/model_py/test_predict/test_acoustic_predict_model_v3_0.py Adds v3.0 prediction shape/segment-size tests and PT-vs-ONNX closeness checks.
src/birdnet_tests/acoustic_models/v3_0/model_py/test_encode/test_acoustic_encode_model_v3_0.py Adds v3.0 encoding shape/segment-size tests and PT-vs-ONNX closeness checks.
src/birdnet_tests/acoustic_models/v2_4/** Adds additional v2.4 session/validation/download-related tests.
pyproject.toml Adds optional extras for pt/onnx and includes them in tox deps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/birdnet/acoustic/models/v3_0/model.py Outdated
Comment thread src/birdnet/globals.py
VALID_ACOUSTIC_MODEL_VERSIONS = [
ACOUSTIC_MODEL_VERSION_V2_4,
ACOUSTIC_MODEL_VERSION_V3_0,
ACOUSTIC_MODEL_VERSION_V2,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stefantaubert looks abandoned?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 28 changed files in this pull request and generated 3 comments.

)

monkeypatch.setattr(model_module, "_LABELS_RAW_PATH", labels_raw)
monkeypatch.setattr(model_module, "_TAXONOMY_PATH", taxonomy)
Comment thread src/birdnet/globals.py
VALID_ACOUSTIC_MODEL_VERSIONS = [
ACOUSTIC_MODEL_VERSION_V2_4,
ACOUSTIC_MODEL_VERSION_V3_0,
ACOUSTIC_MODEL_VERSION_V2,
Comment on lines +160 to +162
localized_name = en_us_name
lines.append(f"{sci_name}_{localized_name}")
lang_file.write_text("\n".join(lines), encoding="utf-8")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants