Metadata-Version: 2.4
Name: birdnet
Version: 1.0.0
Summary: A Python library for identifying bird species by their sounds.
Author: Stefan Taubert
Maintainer: Stefan Taubert, Josef Haupt
License-Expression: MIT
Project-URL: Homepage, https://github.com/birdnet-team/birdnet
Project-URL: Issues, https://github.com/birdnet-team/birdnet/issues
Project-URL: Documentation, https://birdnet-team.github.io/birdnet
Project-URL: Repository, https://github.com/birdnet-team/birdnet.git
Project-URL: Changelog, https://github.com/birdnet-team/birdnet/blob/main/CHANGELOG.md
Keywords: birds,deep-learning,birdsong,acoustic-monitoring,bioacoustics
Classifier: Development Status :: 5 - Production/Stable
Classifier: Operating System :: OS Independent
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: BSD
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Unix
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: soundfile>=0.11.0
Requires-Dist: scipy>=1.8.0
Requires-Dist: ordered-set>=4.1.0
Requires-Dist: tqdm>=4.64.0
Requires-Dist: numpy>=1.22.0
Requires-Dist: pandas>=1.4.0
Requires-Dist: psutil>=5.9.0
Requires-Dist: pyarrow>=7.0.0
Requires-Dist: requests>=2.27.0
Requires-Dist: tensorflow>=2.8.0; (sys_platform != "darwin" or platform_machine != "x86_64") and python_version < "3.14"
Requires-Dist: tensorflow<2.17,>=2.8.0; sys_platform == "darwin" and platform_machine == "x86_64" and python_version < "3.14"
Requires-Dist: ai-edge-litert>=2.0.2; python_version <= "3.13" and (sys_platform == "linux" or (sys_platform == "darwin" and platform_machine == "arm64") or (sys_platform == "win32" and platform_machine == "AMD64"))
Provides-Extra: and-cuda
Requires-Dist: tensorflow[and-cuda]>=2.8.0; (sys_platform == "linux" and python_version < "3.14") and extra == "and-cuda"
Provides-Extra: pt
Requires-Dist: torch>=2.0.0; extra == "pt"
Provides-Extra: onnx
Requires-Dist: onnxruntime>=1.16.0; extra == "onnx"
Provides-Extra: repro
Requires-Dist: soundfile==0.12.1; extra == "repro"
Requires-Dist: scipy==1.16.3; extra == "repro"
Requires-Dist: ordered-set==4.1.0; extra == "repro"
Requires-Dist: tqdm==4.67.1; extra == "repro"
Requires-Dist: numpy==2.1.0; extra == "repro"
Requires-Dist: pandas==2.3.3; extra == "repro"
Requires-Dist: psutil==7.1.3; extra == "repro"
Requires-Dist: pyarrow==22.0.0; extra == "repro"
Requires-Dist: tensorflow==2.21.0; (sys_platform == "linux" or (sys_platform == "darwin" and platform_machine == "arm64") or (sys_platform == "windows" and platform_machine == "amd64")) and extra == "repro"
Requires-Dist: ai-edge-litert==2.0.3; (python_version < "3.13" and sys_platform == "linux") and extra == "repro"
Requires-Dist: absl-py==2.3.1; extra == "repro"
Requires-Dist: astunparse==1.6.3; extra == "repro"
Requires-Dist: backports.strenum==1.2.8; extra == "repro"
Requires-Dist: certifi==2025.11.12; extra == "repro"
Requires-Dist: cffi==2.0.0; extra == "repro"
Requires-Dist: charset-normalizer==3.4.4; extra == "repro"
Requires-Dist: flatbuffers==25.9.23; extra == "repro"
Requires-Dist: gast==0.6.0; extra == "repro"
Requires-Dist: google-pasta==0.2.0; extra == "repro"
Requires-Dist: grpcio==1.76.0; extra == "repro"
Requires-Dist: h5py==3.14.0; extra == "repro"
Requires-Dist: idna==3.11; extra == "repro"
Requires-Dist: keras==3.12.0; extra == "repro"
Requires-Dist: libclang==18.1.1; extra == "repro"
Requires-Dist: Markdown==3.10; extra == "repro"
Requires-Dist: markdown-it-py==4.0.0; extra == "repro"
Requires-Dist: MarkupSafe==3.0.3; extra == "repro"
Requires-Dist: mdurl==0.1.2; extra == "repro"
Requires-Dist: ml_dtypes==0.5.4; extra == "repro"
Requires-Dist: namex==0.1.0; extra == "repro"
Requires-Dist: opt_einsum==3.4.0; extra == "repro"
Requires-Dist: optree==0.18.0; extra == "repro"
Requires-Dist: packaging==25.0; extra == "repro"
Requires-Dist: pillow==12.0.0; extra == "repro"
Requires-Dist: protobuf==6.33.1; extra == "repro"
Requires-Dist: pycparser==2.23; extra == "repro"
Requires-Dist: Pygments==2.19.2; extra == "repro"
Requires-Dist: python-dateutil==2.9.0.post0; extra == "repro"
Requires-Dist: pytz==2025.2; extra == "repro"
Requires-Dist: pyyaml==6.0.3; extra == "repro"
Requires-Dist: requests==2.32.5; extra == "repro"
Requires-Dist: rich==14.2.0; extra == "repro"
Requires-Dist: setuptools==80.9.0; extra == "repro"
Requires-Dist: six==1.17.0; extra == "repro"
Requires-Dist: tensorboard==2.20.0; extra == "repro"
Requires-Dist: tensorboard-data-server==0.7.2; extra == "repro"
Requires-Dist: termcolor==3.2.0; extra == "repro"
Requires-Dist: typing_extensions==4.15.0; extra == "repro"
Requires-Dist: tzdata==2025.2; extra == "repro"
Requires-Dist: urllib3==2.5.0; extra == "repro"
Requires-Dist: Werkzeug==3.1.3; extra == "repro"
Requires-Dist: wheel==0.45.1; extra == "repro"
Requires-Dist: wrapt==2.0.1; extra == "repro"
Provides-Extra: tests
Requires-Dist: tox>=4.32.0; extra == "tests"
Requires-Dist: uv>=0.9.7; extra == "tests"
Requires-Dist: pytest>=8.4.2; extra == "tests"
Requires-Dist: pytest-cov>=7.0.0; extra == "tests"
Requires-Dist: pytest-xdist>=3.8.0; extra == "tests"
Requires-Dist: pytest-timeout>=2.4.0; extra == "tests"
Requires-Dist: mypy>=1.18.2; extra == "tests"
Requires-Dist: ruff>=0.14.4; extra == "tests"
Requires-Dist: build>=1.3.0; extra == "tests"
Requires-Dist: twine>=6.2.0; extra == "tests"
Provides-Extra: dev
Requires-Dist: jupyter; extra == "dev"
Requires-Dist: uv; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: rope; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: scipy-stubs; extra == "dev"
Requires-Dist: tuna; extra == "dev"
Requires-Dist: pyarrow-stubs; extra == "dev"
Requires-Dist: pygount; extra == "dev"
Requires-Dist: types-tqdm; extra == "dev"
Requires-Dist: types-requests; extra == "dev"
Requires-Dist: pandas-stubs; extra == "dev"
Requires-Dist: types-tensorflow; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx==8.2.3; extra == "docs"
Requires-Dist: sphinx-autodoc-typehints==3.5.2; extra == "docs"
Requires-Dist: sphinx-autobuild==2025.8.25; extra == "docs"
Requires-Dist: numpydoc==1.10.0; extra == "docs"
Requires-Dist: myst-parser==4.0.1; extra == "docs"
Dynamic: license-file

