Deep learning model for detecting and classifying bat echolocation calls in high frequency audio recordings.
Project description
BatDetect2
Code for detecting and classifying bat echolocation calls in high-frequency audio recordings.
[!WARNING]
batdetect22.0.0b1 is out. This is a beta release and we are gathering user feedback. If you run into issues or have feedback on the new workflows, please use the GitHub issues page to let us know.There are many changes and new recommended workflows. We have left the previous
batdetect2.apimodule intact, but if you run into issues or want to upgrade, see the migration guide in the docs site.This update also ships with a refreshed default model. It was trained in the same way and on the same data as before, but you should still expect small output differences in some cases.
What is BatDetect2
BatDetect2 is a deep learning model for detecting and classifying bat echolocation calls. The model generates multiple predictions for each input recording by providing a bounding box and predicted class for each individual call within it.
This repository also holds batdetect2, a Python-based tool to run, train,
finetune and evaluate BatDetect2-type models, including the built-in model for
detecting UK bat species.
You can use the tool from the command line (terminal) or from Python as needed.
Getting Started
We have extensive documentation on how to use
batdetect2.
The docs site is still being built and will be live soon.
If you want a quick peek for now, see the docs/ folder in this repository.
See our getting started guide and then jump into any of our tutorials:
- Run the model on a folder of recordings:
docs/source/tutorials/run-inference-on-folder.md - Train your own model:
docs/source/tutorials/train-a-custom-model.md - Evaluate your model:
docs/source/tutorials/evaluate-on-a-test-set.md - Fine-tune a model:
docs/source/tutorials/integrate-with-a-python-pipeline.md
Try the model
If you want to try the model for UK bat species without installing anything, you can try the following:
-
Demo of the model (for UK species) on huggingface.
-
Alternatively, click here to run the model using Google Colab. You can also run this notebook locally.
Installing BatDetect2
If you have uv installed (if not, we recommend it; follow the instructions
here), then you can
run batdetect2 one-off with
uvx batdetect2
or if you want to install it permanently:
uv tool install batdetect2
and test it with
batdetect2
Run BatDetect2 on a folder of recordings
Once installed, you can run BatDetect2 on a folder of .wav files.
By default it will use the model trained on UK data.
Example command:
batdetect2 process directory example_data/audio outputs
This will scan the audio files in example_data/audio and save model outputs to
outputs.
If you have your own model checkpoint, you can use it:
batdetect2 process directory --model path/to/checkpoint.ckpt example_data/audio outputs
For the full walkthrough, use
docs/source/tutorials/run-inference-on-folder.md.
Data and annotations
The raw audio data and annotations used to train the models in the paper will be
added soon.
batdetect2 supports annotations in various formats and is compatible with the
outputs of whombat and this
earlier version.
If you're interested in supporting another format, please reach out or submit a
PR.
Warning
The models developed and shared as part of this repository should be used with caution. While they have been evaluated on held-out audio data, great care should be taken when using the model outputs for any form of biodiversity assessment. Your data may differ, and as a result it is very strongly recommended that you validate the model first using data with known species to ensure that the outputs can be trusted. If you train a model, make the best effort to be transparent about its training and evaluation data, and inform downstream users about its limitations.
FAQ
For more information please consult our FAQ.
Reference
If you find our work useful in your research, please consider citing our paper, which you can find here:
@article{batdetect2_2022,
title = {Towards a General Approach for Bat Echolocation Detection and Classification},
author = {Mac Aodha, Oisin and Mart\'{i}nez Balvanera, Santiago and Damstra, Elise and Cooke, Martyn and Eichinski, Philip and Browning, Ella and Barataud, Michel and Boughey, Katherine and Coles, Roger and Giacomini, Giada and MacSwiney G., M. Cristina and K. Obrist, Martin and Parsons, Stuart and Sattler, Thomas and Jones, Kate E.},
journal = {bioRxiv},
year = {2022}
}
Acknowledgements
Thanks to all the contributors who spent time collecting and annotating audio data.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file batdetect2-2.0.0b1.tar.gz.
File metadata
- Download URL: batdetect2-2.0.0b1.tar.gz
- Upload date:
- Size: 30.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac006bf1b4820e692bac61b301f4aaa10b5ac7ea6a21a176a31f53e39563f6ce
|
|
| MD5 |
f51ec1ce4df27b0bbae11b22e0cbfc27
|
|
| BLAKE2b-256 |
a042d46a74806d933271df9745f21156cc75ab19463e9fd6eff1e0e86a38be91
|
File details
Details for the file batdetect2-2.0.0b1-py3-none-any.whl.
File metadata
- Download URL: batdetect2-2.0.0b1-py3-none-any.whl
- Upload date:
- Size: 14.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6e580f2f4e20b348bb2ce2030858ec8a5fb772c2ac627c31220e31dd5f61a6d
|
|
| MD5 |
7eff3e4108172bf6841645652d837c3e
|
|
| BLAKE2b-256 |
9018de05f8840b258aa138ea7f41699cfb3f1b3a77c5aeec4883d27bf747c8a1
|