Code Monkey home page Code Monkey logo

birdnet-analyzer's Introduction

BirdNET-Analyzer

Automated scientific audio data processing and bird ID.

CC BY-NC-SA 4.0 Supported OS Number of species Downloads

Email Twitter Follow Subreddit subscribers

Introduction

This repo contains BirdNET models and scripts for processing large amounts of audio data or single audio files. This is the most advanced version of BirdNET for acoustic analyses and we will keep this repository up-to-date with new models and improved interfaces to enable scientists with no CS background to run the analysis.

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}
}

About

Go to https://birdnet.cornell.edu to learn more about the project.

Want to use BirdNET to analyze a large dataset? Don’t hesitate to contact us: [email protected]

Follow us on Twitter @BirdNET_App

We also have a discussion forum on Reddit if you have a general question or just want to chat.

Have a question, remark, or feature request? Please start a new issue thread to let us know. Feel free to submit a pull request.

Contents

1. Model version update

V2.4, June 2023

  • more than 6,000 species worldwide

  • covers frequencies from 0 Hz to 15 kHz with two-channel spectrogram (one for low and one for high frequencies)

  • 0.826 GFLOPs, 50.5 MB as FP32

  • enhanced and optimized metadata model

  • global selection of species (birds and non-birds) with 6,522 classes (incl. 10 non-event classes)

You can find a list of previous versions here: BirdNET-Analyzer Model Version History

Species range model V2.4 - V2, Jan 2024

  • updated species range model based on eBird data

  • more accurate (spatial) species range prediction

  • slightly increased long-tail distribution in the temporal resolution

  • see this discussion post for more details

2. Technical Details

Model V2.4 uses the following settings:

  • 48 kHz sampling rate (we up- and downsample automatically and can deal with artifacts from lower sampling rates)

  • we compute 2 mel spectrograms as input for the convolutional neural network:

    • first one has fmin = 0 Hz and fmax = 3000; nfft = 2048; hop size = 278; 96 mel bins

    • second one has fmin = 500 Hz and fmax = 15 kHz; nfft = 1024; hop size = 280; 96 mel bins

  • both spectrograms have a final resolution of 96x511 pixels

  • raw audio will be normalized between -1 and 1 before spectrogram conversion

  • we use non-linear magnitude scaling as mentioned in Schlüter 2018

  • V2.4 uses an EfficienNetB0-like backbone with a final embedding size of 1024

  • See this comment for more details

3. Usage guide

This document provides instructions for downloading and installing the GUI, and conducting some of the most common types of analyses. Within the document, a link is provided to download example sound files that can be used for practice.

Download the PDF here: BirdNET-Analyzer Usage Guide

Watch our presentation on how to use BirdNET-Analyzer to train your own models: BirdNET - BioacousTalks at YouTube

4. Showroom

BirdNET powers a number of fantastic community projects dedicated to bird song identification, all of which use models from this repository. These are some highlights, make sure to check them out!

Table 1. Community projects
Project Description

HaikuBox

HaikuBox
Once connected to your WiFi, Haikubox will listen for birds 24/7. When BirdNET finds a match between its thousands of labeled sounds and the birdsong in your yard, it identifies the bird species and shares a three-second audio clip to the Haikubox website and smartphone app.

Learn more at: HaikuBox.com

BirdNET-PI

BirdNET-Pi
Built on the TFLite version of BirdNET, this project uses pre-built TFLite binaries for Raspberry Pi to run on-device sound analyses. It is able to recognize bird sounds from a USB sound card in realtime and share its data with the rest of the world.

Learn more at: BirdNETPi.com

BirdWeather

BirdWeather
This site was built to be a living library of bird vocalizations. Using the BirdNET artificial neural network, BirdWeather is continuously listening to over 1,000 active stations around the world in real-time.

Learn more at: BirdWeather.com

ecoPI:Bird

ecoPi:Bird
The ecoPi:Bird is a device for automated acoustic recordings of bird songs and calls, with a self-sufficient power supply. It facilitates economical long-term monitoring, implemented with minimal personal requirements.

Learn more at: oekofor.netlify.app

Chirpity

Chirpity
Discover the wonders of bird identification with Chirpity, a desktop application powered by cutting-edge Machine Learning. With the option to choose between BirdNET or the native Chirpity model, finely tuned for Nocturnal Flight Calls, you have the flexibility to tailor your analysis to your specific needs. Perfect for enthusiasts and researchers alike, Chirpity is particularly well-suited for Nocmig and other extensive field recordings. Chirpity is available on both Windows and Mac platforms.

Learn more at: chirpity.mattkirkland.co.uk

Go-BirdNET

Go-BirdNET
Go-BirdNET is an application inspired by BirdNET-Analyzer. While the original BirdNET is based on Python, Go-BirdNET is built using Golang, aiming for simplified deployment across multiple platforms, from Windows PCs to single board computers like Raspberry Pi.

Learn more at: github.com/tphakala/go-birdnet

whoBIRD

whoBIRD
whoBIRD empowers you to identify birds anywhere, anytime, without an internet connection. Built upon the TFLite version of BirdNET, this Android application harnesses the power of machine learning to recognize birds directly on your device.

Learn more at: whoBIRD

Other cool projects:

Working on a cool project that uses BirdNET? Let us know and we can feature your project here.

5. Projects map

We have created an interactive map of projects that use BirdNET. If you are working on a project that uses BirdNET, please let us know here and we can add it to the map.

You can access the map here: Open projects map

6. Setup

6.1. Setup (Raven Pro)

If you want to analyze audio files without any additional coding or package install, you can now use Raven Pro software to run BirdNET models. After download, BirdNET is available through the new "Learning detector" feature in Raven Pro. For more information on how to use this feature, please visit the Raven Pro Knowledge Base.

Download the newest model version here, extract the zip-file and move the extracted folder to the Raven models folder. On Windows, the models folder is C:\Users\<Your user name>\Raven Pro 1.6\Models. Start Raven Pro and select BirdNET_GLOBAL_6K_V2.4_Model_Raven as learning detector.

6.2. Setup (birdnetlib)

The easiest way to setup BirdNET on your machine is to install birdnetlib through pip with:

pip3 install birdnetlib

Make sure to install Tensorflow Lite, librosa and ffmpeg like mentioned below. You can run BirdNET with:

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)

For more examples and documentation, make sure to visit pypi.org/project/birdnetlib/. For any feature request or questions regarding birdnetlib, please contact Joe Weiss or add an issue or PR at github.com/joeweiss/birdnetlib.

6.3. Setup (Ubuntu)

Install Python 3:

sudo apt-get update
sudo apt-get install python3-dev python3-pip
pip3 install --upgrade pip

Install TFLite runtime (recommended) or Tensorflow (has to be 2.15):

pip3 install tflite-runtime

OR

pip3 install tensorflow==2.15.0

Install Librosa to handle audio files:

pip3 install librosa resampy
sudo apt-get install ffmpeg

Clone the repository

git clone https://github.com/kahst/BirdNET-Analyzer.git
cd BirdNET-Analyzer

6.4. Setup (Windows)