# birdnet

[![CI](https://github.com/birdnet-team/birdnet/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/birdnet-team/birdnet/actions/workflows/ci.yml)
[![codecov](https://codecov.io/github/birdnet-team/birdnet/branch/main/graph/badge.svg?token=DZ8LB2Q5I0)](https://codecov.io/github/birdnet-team/birdnet)
[![PyPI](https://img.shields.io/pypi/v/birdnet.svg)](https://pypi.python.org/pypi/birdnet)
![PyPI](https://img.shields.io/pypi/pyversions/birdnet.svg)
[![MIT](https://img.shields.io/github/license/birdnet-team/birdnet.svg)](https://github.com/birdnet-team/birdnet/blob/main/LICENSE.md)

A Python library for identifying bird species by their sounds.

The library is geared towards providing a robust workflow for ecological data analysis in bioacoustic projects. While it covers essential functionalities, it doesn’t include all the features found in BirdNET-Analyzer, which is available [here](https://github.com/birdnet-team/BirdNET-Analyzer). Some features might only be available in the BirdNET Analyzer and not in this package.

> [!NOTE]
> This project is under active development, so you might encounter changes that could affect your current workflow. We recommend checking for updates regularly.

The package is also available as an R package at: [birdnetR](https://github.com/birdnet-team/birdnetR).

## Features

* 🐦 Extract **classification scores and embeddings** from audio recordings — 6,522 species (V2.4) or 11,000+ (V3.0 preview)
* 📍 Predict **species presence** for a given location and time — 6,522 species (V2.4) or 12,000+ (V3.0)
* 🧠 Utilize your **custom-trained acoustic models** from BirdNET-Analyzer
* ⚙️ Support for both **CPU and GPU** execution (including multiple GPUs at the same time)
* 🚀 **Multiprocessing** support for fast batch analysis of large datasets
* 💾 **Low memory footprint** and small disk space requirements
* 🎵 Support for **various audio file formats** (WAV, FLAC, OGG, MP3, etc.)
* 📊 Export results in **various output file formats** (CSV, Arrow table, Parquet, Numpy, etc.)
* 💻 **Cross-platform**: Windows, macOS, and Linux
* 🌍 Use **multilingual** species names (English, German, French, Spanish, etc.)
* ⬇️ **Auto-download** of all official models
* 🛜 Full **offline usage** using local (custom) model files

*The library is optimized for a minimal memory footprint and maximum scalability, making it suitable for both edge devices and high-performance computing clusters.*

## Speed benchmarks

| Device             | Specs       | Disk | OS      | Real-time factor | Time to predict 1 h |
|--------------------|-------------|------|---------|------------------|---------------------|
| Intel i7 8th Gen   | 4 cores     | NVMe | Windows | 50×              | 72 s                |
| Ryzen 7 3800X      | 8 cores     | NVMe | Linux   | 420×             | 8.5 s               |
| Nvidia Titan RTX   | 24 GB VRAM  | NVMe | Linux   | 2460×            | 1.5 s               |

For more detailed benchmarks, please refer to the [documentation](https://birdnet-team.github.io/birdnet/benchmarking.html).

## Installation

### Platform support and Python versions

| Platform | Architecture | ProtoBuf-CPU | ProtoBuf-GPU | TFLite | LiteRT |
| ----------- | ------------ | ---------------- | ---------------- | ---------------- | ---------------- |
| **Linux** | x86_64 | 3.11, 3.12, 3.13 | 3.11, 3.12, 3.13 | 3.11, 3.12, 3.13 | 3.11, 3.12 |
| | ARM64 | 3.11, 3.12, 3.13 | / | 3.11, 3.12, 3.13 | 3.11, 3.12 |
| **MacOS** | x86_64 | 3.11, 3.12 | / | 3.11, 3.12 | / |
| | ARM64 | 3.11, 3.12, 3.13 | / | 3.11, 3.12, 3.13 | / |
| **Windows** | x86_64 | 3.11, 3.12, 3.13 | / | 3.11, 3.12, 3.13 | / |
| | ARM64 | / | / | / | / |

For details see the official [TensorFlow](https://www.tensorflow.org/install/pip#package_location) documentation.

#### Python 3.14

TensorFlow does not yet publish wheels for Python 3.14, so the table above (all TensorFlow-based backends: ProtoBuf, TFLite/LiteRT) is limited to Python 3.11–3.13. On Python 3.14, `birdnet` installs *without* TensorFlow and supports the models that have a TensorFlow-free backend: the **acoustic 3.0 model** and the **geo 3.0 model** (both via `onnx` or `pt`):

```sh
pip install birdnet[onnx] --user   # or birdnet[pt]
```

```py
import birdnet

model = birdnet.load("acoustic", "3.0", "onnx")  # 'pt' also works
predictions = model.predict("example/soundscape.wav")

geo = birdnet.load("geo", "3.0", "onnx")  # 'pt' also works
geo_predictions = geo.predict(42.5, -76.45, week=4)
```

The TensorFlow-only paths — the `tf`/`pb` backends, the acoustic 2.4 and Perch models, and the geo 2.4 model — raise a clear error on Python 3.14. To use them, install `birdnet` on Python 3.11–3.13. Full 3.14 support will follow once TensorFlow ships Python 3.14 wheels.

### Instructions

```sh
# For CPU users
pip install birdnet --user

# For GPU users (NVIDIA GPU driver and CUDA need to be installed in advance)
pip install birdnet[and-cuda] --user
```

The V3.0 models add two additional backends that require optional dependencies:

```sh
# PyTorch backend (.pt models)
pip install birdnet[pt] --user

# ONNX backend (.onnx models)
pip install birdnet[onnx] --user
```

If you encounter issues with audio file reading, please ensure that `libsndfile` is installed on your system.

* **Ubuntu/Debian**: `sudo apt-get install libsndfile1`
* **macOS** (using Homebrew): `brew install libsndfile`
* **Windows**: Download and install the precompiled binaries from the [official website](https://github.com/libsndfile/libsndfile/releases/), extract them and add the folder to path.

## Supported operations, precisions and devices

### V2.4

| **Model** | Acoustic | Acoustic | Acoustic | Geo | Geo |
| --- | --- | --- | --- | --- | --- |
| **Backend** | TFLite/<br>LiteRT | ProtoBuf | ProtoBuf<br>Raven* | TFLite/<br>LiteRT | ProtoBuf |
| `predict(..)` | ✅ | ✅ | ✅ | ✅ | ✅ |
| `encode(..)` | ✅ | ✅ | ❌ | ❌ | ❌ |
| **INT8** | CPU | ❌ | ❌ | ❌ | ❌ |
| **FP16** | CPU | ❌ | ❌ | ❌ | ❌ |
| **FP32** | CPU | CPU/GPU | CPU/GPU | CPU | CPU/GPU |

✅ = Supported ❌ = Not supported\
**ProtoBuf Raven is only available for custom acoustic models.*

### V3.0

The V3.0 acoustic and geo models are both available in four backends (TFLite/LiteRT, ProtoBuf, PyTorch and ONNX). The PyTorch backend requires `birdnet[pt]` and the ONNX backend requires `birdnet[onnx]`.

| **Model** | Acoustic | Acoustic | Acoustic | Acoustic | Geo | Geo | Geo | Geo |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| **Backend** | TFLite/<br>LiteRT | ProtoBuf | PyTorch | ONNX | TFLite/<br>LiteRT | ProtoBuf | PyTorch | ONNX |
| `predict(..)` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| `encode(..)` | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| **INT8** | ❌ | ❌ | ❌ | ❌ | CPU | ❌ | ❌ | ❌ |
| **FP16** | CPU | ❌ | ❌ | CPU/GPU | CPU | ❌ | ❌ | CPU/GPU |
| **FP32** | CPU | CPU/GPU | CPU/GPU | CPU/GPU | CPU | CPU/GPU | CPU/GPU | CPU/GPU |

✅ = Supported ❌ = Not supported

Load a V3.0 model by passing the version and backend, e.g. `birdnet.load("acoustic", "3.0", "onnx")` or `birdnet.load("geo", "3.0", "tf")`.

### Perch V2

| **Model** | Acoustic | Geo |
| --- | --- | --- |
| **Backend** | ProtoBuf | ❌ |
| `predict(..)` | ✅ | ❌ |
| `encode(..)` | ✅ | ❌ |
| **INT8** | ❌ | ❌ |
| **FP16** | ❌ | ❌ |
| **FP32** | CPU/GPU | ❌ |

Note: Perch can **not** be run on Intel macOS systems due to compatibility issues with TensorFlow.

## Example usage

### Identify species within an audio file

```py
import birdnet

model = birdnet.load("acoustic", "2.4", "tf")

predictions = model.predict(
  "example/soundscape.wav",
  # predict only the species from the file
  custom_species_list="example/species_list.txt",
)

predictions.to_csv("example/predictions.csv")
```

The resulting predictions look like this (excerpt, scores may vary):

|input|start_time|end_time|species_name|confidence|
|---|---|---|---|---|
|/home/.../example/soundscape.wav|00:00:00.00|00:00:03.00|Poecile atricapillus_Black-capped Chickadee|0.814|
|/home/.../example/soundscape.wav|00:00:03.00|00:00:06.00|Poecile atricapillus_Black-capped Chickadee|0.3084|
|/home/.../example/soundscape.wav|00:00:06.00|00:00:09.00|Baeolophus bicolor_Tufted Titmouse|0.1864|
|/home/.../example/soundscape.wav|00:00:09.00|00:00:12.00|Haemorhous mexicanus_House Finch|0.6392|
|/home/.../example/soundscape.wav|00:00:18.00|00:00:21.00|Cyanocitta cristata_Blue Jay|0.4353|
|/home/.../example/soundscape.wav|00:00:21.00|00:00:24.00|Cyanocitta cristata_Blue Jay|0.3291|
|/home/.../example/soundscape.wav|00:00:21.00|00:00:24.00|Haemorhous mexicanus_House Finch|0.1866|
|...|...|...|...|...|

For a more detailed prediction you can take a look at [example/predictions.csv](example/predictions.csv).

### Predict species for a given location and time

```py
import birdnet

model = birdnet.load("geo", "2.4", "tf")

predictions = model.predict(42.5, -76.45, week=4)

predictions.to_csv("example/location.csv")
```

The resulting predictions look like this (excerpt, scores may vary; sorted alphabetically):

| species_name                             | confidence |
|------------------------------------------|------------|
| Acanthis flammea_Common Redpoll          | 0.0442     |
| Accipiter cooperii_Cooper's Hawk         | 0.0812     |
| Agelaius phoeniceus_Red-winged Blackbird | 0.0996     |
| Anas platyrhynchos_Mallard               | 0.4468     |
| Anas rubripes_American Black Duck        | 0.11       |
| ...                                      | ...        |

The full result is at [example/location.csv](example/location.csv).

### Location of Log File

If something goes wrong, you can find the log file in the following locations:

* Windows: `C:\Users\{user}\AppData\Local\Temp\birdnet.log`
* Linux/MacOS: `/tmp/birdnet.log`

## File formats

The audio models support all formats compatible with the SoundFile library (see [here](https://python-soundfile.readthedocs.io/en/0.11.0/#read-write-functions)). This includes, but is not limited to, WAV, FLAC, OGG, and AIFF. The flexibility of supported formats ensures that the models can handle a wide variety of audio input types, making them adaptable to different use cases and environments.

* Supported: AIFC, AIFF, AU, AVR, CAF, FLAC, HTK, IRCAM, MAT4, MAT5, MP3, MPC2K, NIST, OGG, OPUS, PAF, PVF, RAW, RF64, SD2, SDS, SVX, VOC, W64, WAV, WAVEX, WVE, XI
* Not supported at the moment: AAC, M4A, WMA

## Model formats and execution details

Depending on the model version, this project provides up to four model formats: Protobuf/Raven, TFLite, PyTorch and ONNX. All formats are designed to have identical precision up to 2 decimal places, with differences only appearing from the third decimal place onward.

* **TFLite Model** (`tf`): Limited to CPU execution only.
* **ProtoBuf Model** (`pb`): Can be executed on both GPU and CPU.
* **PyTorch Model** (`pt`, V3.0 only): Can be executed on both GPU and CPU. Requires `birdnet[pt]`.
* **ONNX Model** (`onnx`, V3.0 only): Can be executed on both GPU and CPU. Requires `birdnet[onnx]`.

Ensure your environment is configured to utilize the appropriate model and available hardware optimally.

## License

* **Source Code**: The source code for this project is licensed under the [MIT License](https://opensource.org/licenses/MIT).
* **Models**: The models used in this project are licensed under the [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0)](https://creativecommons.org/licenses/by-nc-sa/4.0/).

Please ensure you review and adhere to the specific license terms provided with each model. Note that educational and research purposes are considered non-commercial use cases.

## Citation

Feel free to use birdnet for your acoustic analyses and research. If you do, please cite as:

```bibtex
@article{kahl2021birdnet,
  title={BirdNET: A deep learning solution for avian diversity monitoring},
  author={Kahl, Stefan and Wood, Connor M and Eibl, Maximilian and Klinck, Holger},
  journal={Ecological Informatics},
  volume={61},
  pages={101236},
  year={2021},
  publisher={Elsevier}
}
```

## Funding

Our work in the K. Lisa Yang Center for Conservation Bioacoustics is made possible by the generosity of K. Lisa Yang to advance innovative conservation technologies to inspire and inform the conservation of wildlife and habitats.

The development of BirdNET is supported by the German Federal Ministry of Research, Technology and Space (FKZ 01|S22072), the German Federal Ministry for the Environment, Climate Action, Nature Conservation and Nuclear Safety (FKZ 67KI31040E), the German Federal Ministry of Economic Affairs and Energy (FKZ 16KN095550), the Deutsche Bundesstiftung Umwelt (project 39263/01) and the European Social Fund.

## Partners

BirdNET is a joint effort of partners from academia and industry.
Without these partnerships, this project would not have been possible.
Thank you!

![Our partners](https://tuc.cloud/index.php/s/KSdWfX5CnSRpRgQ/download/box_logos.png)
