A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

birdnet

The library is geared towards providing a robust workflow for ecological data analysis in bioacoustic projects.
https://github.com/birdnet-team/birdnet

Category: Biosphere
Sub Category: Avian Monitoring and Analysis

Keywords

acoustic-monitoring bioacoustics birds birdsong deep-learning

Last synced: about 23 hours ago
JSON representation

Repository metadata

A Python library for identifying bird species by their sounds.

README.md

birdnet

PyPI
PyPI
MIT

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. Some features might only be available in the BirdNET Analyzer and not in this package.

Please note that the 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.

Installation

# 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

Example usage

Identify species within an audio file

from pathlib import Path

from birdnet import SpeciesPredictions, predict_species_within_audio_file

# predict species within the whole audio file
audio_path = Path("example/soundscape.wav")
predictions = SpeciesPredictions(predict_species_within_audio_file(audio_path))

# get most probable prediction at time interval 0s-3s
prediction, confidence = list(predictions[(0.0, 3.0)].items())[0]
print(f"predicted '{prediction}' with a confidence of {confidence:.2f}")
# output:
# predicted 'Poecile atricapillus_Black-capped Chickadee' with a confidence of 0.81

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

from birdnet import SpeciesPredictions, SpeciesPrediction

predictions = SpeciesPredictions([
  ((0.0, 3.0), SpeciesPrediction([
    ('Poecile atricapillus_Black-capped Chickadee', 0.8140561)
  ])),
  ((3.0, 6.0), SpeciesPrediction([
    ('Poecile atricapillus_Black-capped Chickadee', 0.3082859)
  ])),
  ((6.0, 9.0), SpeciesPrediction([
    ('Baeolophus bicolor_Tufted Titmouse', 0.1864328)
  ])),
  ((9.0, 12.0), SpeciesPrediction([
    ('Haemorhous mexicanus_House Finch', 0.639378)
  ])),
  ((12.0, 15.0), SpeciesPrediction()),
  ((15.0, 18.0), SpeciesPrediction()),
  ((18.0, 21.0), SpeciesPrediction([
    ('Cyanocitta cristata_Blue Jay', 0.4352715),
    ('Clamator coromandus_Chestnut-winged Cuckoo', 0.32258758)
  ])),
  ((21.0, 24.0), SpeciesPrediction([
    ('Cyanocitta cristata_Blue Jay', 0.32908556),
    ('Haemorhous mexicanus_House Finch', 0.18672176)
  ])),
  ...
])

For a more detailed prediction you can take a look at example/example.py.

Predict species for a given location and time

from birdnet import predict_species_at_location_and_time

# predict species
prediction = predict_species_at_location_and_time(42.5, -76.45, week=4)

# get most probable species
first_species, confidence = list(prediction.items())[0]
print(f"predicted '{first_species}' with a confidence of {confidence:.2f}")
# output:
# predicted 'Cyanocitta cristata_Blue Jay' with a confidence of 0.93

Identify species within audio files using multiprocessing

from pathlib import Path

from birdnet import predict_species_within_audio_files_mp

files = (
  Path("example/soundscape.wav"),
  Path("example/soundscape.wav"),
  Path("example/soundscape.wav"),
  Path("example/soundscape.wav"),
)

file_predictions = list(predict_species_within_audio_files_mp(files))

for file, predictions in file_predictions:
  print(file.name, len(predictions), "predictions")
# output:
# soundscape.wav 40 predictions
# soundscape.wav 40 predictions
# soundscape.wav 40 predictions
# soundscape.wav 40 predictions

Benchmark

For a preliminary benchmark, see benchmark/BENCHMARK.md

File formats

The audio models support all formats compatible with the SoundFile library (see here). 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.

Model formats and execution details