Before you attempt to setup BirdNET-Analyzer on your Windows machine, please consider downloading our fully-packaged version that does not require you to install any additional packages and can be run "as-is".

You can download this version here: BirdNET-Analyzer Windows

  1. Download the BirdNET-Analyzer-setup.exe file

  2. Before installing, make sure to right-click the exe-file, select "Properties" and check the box "Unblock" under "Security" at the bottom of the "General" tab.

    • If Windows does not display this option, the file can be unblocked with the PowerShell 7 command Unblock-File -Path .\BirdNET-Analyzer.zip

  3. During installation, you may see a warning "Windows protected your PC" due to the lack of a digital signature. Simply select "More info" and then "Run anyway" to proceed with the installation.

  4. Follow the on-screen instructions

  5. After installation, click the desktop icon or navigate to the extracted folder at C:\Users\<Your user name>\AppData\Local\Programs\BirdNET-Analyzer

  6. You can start the analysis through the command prompt with BirdNET-Analyzer.exe --i "path\to\folder" ... (see Usage (CLI) section for more details), or you can launch BirdNET-Analyzer-GUI.exe to start the analysis through a basic GUI.

For more advanced use cases (e.g., hosting your own API server), follow these steps to set up BirdNET-Analyzer on your Windows machine:

Install Python 3.9 or higher (has to be 64bit version)

⚠️
Make sure to check: ☑ "Add path to environment variables" during install

Install Tensorflow (has to be 2.5 or later), Librosa and NumPy

  • Open command prompt with Win + S type "command" and click on "Command Prompt"

  • Type pip install --upgrade pip

  • Type pip install librosa resampy

  • Install Tensorflow by typing pip install tensorflow

ℹ️
You might need to run the command prompt as "administrator". Type Win + S, search for command prompt and then right-click, select "Run as administrator".

Install Visual Studio Code (optional)

Install BirdNET using Git (for simple download see below)

  • Download and install Git Bash: Download Git Bash installer

  • Select Visual Studio Code as default editor (optional)

  • Keep all other settings as recommended

  • Create folder in personal directory called "Code" (or similar)

  • Change to folder and right click, launch "Git bash here"

  • Type git clone https://github.com/kahst/BirdNET-Analyzer.git

  • Keep BirdNET updated by running git pull for BirdNET-Analyzer folder occasionally

Install BirdNET from zip

  • Download BirdNET: Download BirdNET Zip-file

  • Unpack zip file (e.g., in personal directory)

  • Keep BirdNET updated by re-downloading the zip file occasionally and overwrite existing files

Run BirdNET from command line

  • Open command prompt with Win + S type "command" and click on "Command Prompt"

  • Navigate to the folder where you installed BirdNET (cd path\to\BirdNET-Analyzer)

  • See Usage (CLI) section for command line arguments

ℹ️
With Visual Studio Code installed, you can right-click the BirdNET-Analyzer folder and select "Open with Code". With proper extensions installed (View → Extensions → Python) you will be able to run all scripts from within VS Code.

6.5. Setup (macOS)

ℹ️
Installation was only tested on M1 and M2 chips. Feedback on older Intel CPUs or newer M3 chips is welcome!

Requirements

You need to install the Xcode command-line tools:

xcode-select --install

Clone the git repository into your prefered folder if you have not done that yet:

cd ~/YOUR_FOLDER
git clone https://github.com/kahst/BirdNET-Analyzer.git
cd BirdNET-Analyzer

Setup the environment

We are going to create a virtual environment to install the required packages. Virtual environments allow you to manage separate package installations for different projects.

python3 -m venv venv-birdnet
source venv-birdnet/bin/activate
python -m pip install -U pip

The nexttime you want to use BirdNET, go to the BirdNET-Analyzer folder and run source venv-birdnet/bin/activate to activate the virtual environment.

Install dependencies

TensorFlow for macOS and Metal plug-in:

python -m pip install tensorflow==2.15.0 tensorflow-metal

Librosa and ffmpeg:

python -m pip install librosa resampy

Verify

Run the example. It will take a while the first time you run it. Subsequent runs will be faster.

python analyze.py
ℹ️
Now, you can install and use birdnetlib.

7. Usage

7.1. Usage (CLI)

  1. Inspect config file for options and settings, especially inference settings. Specify a custom species list if needed and adjust the number of threads TFLite can use to run the inference.

  2. Run analyzer.py to analyze an audio file. You need to set paths for the audio file and selection table output. Here is an example:

    python3 analyze.py --i /path/to/audio/folder --o /path/to/output/folder
    ℹ️
    Your custom species list has to be named 'species_list.txt' and the folder containing the list needs to be specified with --slist /path/to/folder. You can also specify the number of CPU threads that should be used for the analysis with --threads <Integer> (e.g., --threads 16). If you provide GPS coordinates with --lat and --lon, the custom species list argument will be ignored.

    Here’s a complete list of all command line arguments:

    --i, Path to input file or folder. If this is a file, --o needs to be a file too.
    --o, Path to output file or folder. If this is a file, --i needs to be a file too.
    --lat, Recording location latitude. Set -1 to ignore.
    --lon, Recording location longitude. Set -1 to ignore.
    --week, Week of the year when the recording was made. Values in [1, 48] (4 weeks per month). Set -1 for year-round species list.
    --slist, Path to species list file or folder. If folder is provided, species list needs to be named "species_list.txt". If lat and lon are provided, this list will be ignored.
    --sensitivity, Detection sensitivity; Higher values result in higher sensitivity. Values in [0.5, 1.5]. Defaults to 1.0.
    --min_conf, Minimum confidence threshold. Values in [0.01, 0.99]. Defaults to 0.1.
    --overlap, Overlap of prediction segments. Values in [0.0, 2.9]. Defaults to 0.0.
    --rtype, Specifies output format. Values in ['table', 'audacity', 'r', 'kaleidoscope', 'csv']. Defaults to 'table' (Raven selection table).
    --threads, Number of CPU threads.
    --batchsize, Number of samples to process at the same time. Defaults to 1.
    --locale, Locale for translated species common names. Values in ['af', 'de', 'it', ...] Defaults to 'en'.
    --sf_thresh, Minimum species occurrence frequency threshold for location filter. Values in [0.01, 0.99]. Defaults to 0.03.
    --classifier, Path to custom trained classifier. Defaults to None. If set, --lat, --lon and --locale are ignored.
    --fmin and --fmax, Minimum and maximum frequency for bandpass filter. Defaults to 0 and 15000.
    --output_file, Path to combined Raven selection table. If set and rtype is 'table', all results will be combined into this file. Defaults to None.
    --skip_existing_results, skip files that have already been analyzed. Defaults to False.

    Here are two example commands to run this BirdNET version:

    python3 analyze.py --i example/ --o example/ --slist example/ --min_conf 0.5 --threads 4
    
    python3 analyze.py --i example/ --o example/ --lat 42.5 --lon -76.45 --week 4 --sensitivity 1.0
  3. Run embeddings.py to extract feature embeddings instead of class predictions. Result file will contain timestamps and lists of float values representing the embedding for a particular 3-second segment. Embeddings can be used for clustering or similarity analysis. Here is an example:

    python3 embeddings.py --i example/ --o example/ --threads 4 --batchsize 16

    Here’s a complete list of all command line arguments:

    --i, Path to input file or folder. If this is a file, --o needs to be a file too.
    --o, Path to output file or folder. If this is a file, --i needs to be a file too.
    --overlap, Overlap of prediction segments. Values in [0.0, 2.9]. Defaults to 0.0.
    --threads, Number of CPU threads.
    --batchsize, Number of samples to process at the same time. Defaults to 1.
    --fmin and --fmax, Minimum and maximum frequency for bandpass filter. Defaults to 0 and 15000.
  4. After the analysis, run segments.py to extract short audio segments for species detections to verify results. This way, it might be easier to review results instead of loading hundreds of result files manually.

    Here’s a complete list of all command line arguments:

    --audio, Path to folder containing audio files.
    --results, Path to folder containing result files.
    --o, Output folder path for extracted segments.
    --min_conf, Minimum confidence threshold. Values in [0.01, 0.99]. Defaults to 0.1.
    --max_segments, Number of randomly extracted segments per species.
    --seg_length, Length of extracted segments in seconds. Defaults to 3.0.
    --threads, Number of CPU threads.
  5. When editing your own species_list.txt file, make sure to copy species names from the labels file of each model.

    You can find label files in the checkpoints folder, e.g., checkpoints/V2.3/BirdNET_GLOBAL_3K_V2.3_Labels.txt.

    Species names need to consist of scientific name_common name to be valid.

  6. You can generate a species list for a given location using species.py in case you need it for reference. Here is an example:

    python3 species.py --o example/species_list.txt --lat 42.5 --lon -76.45 --week 4

    Here’s a complete list of all command line arguments:

    --o, Path to output file or folder. If this is a folder, file will be named 'species_list.txt'.
    --lat, Recording location latitude.
    --lon, Recording location longitude.
    --week, Week of the year when the recording was made. Values in [1, 48] (4 weeks per month). Set -1 for year-round species list.
    --threshold, Occurrence frequency threshold. Defaults to 0.03.
    --sortby, Sort species by occurrence frequency or alphabetically. Values in ['freq', 'alpha']. Defaults to 'freq'.

    The year-round list may contain some species, that are not included in any list for a specific week. See #211 for more details.

  7. This is a very basic version of the analysis workflow, you might need to adjust it to your own needs.

  8. Please open an issue to ask for new features or to document unexpected behavior.

  9. I will keep models up to date and upload new checkpoints whenever there is an improvement in performance. I will also provide quantized and pruned model files for distribution.

