This is a wrapper for the birdnet
Python package for automated bird sound ID available here.
birdnetR 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 birdnetR is under active development, so you might encounter changes that could affect your current workflow. We recommend checking for updates regularly.
For more information, please visit the birdnetR website.
Citation
Feel free to use birdnetR for your acoustic analyses and research. If you do, please cite as:
License
- Source Code: The source code for this project is licensed under the MIT License.
- 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).
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.
Setup
First, install the reticulate
package if you haven’t already:
install.packages("reticulate")
For now, you have to install the package from GitHub.
To install the package directly from GitHub, you need to have the devtools package installed. If you don’t have devtools installed, you can install it using:
install.packages("devtools")
Then, you can install birdnetR from GitHub:
devtools::install_github("birdnet-team/birdnetR")
Next, install birdnet
, which will set up a Python virtual environment named r-birdnet
by default. You can configure this with the envname parameter. Do this only once during the initial setup or if you encounter issues with the environment.
Example use
Here’s a simple example of how to use this package to predict bird species from an audio file:
# Load the package
library(birdnetR)
# Initialize a BirdNET model
model <- birdnet_model_tflite()
# Path to the audio file (replace with your own file path)
audio_path <- system.file("extdata", "soundscape.wav", package = "birdnetR")
# Predict species within the audio file
predictions <- predict_species_from_audio_file(model, audio_path)
# Get most probable prediction within each time interval
get_top_prediction(predictions)
Developer Guide
Cloning the Repository
To contribute to the development of birdnetR, you can clone the repository from GitHub:
Setting Up the Development Environment
Install R Package Dependencies
Ensure you have all the necessary R package dependencies:
install.packages(c("devtools", "roxygen2", "testthat", "reticulate"))
Setting Up the Python Environment
Set up a Python virtual environment and install the birdnet
Python package as described above.
Generating Documentation
To generate the documentation, use the roxygen2 package:
devtools::document()
Running Tests
To run the tests, use the testthat package:
devtools::test()
Building and checking the Package
To build and check the package, use the devtools package:
devtools::build()
devtools::check()
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 German Federal Ministry of Education and Research is funding the development of BirdNET through the project “BirdNET+” (FKZ 01|S22072). Additionally, the German Federal Ministry of Environment, Nature Conservation and Nuclear Safety is funding the development of BirdNET through the project “DeepBirdDetect” (FKZ 67KI31040E).