This project provides two model formats: Protobuf/Raven and TFLite. Both models are designed to have identical precision up to 2 decimal places, with differences only appearing from the third decimal place onward.

  • Protobuf Model: Accessed via AudioModelV2M4Protobuf()/MetaModelV2M4Protobuf()/CustomAudioModelV2M4Raven(), this model can be executed on both GPU and CPU. By default, the Protobuf model is used, and the system will attempt to run it on the GPU if available.
  • TFLite Model: Accessed via AudioModelV2M4TFLite()/MetaModelV2M4TFLite()/CustomAudioModelV2M4TFLite(), this model is limited to CPU execution only.

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

License

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:

@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

This project is supported by Jake Holshuh (Cornell class of '69) and The Arthur Vining Davis Foundations. 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 Education and Research through the project “BirdNET+” (FKZ 01|S22072). The German Federal Ministry for the Environment, Nature Conservation and Nuclear Safety contributes through the “DeepBirdDetect” project (FKZ 67KI31040E). In addition, the Deutsche Bundesstiftung Umwelt supports BirdNET through the project “RangerSound” (project 39263/01).

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


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 6 days ago

Total Commits: 94
Total Committers: 1
Avg Commits per committer: 94.0
Development Distribution Score (DDS): 0.0

Commits in past year: 94
Committers in past year: 1
Avg Commits per committer in past year: 94.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
Stefan Taubert 2****t 94

Committer domains:


Issue and Pull Request metadata

Last synced: 2 days ago

Total issues: 12
Total pull requests: 0
Average time to close issues: 6 days
Average time to close pull requests: N/A
Total issue authors: 6
Total pull request authors: 0
Average comments per issue: 1.08
Average comments per pull request: 0
Merged pull request: 0
Bot issues: 0
Bot pull requests: 0

Past year issues: 12
Past year pull requests: 0
Past year average time to close issues: 6 days
Past year average time to close pull requests: N/A
Past year issue authors: 6
Past year pull request authors: 0
Past year average comments per issue: 1.08
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/birdnet-team/birdnet

Top Issue Authors

  • fegue (4)
  • m1cha3lya1r (3)
  • phibos (2)
  • stefantaubert (1)
  • elehcimd (1)
  • Mattk70 (1)

Top Pull Request Authors


Top Issue Labels

  • enhancement (1)

Top Pull Request Labels


Package metadata

pypi.org: birdnet

A Python library for identifying bird species by their sounds.

  • Homepage: https://github.com/birdnet-team/birdnet
  • Documentation: https://birdnet.readthedocs.io/
  • Licenses: MIT
  • Latest release: 0.1.7 (published about 1 month ago)
  • Last Synced: 2025-04-26T12:30:57.338Z (2 days ago)
  • Versions: 8
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 1,004 Last month
  • Rankings:
    • Dependent packages count: 10.589%
    • Average: 35.111%
    • Dependent repos count: 59.632%
  • Maintainers (1)

Dependencies

Pipfile pypi
  • autoflake * develop
  • autopep8 * develop
  • birdnet * develop
  • build * develop
  • isort * develop
  • mypy * develop
  • pandas-stubs * develop
  • pycodestyle * develop
  • pylint * develop
  • pytest * develop
  • rope * develop
  • twine * develop
  • types-requests * develop
  • types-tqdm * develop
  • librosa >=0.10.0, <1.0.0
  • numpy >=1.23.5, <2.0.0
  • ordered-set >=4.1.0, <5.0.0
  • resampy >=0.4.3, <1.0.0
  • scipy >=1.9.3, <2.0.0
  • soundfile >=0.12.1, <1.0.0
  • tensorflow ==2.15.1
  • tqdm >=4.64.1, <5.0.0
Pipfile.lock pypi
  • 168 dependencies
pyproject.toml pypi
  • librosa >=0.10.0, <1.0.0
  • numpy >=1.23.5, <2.0.0
  • ordered-set >=4.1.0, <5.0.0
  • resampy >=0.4.3, <1.0.0
  • scipy >=1.9.3, <2.0.0
  • soundfile >=0.12.1, <1.0.0
  • tensorflow ==2.15.1
  • tqdm >=4.64.1, <5.0.0

Score: 10.131618645361376