7.2. Usage (Docker)

Install docker for Ubuntu:

sudo apt install docker.io

Build Docker container:

sudo docker build -t birdnet .
ℹ️
You need to run docker build again whenever you make changes to the script.

In order to pass a directory that contains your audio files to the docker file, you need to mount it inside the docker container with -v /my/path:/mount/path before you can run the container.

You can run the container for the provided example soundscapes with:

sudo docker run -v $PWD/example:/audio birdnet analyze.py --i audio --o audio --slist audio

You can adjust the directory that contains your recordings by providing an absolute path:

sudo docker run -v /path/to/your/audio/files:/audio birdnet analyze.py --i audio --o audio --slist audio

You can also mount more than one drive, e.g., if input and output folder should be different:

sudo docker run -v /path/to/your/audio/files:/input -v /path/to/your/output/folder:/output birdnet analyze.py --i input --o output --slist input

See Usage (CLI) section above for more command line arguments, all of them will work with Docker version.

ℹ️
If you like to specify a species list (which will be used as post-filter and needs to be named 'species_list.txt'), you need to put it into a folder that also has to be mounted.

7.3. Usage (Server)

You can host your own analysis service and API by launching the server.py script. This will allow you to send files to this server, store submitted files, analyze them and send detection results back to a client. This could be a local service, running on a desktop PC, or a remote server. The API can be accessed locally or remotely through a browser or Python client (or any other client implementation).

  1. Install one additional package with pip3 install bottle.

  2. Start the server with python3 server.py. You can also specify a host name or IP and port number, e.g., python3 server.py --host localhost --port 8080.

    Here’s a complete list of all command line arguments:

    --host, Host name or IP address of API endpoint server. Defaults to '0.0.0.0'.
    --port, Port of API endpoint server. Defaults to 8080.
    --spath, Path to folder where uploaded files should be stored. Defaults to '/uploads'.
    --threads, Number of CPU threads for analysis. Defaults to 4.
    --locale, Locale for translated species common names. Values in ['af', 'de', 'it', ...] Defaults to 'en'.
    ℹ️
    The server is single-threaded, so you’ll need to start multiple instances for higher throughput. This service is intented for short audio files (e.g., 1-10 seconds).
  3. Query the API with a client. You can use the provided Python client or any other client implementation. Request payload needs to be multipart/form-data with the following fields: audio for raw audio data as byte code, and meta for additional information on the audio file. Take a look at our example client implementation in the client.py script.

    This script will read an audio file, generate metadata from command line arguments and send it to the server. The server will then analyze the audio file and send back the detection results which will be stored as a JSON file.

    Here’s a complete list of all command line arguments:

    --host, Host name or IP address of API endpoint server.
    --port, Port of API endpoint server.
    --i, Path to file that should be analyzed.
    --o, Path to result file. Leave blank to store with audio file.
    --lat, Recording location latitude. Set -1 to ignore.
    --lon, Recording location longitude. Set -1 to ignore.
    --week, Week of the year when the recording was made. Values in [1, 48] (4 weeks per month). Set -1 for year-round species list.
    --overlap, Overlap of prediction segments. Values in [0.0, 2.9]. Defaults to 0.0.
    --sensitivity, Detection sensitivity; Higher values result in higher sensitivity. Values in [0.5, 1.5]. Defaults to 1.0.
    --pmode, Score pooling mode. Values in ['avg', 'max']. Defaults to 'avg'.
    --num_results, Number of results per request.
    --sf_thresh, Minimum species occurrence frequency threshold for location filter. Values in [0.01, 0.99]. Defaults to 0.03.
    --save, Define if files should be stored on server. Values in [True, False]. Defaults to False.
  4. Parse results from the server. The server will send back a JSON response with the detection results. The response also contains a msg field, indicating success or error. Results consist of a sorted list of (species, score) tuples.

    This is an example response:

    {"msg": "success", "results": [["Poecile atricapillus_Black-capped Chickadee", 0.7889], ["Spinus tristis_American Goldfinch", 0.5028], ["Junco hyemalis_Dark-eyed Junco", 0.4943], ["Baeolophus bicolor_Tufted Titmouse", 0.4345], ["Haemorhous mexicanus_House Finch", 0.2301]]}
    ℹ️
    Let us know if you have any questions, suggestions, or feature requests. Also let us know when hosting an analysis service - we would love to give it a try.

7.4. Usage (GUI)

We provide a very basic GUI which lets you launch the analysis through a web interface.

GUI screenshot
Figure 1. Web based GUI
  1. You need to install two additional packages in order to use the GUI with pip3 install pywebview gradio

  2. Launch the GUI with python3 gui.py.

  3. Set all folders and parameters, after that, click 'Analyze'.

