Skip to main content

A python api for BirdNET-Lite and BirdNET-Analyzer

Project description

birdnetlib

PyPI Python 3.x Test

A python api for BirdNET-Analyzer and BirdNET-Lite

birdnetlib provides a common interface for BirdNET-Analyzer and BirdNET-Lite.

Documentation

Documentation is at https://joeweiss.github.io/birdnetlib.

See Getting Started for a quick introduction.

Installation

birdnetlib requires Python 3.9+ and prior installation of Tensorflow Lite, librosa and ffmpeg. See BirdNET-Analyzer for more details on installing the Tensorflow-related dependencies.

pip install birdnetlib

Basic usage

To use the latest BirdNET-Analyzer model, use the Analyzer class.

from birdnetlib import Recording
from birdnetlib.analyzer import Analyzer
from datetime import datetime

# Load and initialize the BirdNET-Analyzer models.
analyzer = Analyzer()

recording = Recording(
    analyzer,
    "sample.mp3",
    lat=35.4244,
    lon=-120.7463,
    date=datetime(year=2022, month=5, day=10), # use date or week_48
    min_conf=0.25,
)
recording.analyze()
print(recording.detections)

recording.detections contains a list of detected species, along with time ranges and confidence value.

[{'common_name': 'House Finch',
  'confidence': 0.5744,
  'end_time': 12.0,
  'scientific_name': 'Haemorhous mexicanus',
  'start_time': 9.0,
  'label': 'Haemorhous mexicanus_House Finch'},
 {'common_name': 'House Finch',
  'confidence': 0.4496,
  'end_time': 15.0,
  'scientific_name': 'Haemorhous mexicanus',
  'start_time': 12.0,
  'label': 'Haemorhous mexicanus_House Finch'}]

The Recording class takes a file path as an argument. You can also use RecordingFileObject to analyze an in-memory object, or RecordingBuffer for handling an array buffer.

About BirdNET-Lite and BirdNET-Analyzer

birdnetlib uses models provided by BirdNET-Lite and BirdNET-Analyzer under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License.

BirdNET-Lite and BirdNET-Analyzer were developed by the K. Lisa Yang Center for Conservation Bioacoustics at the Cornell Lab of Ornithology.

For more information on BirdNET analyzers, please see the project repositories below:

BirdNET-Analyzer

BirdNET-Lite

birdnetlib is not associated with BirdNET-Lite, BirdNET-Analyzer or the K. Lisa Yang Center for Conservation Bioacoustics.

About birdnetlib

birdnetlib is maintained by Joe Weiss. Contributions are welcome.

Project Goals

  • Establish a unified API for interacting with Tensorflow-based BirdNET analyzers
  • Enable python-based test cases for BirdNET analyzers
  • Make it easier to use BirdNET in python-based projects
  • Make it easier to migrate to new BirdNET versions/models as they become available

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

birdnetlib-0.14.0.tar.gz (61.1 MB view details)

Uploaded Source

Built Distribution

birdnetlib-0.14.0-py3-none-any.whl (61.1 MB view details)

Uploaded Python 3

File details

Details for the file birdnetlib-0.14.0.tar.gz.

File metadata

  • Download URL: birdnetlib-0.14.0.tar.gz
  • Upload date:
  • Size: 61.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for birdnetlib-0.14.0.tar.gz
Algorithm Hash digest
SHA256 f214d8ea88420cb28eb380bca8da13f6b97e76b883212c2947ae7b01c0f02aca
MD5 6f6b9762c848480099f24fefbe0d86af
BLAKE2b-256 f020e12f8c2a6bc426ba5c7a2c7a93c594c5b9ca9bde3f03b3f8400216d3d85d

See more details on using hashes here.

File details

Details for the file birdnetlib-0.14.0-py3-none-any.whl.

File metadata

  • Download URL: birdnetlib-0.14.0-py3-none-any.whl
  • Upload date:
  • Size: 61.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for birdnetlib-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0455b3fd402c3a34cefcb468eaf2cca38c9b256d39a7b9cc1c978a159a6d5827
MD5 81bcc27861412ba894e888dad65810dd
BLAKE2b-256 72890bef40f49a7972b2f6d4eb792f3de6b8f63748abcfcd1c1a9c71a57e6eaf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page