BatDetect2
Code for detecting and classifying bat echolocation calls in high frequency audio recordings.
https://github.com/macaodha/batdetect2
Category: Biosphere
Sub Category: Bioacoustics and Acoustic Data Analysis
Last synced: about 18 hours ago
JSON representation
Repository metadata
- Host: GitHub
- URL: https://github.com/macaodha/batdetect2
- Owner: macaodha
- License: other
- Created: 2022-12-07T11:59:12.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-05-07T09:06:51.000Z (25 days ago)
- Last Synced: 2026-05-28T15:03:44.963Z (4 days ago)
- Language: Python
- Size: 34.4 MB
- Stars: 98
- Watchers: 17
- Forks: 17
- Open Issues: 20
- Releases: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
README.md
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 previousbatdetect2.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
[!NOTE]
2.0.0b1is a pre-release on PyPI.
You may need to request it explicitly by version, for example:uvx --from batdetect2==2.0.0b1 batdetect2 uv tool install batdetect2==2.0.0b1 pip install batdetect2==2.0.0b1
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.
Owner metadata
- Name: Oisin Mac Aodha
- Login: macaodha
- Email:
- Kind: user
- Description:
- Website: https://homepages.inf.ed.ac.uk/omacaod/
- Location:
- Twitter:
- Company: University of Edinburgh
- Icon url: https://avatars.githubusercontent.com/u/6660523?u=0b8c583ab03a28311bcc9664e805d4b7f62817af&v=4
- Repositories: 4
- Last ynced at: 2023-03-01T06:10:27.905Z
- Profile URL: https://github.com/macaodha
GitHub Events
Total
- Release event: 4
- Pull request event: 18
- Fork event: 6
- Issues event: 21
- Watch event: 24
- Issue comment event: 51
- Push event: 82
- Pull request review comment event: 20
- Pull request review event: 8
- Create event: 12
Last Year
- Issues event: 6
- Watch event: 12
- Issue comment event: 14
- Push event: 64
- Pull request review event: 1
- Create event: 3
Committers metadata
Last synced: 4 days ago
Total Commits: 649
Total Committers: 6
Avg Commits per committer: 108.167
Development Distribution Score (DDS): 0.055
Commits in past year: 375
Committers in past year: 2
Avg Commits per committer in past year: 187.5
Development Distribution Score (DDS) in past year: 0.005
| Name | Commits | |
|---|---|---|
| mbsantiago | s****l@g****m | 613 |
| macaodha | m****a@g****m | 14 |
| Kavi | k****i@e****k | 13 |
| Oisin Mac Aodha | o****d@e****k | 5 |
| ccarrizosa | c****a@g****m | 3 |
| Arky | h****y@g****m | 1 |
Committer domains:
- gmx.com: 1
- ed.ac.uk: 1
- ecos.au.dk: 1
Issue and Pull Request metadata
Last synced: 20 days ago
Total issues: 41
Total pull requests: 25
Average time to close issues: about 1 month
Average time to close pull requests: 8 days
Total issue authors: 27
Total pull request authors: 5
Average comments per issue: 3.0
Average comments per pull request: 1.0
Merged pull request: 23
Bot issues: 0
Bot pull requests: 0
Past year issues: 13
Past year pull requests: 3
Past year average time to close issues: N/A
Past year average time to close pull requests: about 4 hours
Past year issue authors: 9
Past year pull request authors: 2
Past year average comments per issue: 2.77
Past year average comments per pull request: 0.33
Past year merged pull request: 3
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- markgloverswaybtinternetcom (7)
- Jeff37 (5)
- kdarras (3)
- d-singer (2)
- chrmue44 (2)
- jenstangchristensen (1)
- kaviecos (1)
- arky (1)
- MatisPatel (1)
- NoxTheXelor (1)
- tdelattre (1)
- sergewich (1)
- niallel (1)
- fhaefele (1)
- RanelelSapo (1)
Top Pull Request Authors
- mbsantiago (18)
- kaviecos (3)
- ccarrizosa (2)
- arky (1)
- EvansMike (1)
Top Issue Labels
- bug (5)
- documentation (1)
- enhancement (1)
Top Pull Request Labels
- enhancement (1)
- bug (1)
Dependencies
- actions/checkout v3 composite
- actions/setup-python v3 composite
- librosa ==0.9.2
- matplotlib ==3.6.2
- numpy ==1.23.4
- pandas ==1.5.2
- scikit_learn ==1.2.0
- scipy ==1.9.3
- torch ==1.13.0
- torchaudio ==0.13.0
- torchvision ==0.14.0
- actions/checkout v3 composite
- actions/setup-python v3 composite
- pypa/gh-action-pypi-publish 27b31702a0e7fc50959f5ad993c78deac1bdfc29 composite
- click *
- librosa *
- matplotlib *
- numpy *
- pandas *
- scikit-learn *
- scipy *
- torch >=1.13.1,<2
- torchaudio *
- torchvision *
- librosa
- matplotlib
- numpy
- pandas
- python 3.10
- pytorch
- scikit-learn
- scipy
- torchaudio
- torchvision
- attrs 24.2.0
- audioread 3.0.1
- batdetect2 1.1.0
- certifi 2024.8.30
- cffi 1.17.1
- charset-normalizer 3.4.0
- click 8.1.7
- colorama 0.4.6
- contourpy 1.3.0
- cycler 0.12.1
- debugpy 1.8.8
- decorator 5.1.1
- exceptiongroup 1.2.2
- filelock 3.16.1
- fonttools 4.54.1
- fsspec 2024.10.0
- hypothesis 6.118.7
- idna 3.10
- importlib-resources 6.4.5
- iniconfig 2.0.0
- jinja2 3.1.4
- joblib 1.4.2
- kiwisolver 1.4.7
- lazy-loader 0.4
- librosa 0.10.2.post1
- llvmlite 0.43.0
- markupsafe 3.0.2
- matplotlib 3.9.2
- mpmath 1.3.0
- msgpack 1.1.0
- networkx 3.2.1
- nodeenv 1.9.1
- numba 0.60.0
- numpy 2.0.2
- nvidia-cublas-cu12 12.1.3.1
- nvidia-cuda-cupti-cu12 12.1.105
- nvidia-cuda-nvrtc-cu12 12.1.105
- nvidia-cuda-runtime-cu12 12.1.105
- nvidia-cudnn-cu12 9.1.0.70
- nvidia-cufft-cu12 11.0.2.54
- nvidia-curand-cu12 10.3.2.106
- nvidia-cusolver-cu12 11.4.5.107
- nvidia-cusparse-cu12 12.1.0.106
- nvidia-nccl-cu12 2.20.5
- nvidia-nvjitlink-cu12 12.6.77
- nvidia-nvtx-cu12 12.1.105
- packaging 24.2
- pandas 2.2.3
- pillow 11.0.0
- platformdirs 4.3.6
- pluggy 1.5.0
- pooch 1.8.2
- pycparser 2.22
- pyparsing 3.2.0
- pyright 1.1.388
- pytest 8.3.3
- python-dateutil 2.9.0.post0
- pytz 2024.2
- requests 2.32.3
- ruff 0.7.3
- scikit-learn 1.5.2
- scipy 1.13.1
- six 1.16.0
- sortedcontainers 2.4.0
- soundfile 0.12.1
- soxr 0.5.0.post1
- sympy 1.13.3
- threadpoolctl 3.5.0
- tomli 2.0.2
- torch 2.4.1
- torchaudio 2.4.1
- torchvision 0.19.1
- triton 3.0.0
- typing-extensions 4.12.2
- tzdata 2024.2
- urllib3 2.2.3
- zipp 3.21.0
Score: 6.5624440936937205