8. Training

You can train your own custom classifier on top of BirdNET. This is useful if you want to detect species that are not included in the default species list. You can also use this to train a classifier for a specific location or season. All you need is a dataset of labeled audio files, organized in folders by species (we use folder names as labels). This also works for non-bird species, as long as you have a dataset of labeled audio files. Audio files will be resampled to 48 kHz and converted into 3-second segments (we will use the center 3-second segment if the file is longer, we will pad with random noise if the file is shorter). We recommend using at least 100 audio files per species (although training also works with less data). You can download a sample training data set here.

  1. Collect training data and organize in folders based on species names.

  2. Species labels should be in the format <scientific name>_<species common name> (e.g., Poecile atricapillus_Black-capped Chickadee), but other formats work as well.

  3. It can be helpful to include a non-event class. If you name a folder 'Noise', 'Background', 'Other' or 'Silence', it will be treated as a non-event class.

  4. Run the training script with python3 train.py --i <path to training data folder> --o <path to trained classifier model output>.

    Here is a list of all command line arguments:

    --i, Path to training data folder. Subfolder names are used as labels.
    --o, Path to trained classifier model output.
    --crop_mode, Crop mode for training data. Values in ['center', 'first', 'segments']. Defaults to 'center'.
    --crop_overlap, Overlap of training data segments in seconds if crop_mode is 'segments'. Defaults to 0.
    --epochs, Number of training epochs. Defaults to 50.
    --batch_size, Batch size. Defaults to 32.
    --val_split, Validation split ratio. Defaults to 0.2.
    --learning_rate, Learning rate. Defaults to 0.001.
    --hidden_units, Number of hidden units. Defaults to 0. If set to >0, a two-layer classifier is used.
    --dropout, Dropout rate. Defaults to 0.
    --mixup, Whether to use mixup for training.
    --upsampling_ratio, Balance train data and upsample minority classes. Values between 0 and 1. Defaults to 0.
    --upsampling_mode, Upsampling mode. Can be 'repeat', 'mean' or 'smote'. Defaults to 'repeat'.
    --model_format, Model output format. Can be 'tflite', 'raven' or 'both'. Defaults to 'tflite'.
    --model_save_mode, Model save mode. Can be 'replace' or 'append'. Defaults to 'replace'.
    --cache_mode, Cache mode. Can be 'none', 'load' or 'save'. Defaults to 'none'.
    --cache_file, Path to cache file. Defaults to 'train_cache.npz'.
    --threads, Number of CPU threads.
    --fmin and --fmax, Minimum and maximum frequency for bandpass filter. Defaults to 0 and 15000.
    --autotune, Whether to use automatic hyperparameter tuning (this will execute multiple training runs to search for optimal hyperparameters).
    --autotune_trials, Number of training runs for hyperparameter tuning. Defaults to 50.
    --autotune_executions_per_trial, The number of times a training run with a set of hyperparameters is repeated. Defaults to 1.
  5. After training, you can use the custom trained classifier with the --classifier argument of the analyze.py script. If you want to use the custom classifier in Raven, make sure to set --model_format raven.

    ℹ️
    Adjusting hyperparameters (e.g., number of hidden units, learning rate, etc.) can have a big impact on the performance of the classifier. We recommend trying different hyperparameter settings. If you want to automate this process, you can use the --autotune argument (in that case, make sure to install keras_tuner with pip3 install keras-tuner).

    Example usage (when downloading and unzipping the sample training data set):

    python3 train.py --i train_data/ --o checkpoints/custom/Custom_Classifier.tflite
    python3 analyze.py --classifier checkpoints/custom/Custom_Classifier.tflite
    ℹ️
    Setting a custom classifier will also set the new labels file. Due to these custom labels, the location filter and locale will be disabled.
  6. You can include negative samples for classes by prefixing the folder names with a '-' (e.g., -Poecile atricapillus_Black-capped Chickadee). Do this with samples that definitely do not contain the species. Negative samples will only be used for training and not for validation. Also keep in mind that negative samples will only be used when a corresponding folder with positive samples exists.

  7. To train with multi-label data separate the class labels with commas in the folder names (e.g., Poecile atricapillus_Black-capped Chickadee, Cardinalis cardinalis_Northern Cardinal). This can also be combined with negative samples as described above. The validation split will be performed combination of classes, so you might want to ensure sufficient data for each combination of classes. When using multi-label data the upsampling mode will be limited to 'repeat'.

9. 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).

10. Partners

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

Logos of all partners
Figure 2. Our partners

birdnet-analyzer's People

Contributors

afairbairn avatar bartman081523 avatar emoritzx avatar fegue avatar haroldmills avatar jimmyknowles avatar josef-haupt avatar joshctaylor avatar jrcoding avatar kahst avatar limitlessgreen avatar mattk70 avatar max-mauermann avatar mcguirepr89 avatar mikkohei13 avatar mzakharo avatar olipayne avatar prayagnshah avatar tgruetzm avatar tommy4st avatar wiliamsouza avatar woheller69 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

birdnet-analyzer's Issues

Question: what dataset is used to train the current BirdNET model?

Hello BirdNET team.
I am a contributor of eBird and use your tool a lot!I wonder if the sound recordings uploaded to eBird (i.e. to Macaulay library) are part of your dataset used - or, if I upload recordings, am I technically helping the improvement of this tool? If so, does the high-quality recordings help more or low-quality ones are equally important?

Output file time fields are missing trailing numbers?

Using either dockerized or Windows version of BirdNet, and saving output in CSV format, the "Start (s)" and "End (s)" fields seems to sometimes miss trailing zero (or other number?)

Example, rows 2, 16 and 17:

1018.0,1021.0,Buteo lineatus,Red-shouldered Hawk,0.1006
102.0,105.0,Turdus viscivorus,Mistle Thrush,0.2857
1020.0,1023.0,Turdus merula,Eurasian Blackbird,0.1264
1020.0,1023.0,Fulica atra,Eurasian Coot,0.1195
1022.0,1025.0,Fulica atra,Eurasian Coot,0.5702
1026.0,1029.0,Drepanis coccinea,Iiwi,0.1028
1030.0,1033.0,Dog,Dog,0.1531
1030.0,1033.0,Turdus viscivorus,Mistle Thrush,0.1335
1030.0,1033.0,Corvus corax,Common Raven,0.1332
1032.0,1035.0,Anas crecca,Green-winged Teal,0.3920
1032.0,1035.0,Anser anser,Graylag Goose,0.1338
1034.0,1037.0,Anas crecca,Green-winged Teal,0.1263
1036.0,1039.0,Turdus merula,Eurasian Blackbird,0.4798
1038.0,1041.0,Anser anser,Graylag Goose,0.4178
1038.0,1041.0,Cygnus cygnus,Whooper Swan,0.1124
104.0,107.0,Turdus migratorius,American Robin,0.2337
104.0,107.0,Turdus philomelos,Song Thrush,0.1144
1040.0,1043.0,Anser anser,Graylag Goose,0.2485
1040.0,1043.0,Cygnus cygnus,Whooper Swan,0.1544

Problematic fields seem to systematically have larger value on the end field than the following row: e.g. on row 2 end value should maybe be 1050.0, which is larger than the end value 1023.0 on row 3.

Occasionally the time value is even shorter, like on row 2 here:

1198.0,1201.0,Anser anser,Graylag Goose,0.8534
12.0,15.0,Haemorhous mexicanus,House Finch,0.1176
1200.0,1203.0,Anser anser,Graylag Goose,0.9340

Limit Results

Is it possible to filter out results that we below a threshold?

{
    "msg": "success",
    "results": [
        [
            "Pluvialis apricaria_European Golden-Plover",
            0.014033333333333335
        ],
        [
            "Columba livia_Rock Pigeon",
            0.0045
        ],
        [
            "Pyrrhula pyrrhula_Eurasian Bullfinch",
            0.0015666666666666667
        ],
        [
            "Branta canadensis_Canada Goose",
            0.0009999999999999998
        ],
        [
            "Parus major_Great Tit",
            0.0008333333333333334
        ]
    ]
}

Only return results above 0.01?

Can't see results file when using Docker

Hello,

I am trying to use Docker to analyze my files but I cannot access or see the results file from the analysis. Below is an example script:

docker run -v /Users/obs/BirdNET-Analyzer:/audio birdnet --i 20210627_120000.WAV --o /Users/obs/BirdNET-Analyzer/docker_test.csv --lat 35.06184 --lon -97.193914

Is BirdNET saving the results file in the container? If so how do I access it?

Thanks and kind regards,

Meelyn Pandit

analyzing mp3 detects file, but triggers "cannot open audio file"

Have 1h WAV recordings which are about 1.3GB.
analyze.py works fine

this code in python works fine to convert the WAV into mp3 reducing from 1.3GB to 28mb:
from pydub import AudioSegment
AudioSegment.converter = "C:\\Program Files\\ffmpeg\\bin\\ffmpeg.exe"
AudioSegment.from_wav("C:\\temp\\birdanalyzer\\file.WAV").export("C:/temp/birdanalyzer/test_mp3/file.mp3", format="mp3")

but running
python3 analyze.py --i C:\temp\birdanalyzer\test_mp3\ --o C:\temp\birdanalyzer\test_mp3\results\

outputs:
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Found 1 files to analyze
Analyzing C:\temp\birdanalyzer\test_mp3\file.mp3
Error: Cannot open audio file C:\temp\birdanalyzer\test_mp3\file.mp3

I can open the mp3 in Audacity and seems fine.
Any clue why the script "cannot open audio file"?

Where are BirdNET observation sound snippets saved on an iPhone?

I'm relaying this question from someone else at the Bioacoustics Stack Exchange (currently in beta):
https://bioacoustics.stackexchange.com/questions/114/where-are-birdnet-saved-observation-sound-snippets-saved-on-an-iphone

"I've recorded some sounds using the app BirdNET (https://birdnet.cornell.edu/) and would like to share/export some of the recorded observations I made and saved. I cannot find them within my iPhone's folder structure. Is anyone familiar with where these are saved by default or how to extract them?"

Stefan or others, if there's a better place to ask this question about the phone apps, please let me know!

Questions: About the parameters overlap and sensitive

Hi BirdNET team,

Thank you so much for your work. I am new to BirdNET, and I am wondering how the parameters "overlap" and "sensitive" affect the results. I tried different "overlap" and got different results. Is the "overlap" means the minimum time interval between to detected species? And about the "sensitive," what is the interaction between "sensitive" and confidence in the result?

Thank you in advance!

Liufeng

Use "old" 6K model?

Hi @kahst

Thanks for including me on your private group. I have flawlessly installed the Analyzer main version on Windows and Pi and both work well with "example" scripts on both systems.

I have been "dabbling" with BirdNET & BirdNET-Lite & then got involved with @mcguirepr89 on BirdNET-Pi & learnt a lot about bash, sql, caddy........ I am his "Python coder", learning the language as I go, so don't blame him for my naïve & messy approach in this area!!

Being in the Southern Hemisphere (South Africa), the 1K and 3K model lists have smaller sample of possible species (about 18% and 29% of the official 865 possible species, and they are predominantly migrants) than the old BirdNET-Lite (62% of possible species), which identified well (few false negatives and easily identified false positives) for my "backyard birder" installation.

I have managed to get the old BirdNET-Lite 6K tflite model to run "bare" in Analyzer (no location, week etc data), but I think I need a MDATA tflite model to hone it for location/week etc? Would it be a big task to generate this?

I'm going to be helping Patrick on upgrading the BirdNET-Pi system to "Analyze", and would like it to test in as best an environment as possible.

Best regards
Dennis

UK species list does not work on run.bat

Hi there,

if i run the run.bat file with the uk species list i get this error

"""D:\BirdNET-Analyzer>BirdNET-Analyzer.exe --i "E:\site_1_orange\s1june10pm.WAV" --o _soundfile_data_s1june10am --slist labels\V2.1\BirdNET_GLOBAL_2K_V2.1_Labels_uk.txt

Traceback (most recent call last):

File "analyze.py", line 389, in

File "analyze.py", line 65, in loadSpeciesList

File "encodings\cp1252.py", line 23, in decode

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 582: character maps to

[13944] Failed to execute script 'analyze' due to unhandled exception!

D:\BirdNET-Analyzer>pause

Press any key to continue . . .""""

It's very odd as the other species lists work fine and they only seem to be txt files with very little to no difference.

Curious about the differences between current BirdNET-Analyzer 2.1 vs. the BirdNET-Lite model

Hi there BirdNET team! I have been working to encapsulate the BirdNET-Lite model which can make predictions for ~6000 species around the world to test out its efficacy in automatically segmenting binary bird labels from large datasets. I just saw the deprecation notice on BirdNET-Lite today and was curious what the main differences between the current Analyzer model 2.1 with ~2500 species. I looked over the model version history, but didn't see any reference to the BirdNET-Lite model.

A quick follow-up question, is there any variation in the vector space for the model inputs? For my use-case, it would be nice to compare these models, assuming that it is as simple as modifying the path to the respective model and everything working seamlessly.

Clarification on spatial scale used to generate latitude/longitude-based species lists?

Hi BirdNET team,

Is it possible to add a brief clarification to the ReadME about the spatial scale/model used to filter the species list based on lat-long?

I started noticing some slight differences in the number of species used -- for example, two sites located about 200m away from one another where one "Species list contains 137 species" and the other "Species list contains 138 species." In retrospect, I realized this was due to different weeks of the year for the recordings I was looking at, rather than the small chance that both sites fell in different grid cells in the underlying model. Nevertheless, it did cause me to wonder about what spatial scale is used in the underlying model to select the species list (i.e., 10km, 1km, eBird species list grid cells?). Are you able to clarify?

Thank you for this incredible tool!

Species probability classes

I'm curious to learn about the probability class definition; where are they defined and on which basis? Is there any (scientific) documentation on that?

Conditional import of Keras/TFLite in model.py

When running BirdNET on a Raspberry Pi it is sufficient to install tflite-runtime without the need to install tensorflow.
Not having to install tensorflow/keras keeps the installation smaller and the process simpler.

It would be great if the import could be conditional so that the script does not throw an error when there is no installation of tensorflow.

It could be something like

if cfg.MODEL_PATH.endswith('.tflite'):
    try:
        import tflite_runtime.interpreter as tflite
    except ModuleNotFoundError:
        from tensorflow import lite as tflite
else:
   from tensorflow import keras

Is there demand for Kaleidoscope csv format Compatibility?

In our work we have found Kaleidoscope csv outputs to be very convenient to work with since it consolidates the ability to use a powerful software to quickly look at a lot of spectrograms of an audio dataset, as well as conveniently process a large csv with all of the annotations using Pandas, R, or excel.

We modified the deprecated BirdNET-Lite repo with this functionality, and we will likely rework our pipeline a bit to use these new models, but I am curious if there would be any demand for us to add an extra "rtype" parameter 'kaleidoscope' that produces a csv in that format on this repo? Not sure what the intersection of people that use Kaleidoscope and people that use BirdNET looks like.

If this git issue gets any traction, I can submit a PR request for this functionality.

Low-pass filter on example

Hello,

Do you usually apply a low-pass filter on the audio recordings? The example soundscape file has one and I am wondering why that was applied.

Thanks and kind regards,

Meelyn Pandit

Feature request: output of BirdNET formatted for subsequent analysis in R

It would be desirable to have a standardized output format for subsequent analysis of the results with R / R-Studio. Would be nice to have a specific --rtype 'R' option

The standardized output for this format would be a csv-file with the following columns:

• Filepath of the analysed file (eg. „f:/Audio/00_Demo_Aken_18/De03_2019_05_03_08_32_23.wav“)
• Start of detected chunk (in sec)
• End of detected chunk (in sec)
• Scientific_Name
• Common_Name --> in the preselected language, see here #1 (comment)
• Confidence
• Lat
• Lon
• Week
• Overlap
• Sensitivity
• Min_conf
• Custom_list
• Model for classification (eg.“BirdNET_GLOBAL_1K_V2.0_Model_INT8.tflite“)

Lines would correspond to single detections.

To use the read-functions of the readr package in R it would be necessary to avoid "empty" output files in which the header is followed by the newline character \n. We would therefore suggest to use no newline character in the header and a leading one with every detection.

Date and Time of the detections would be handled within the R script.

Thanks for providing BirdNET and for all your hard work, its greatly appreciated!

.NET issue

image

Running the GUI on windows 10 I get this error in the console. Does this make sense to anyone?

F-droid APK

Hello,
would it be possible to make Birdnet available on f-droid ?
It would allow users to download an up to date APK event if users do not have a google account

Regards

Docker Build Failure

I'm trying to build birdnet on docker.

I am using the following:
[1] Mac Mini M1 with macOS Monterey version 12.3.1,
[2] Docker Desktop version 4.7.1 (77678)

The error I'm getting is below:

=> ERROR [4/5] RUN pip3 install tensorflow 0.7s

[4/5] RUN pip3 install tensorflow:
#8 0.640 ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
#8 0.640 ERROR: No matching distribution found for tensorflow


executor failed running [/bin/sh -c pip3 install tensorflow]: exit code: 1

Feature Request: Translated Common Names

It would be desirable to have the option for BirdNET to use translated Common Names. The language could then be chosen by using the option --language DE with the appropriate Language abbreviations.

Also, it would be good, if a user with a more exotic language, that is not yet covered by BirdNET, could create his/her own translated version. Therefore, there should be a downloadable file with the eBird code & the Scientific_Name list, so one could fill another column with the Common_Name and send the prepared file to @kahst Stefan Kahl for incorporation into the BirdNET language file.

Thanks to @patlevin, there is already an extensive list of translated common names for the 6K model of BirdNET-Lite for 29 different languages. It can be found here: kahst/BirdNET-Lite#4 (comment)

There is also a corrected list of German names for this model: kahst/BirdNET-Lite#4 (comment)
and the European species in German for this model: kahst/BirdNET-Lite#4 (comment)

Unexpected: segments.py uses .txt results files even when .csv is specified as argument

Hello! I'm enjoying getting to know the new model and tools and have found one unexpected and minor issue:

If there are both a .csv and a .txt result file within the specified --results directory, segments.py uses the .txt even if --rtype csv is specified as an argument for segments.py.

To replicate, assuming BirdNET-Analyzer is cloned in the home directory:

Remove any old test results for this replication test

cd ~/BirdNET-Analyzer
rm ./examples/soundscape.Bird*

Create .csv results and run segments.py

python3 ./analyze.py --i example/ --o example/ --lat 42.5 --lon -76.45 --week 4 --sensitivity 1.0 --rtype csv
python3 ./segments.py --audio example/ --results example/  --seg_length 6 --rtype csv

That should all be successful.

Next:

Remove the segments that were generated in the test above, but keep the .csv results file

rm -drf ./example/*\ *

Create a .txt results table, but run segments.py specifying to use the .csv

python3 ./analyze.py --i example/ --o example/ --lat 42.5 --lon -76.45 --week 4 --sensitivity 1.0 --rtype table
python3 ./segments.py --audio example/ --results example/  --seg_length 6 --rtype csv

That will fail complaining that it is unable to convert the first line of the results table to a float:

pi@tester:~/BirdNET-Analyzer-Pi $ python3 ./segments.py --audio example/ --results example/  --seg_length 6 --rtype csv
Found 1 audio files with valid result file.
Traceback (most recent call last):
  File "/home/pi/BirdNET-Analyzer-Pi/./segments.py", line 229, in <module>
    cfg.FILE_LIST = parseFiles(cfg.FILE_LIST, max(1, int(args.max_segments)))
  File "/home/pi/BirdNET-Analyzer-Pi/./segments.py", line 60, in parseFiles
    segments = findSegments(afile, rfile)
  File "/home/pi/BirdNET-Analyzer-Pi/./segments.py", line 128, in findSegments
    start = float(d[0])
ValueError: could not convert string to float: '1\tSpectrogram 1\t1\t0\t3.0\t150\t12000\tbkcchi\tBlack-capped Chickadee\t0.4102'

I'm sorry I'm not quite able to just fix this and simply submit a pull request, as I would love to be of more help, but the issue is not big and most users would be able to figure out what is going on.

My best,
Patrick

Is it possible to use the Google coral with TFLite for BirdNET?

So I noticed #6 and the following commit would allow for specifying TFLite import. Would this also then open up for using the Google Coral to do the processing, or is the workload so low that this isn't benefitial? I already have a few of those in my cluster, and I thought it would be neat to feed audio from my outdoor cameras (RTSP) into BirdNET since I live in the middel of a bird migration "pit stop". But using as little resources as possible is always nice.

Error using 3k protobuf model

When trying to use the recently released 3k protobuf model I get the error '_UserObject' object has no attribute 'predict' and a warning that indicates that the "keras_metadata.pb" is missing.
Should a "keras_metadata.pb" file be present with the 3k protobuf model?
Thanks!

First initial check / test of docker install fails

Finished doing:
[1] "git clone" of the BirdNET-Analyzer package, and
[2] sudo docker build -t birdnet.

All successful. However, using the first example on website to run container, I'm getting the following error:

sudo docker run -v $PWD/example:/audio birdnet --i audio --o audio --slist audio
Password:
unknown option --i
usage: python3 [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.

Docker GPU instructions for BirdNET-Analyzer?

I have been a huge user of the original BirdNET - thank you for creating it!!! I want to run this new version over our existing collection Having a similar "Dockerfile-GPU" set of instructions (to the original BirdNET) for the new version would speed that up immensely.

pyinstaller: bundle BirdNET-Analyzer to single package

I used the pyinstaller package to bundle the analyze.py with all its dependencies to a single package. With that it isn't required to install a Python interpreter or any module to use BirdNET-Analyzer. The described approach should be valid for both Linux and Windows:

Install pyinstaller (within your virtual environment):

pip install pyinstaller

Create a folder extra-hooks with a new file hook-librosa.py and add the following lines to hook-librosa.py:

from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files('librosa')
hiddenimports=['scipy._lib.messagestream', 'sklearn.tree', 'sklearn.neighbors.typedefs','sklearn.neighbors._partition_nodes', 'sklearn.neighbors.quad_tree', 'sklearn.tree._utils', 'sklearn.utils._typedefs']

According to this Problem (which seems to be Windows-specific) you have to add 2 lines to analyze.py. First you can add freeze_support to line 8:

from multiprocessing import Pool, freeze_support

and the following line straight after the if __name__ == '__main__' line:

freeze_support()

Run pyinstaller:

pyinstaller analyze.py --additional-hooks-dir=extra-hooks

After that the bundled package can be found under dist/analyze/
Till this feature request is solved, the checkpoints folder and the eBird_taxonomy_codes file has to be located in the same directory from which you call the executable. That means immediately after packaging you can use the executable like this (for Linux/Windows):

dist/analyze/analyze --i example/ --o example/ --slist example/ --min_conf 0.5 --threads 4
dist/analyze/analyze.exe --i example/ --o example/ --slist example/ --min_conf 0.5 --threads 4

Note:
For maximum compatibility with different hardware don't use the default tensorflow wheels used by pip. I used this tensorflow wheel with python 3.8 under windows. For Linux I recommend to search a fitting wheel in the tensorflow-community-wheels. With that I used BirdNET-Lite and BirdNET-Analyzer succesfully on a Intel Celeron CPU 847 with 1.1 GHz.

Error using segments.py and multiple threads

It appears that when using multiple threads, there are some timing issues with directory creation. When I use multiple threads, I get multiple errors that are like:

Error: Cannot extract segments from e:\audio\20220427_081956.WAV. Traceback (most recent call last): File "D:\Downloads\BirdNET-Analyzer-main\BirdNET-Analyzer-main\segments.py", line 188, in extractSegments os.makedirs(outpath) File "C:\Users\jknowles\AppData\Local\ESRI\conda\envs\clone3\lib\os.py", line 223, in makedirs mkdir(name, mode) FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'e:\\segments_0_80\\Virginia Rail'

I think what is happening is that lines 187 and 188 in segments.py are being run concurrently in separate threads that are causing the os to try and create a directory that was already created in a different thread.

if not os.path.exists(outpath):
os.makedirs(outpath)

Potential solution would be to go through and create all the species directories first before using Pool to run extractSegments in multiple threads.

I was able to successfully run segments.py without any errors using --threads set to 1.

Embeddings.py appears to outputs species classifications, not embeddings

I'm currently looking into at Birdnet embeddings for clustering via embeddings.py. Someone I was working with noticed the size of the embeddings array (from the embeddings.py output) is the same size as the species list implying embeddings.py is outputting the classifications.

After playing around it looks like when running embeddings.py,loadmodel() in model.py is being called with class_output=True instead of class_output=False. When manually changing class_output=False, embeddings.py outputs an array of size 420 instead of 2434.

Which is the correct embeddings array?

EDIT: In embeddings.py on line 75, models.predict() is called and it returns an array of size 2434 (same size as species list). Changing this to models.embeddings() returns the array of size 420.

Slow docker performance

Hello

I'm getting really slow processing times when using docker vs native.

native:

jason@LAPTOP-T8LSCUVL:~/benchmark/native/BirdNET-Analyzer$ python3 analyze.py
Species list contains 2434 species
Found 2 files to analyze
Analyzing example/soundscape.wav
Analyzing example/test.wav
Finished example/test.wav in 1.07 seconds
Finished example/soundscape.wav in 4.40 seconds

docker:

jason@LAPTOP-T8LSCUVL:~/benchmark/docker/BirdNET-Analyzer$ sudo docker run -v /home/jason/benchmark/native/BirdNET-Analyzer/example/:/audio birdnet analyze.py --i /audio --o /audio --slist /audio
Species list contains 41 species
Found 2 files to analyze
Analyzing /audio/soundscape.wav
Analyzing /audio/test.wav
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Finished /audio/test.wav in 12.22 seconds
Finished /audio/soundscape.wav in 15.75 seconds
jason@LAPTOP-T8LSCUVL:~/benchmark/docker/BirdNET-Analyzer$

I'm guess this is to do with the line "INFO: Created TensorFlow Lite XNNPACK delegate for CPU."
Just wanted to know if anyone else had seen this issue?

list of non-avian labels

Hello!

Thanks so much for the incredible resource of BirdNET. In addition to birds, my organization is curious about all of the non-avian sound sources BirdNET can now apparently identify (e.g., we now get engine, various amphibians, coyote, etc.). I went into some of the labels files and I know the possible labels are all there, but I was wondering if there is some easy way to find a list specifically of just the non-avian sounds BirdNET Analyzer can label, so I can bring this information to others. Apologies if this is easily accessible already and I'm just missing it! Any direction is much-appreciated.

Thanks

Please add Begin.File info to the selection tables?

Hi Stefan and dev team,
The new BirdNET-Analyzer is a marked improvement over the previous version so far, thanks very much for your work!
However, there is a small snippet that disappeared which makes my work far more difficult (and I'm sure others too).
The selection table files don't have Begin.File info anymore. This was really useful for batch processing data in R because it allowed for easy extraction of the exact date, time and recorder name from the file name. Do you think you could add that back without too much of a hassle?
Thanks a lot!
Thomas

Feature request: model, … file paths relative to script location

It would be nice to have the possibility to run the analyze.py script independently of the actual location of the user (e.g. python3 BirdNET-Analyzer/analyze.py ...). To allow this it would be necessary to define the model, label, species_list and eBird-codes file paths relative to the location of analyze.py.

I'd like to suggest the following after parsing the arguments:

cfg.MODEL_PATH = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), cfg.MODEL_PATH)
cfg.LABELS_FILE = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), cfg.LABELS_FILE)
cfg.MDATA_MODEL_PATH = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), cfg.MDATA_MODEL_PATH)

And Line 308 (cfg.SPECIES_LIST_FILE = args.slist) could be replaced by:

cfg.SPECIES_LIST_FILE = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), args.slist)

Moreover there should be a cfg.CODES_FILE to adjust the path for the eBird-Codes as well.

Running segments.py with forward slashes crashes it

Running segments.py with forward slashes on Windows 10 leads to a system error. For example when running the example command python3 segments.py --audio example/ --results example/ --o example/segments/
This seems to be caused by the code expecting backslashes (pathname splitting on line 191 doesn't work as expected).

Thanks for fixing this!

Fully packaged Windows version available for model v2.2 ?

Hi!
I successfully used the fully packaged version for Windows available under this link:

grafik

It seems to be based on model version v2.1 with 2434 classes
It would be nice, if the latest model version v2.2 (with 3337 classes) could also be provided as a fully packaged version!

Thanks very much in advance!

Frank

conda-forge for BirdNET-Analyzer?

Hello!

I was previously using BirdNET-Lite to process audio files through BirdNET via R. I wrote up an install-BirdNET-for-Windows guide and documented some R functions that helped me process and wrangle the BirdNET-Lite outputs.

Now that BirdNET-Lite is deprecating, I am updating my workflows to accommodate BirdNET-Analyzer. With BirdNET-Lite, what worked to run via R was to set up a conda environment for BirdNET.

Now as I tinker with BirdNET-Analyzer instead, the error messages I'm getting lead me to believe that I will need to have my conda environment include the BirdNET-Analyzer-main module that I've locally installed. I'm not sure how to do this, since conda develop seems to be deprecated.

My question is, would it be possible to include your releases of BirdNET-Analyzer-main on conda-forge so that it could be easily installed to a conda environment?

(i.e., conda install - n birdnetenv -c conda forge birdnet-analyzer)

All of this may seem cumbersome to the more computer science-minded folks here, but I am trying to come up with well-documented ways to use BirdNET and promote access for more R-minded colleagues, collaborators, students, and interns who I work with. Apologies for the potentially uninformed question since Python is not my strong suit! It's possible there is a very easy solution if I were only using my own machine, but I'm hoping for a more portable solution so that I can easily document and explain to collaborators.

Thank you for what you do.

config file inputs not workin

Hello, this is probably my naivety with python but I opened the folder in VS code, and edited my config.py file with the input, output, species_list and inference settings. then ran the config file, then ran analyze.py but it still is running the default example files and species list. Am I missing a step?

GUI install not working - error about GTK/QT

I am having trouble getting the GUI to load. I input the exact commands on the page for Ubuntu setup, and then the pip install pywebview and python gui.py commands but I am getting this error. I tried doing pip install pywebview[qt] and this also does not work. I am doing this SSH'd into an Azure virtual machine (Ubuntu Data Science 20.04 image).

I tried the same code on my Mac (M1 chip) and it worked fine then...

azureuser@lemurprayers:/datadrive/BirdNET-Analyzer$ python gui.py
[pywebview] GTK cannot be loaded
Traceback (most recent call last):
  File "/anaconda/lib/python3.9/site-packages/webview/guilib.py", line 16, in import_gtk
    import webview.platforms.gtk as guilib
  File "/anaconda/lib/python3.9/site-packages/webview/platforms/gtk.py", line 26, in <module>
    import gi
ModuleNotFoundError: No module named 'gi'
[pywebview] Using Qt 5.15.2
qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

Aborted (core dumped)
(base) azureuser@lemurprayers:/datadrive/BirdNET-Analyzer$

Difference to BirdNET Lite

Dear Stefan,

thanks for the wonderful new software. Makes it easy with analyzing in locale and segements. But the results differ quite from the old BirdNET-Lite. I used a fork that can manage to analze a folder https://github.com/UCSD-E4E/BirdNET-Lite and the results have been quite better, ring ouzel was right and also pygmy owl. The parameters have been just the same.
python3 analyze.py --i /home/jalmer/Musik/TestHofbauernalm/ --lat 47.856 --lon 12.344 --week 16 --overlap 1.5 --min_conf 0.7 --sensitivity 1.25 --locale de --o /home/jalmer/Musik/TestHofbauernalm/
grafik

BirdNet License

Hey!

Could you clarify the license, please? It's stated to be Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International, however, in the paper for BirdNet, you mentioned that you use Macaulay Library, and it has a more strict license.

So I guess it's a 2-fold question:

  • Is the license really Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International?
  • If so, how does that relate to Macaulay Library data? Maybe you only used it for testing, and not for training?

Dear BirdNet

Dear BirdNET
Have you considered being able to save a recording and share it on Facebook?

Yours sincerely
Brian

List of non-avian species in BirdNET Analyzer

Hello!

Thanks so much for the incredible resource of BirdNET. In addition to birds, my organization is curious about all of the non-avian sound sources BirdNET can now apparently identify (e.g., we now get engine, various amphibians, coyote, etc.). I went into some of the labels files and I know the possible labels are all there, but I was wondering if there is some easy way to find a list specifically of just the non-avian sounds BirdNET Analyzer can label, so I can bring this information to others. Apologies if this is easily accessible already and I'm just missing it! Any direction is much-appreciated.

Thanks

Species filter too restrictive?

Hi all,
I have been a fairly extensive user of the birdnet algorithms, first the lite version and now 2.1 and 2.2. It is fantastic work by the team of developers.

I noticed that the the species filter of version 2.1 and 2.2 is too restrictive in southern Germany.

Entering -lat, -lon and -week is way too restrictive for several of my recording sessions, excluding several bird species from the analysis which do in fact occur in the area and are present in the recordings. Even the least restrictive species filter using -lat -lon and -sf_thresh 0.01 still excluded some species from the analysis that do in fact occur in the area and in the recordings (prominently, the Eagle Owl), while at the same time including many extreme rarities.

Takeaway for me: It may be quite important to check the effectiveness of the species filter with species.py before analyzing large datasets. Did other users encounter this behavior before?

It is easy to get around this issue by using a manually compiled species list with the -slist option, starting from the resulting list of species.py and then manually add the species that might actually occur (or remove those that are not relevant).

cheers, Michael

"Error: Cannot open audio file ..." on some mp3 files, but not others.

I'm running BirdNET Analyzer from the command line in Windows, and can't figure out the following strange problem. I have a folder full of mp3 files all from the same audio recorder. BirdNET Analyzer processes many of them, but not all of them. For the audio files it doesn't process, it gives the error:

Analyzing E:\xxxxx\fiilename.mp3
Error: Cannot open audio file E:\xxxxx\fiilename.mp3

I've tried moving the offending files to different folder locations (such as local to my machine in case it was some type of connection issue with the external hard drive), but the error persists only for specific files. The files producing this error are not too short, they open fine in Audacity and other programs, and don't seem to be corrupt or have any obvious issues. BirdNET-Analyzer runs fine on these files if I convert them to wave first, but I'd rather avoid this workaround to mitigate size/storage challenges. Has anyone run into this, and do you know of a workaround?

Analyzing stereo files takes twice the time of mono files

The code clearly loads audio files as mono in audio.py
Do you have any idea why BirdNET still takes twice the time?

This happens on a RaspberryPi 3A+
Memory usage is similar when analyzing mono files.
The function librosa.load(..., mono = True) executes almost instantaneously

App on F-Droid

Is the Android app also open-source?
Would be great to have it on F-Droid.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.