Skip to content

Latest commit

 

History

106 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BioDCASE Logo

BioDCASE-Tiny 2026 competition (Task 3) - A machine learning competition for bird sound recognition on tiny hardware.

Background

BioDCASE-Tiny is a competition for developing efficient machine learning models for bird audio recognition that can run on resource-constrained embedded devices. The project uses the ESP32-S3-Korvo-2 development board, which offers audio processing capabilities in a small form factor suitable for field deployment. This year we added a pytorch framework along the tensorflow framework from last year offering participants to choose between one of the two machine learning frameworks. Please, also visit the official BioDCASE 2026 Task 3 website for additional information.

Table of Contents

Dataset

The dataset consists of 2750 audio field recordings of 3 s length from 10 bird species plus 1 background class from urban environments resulting in 11 classes in total. The dataset is available for download on Zenodo where additional details are provided as well.

Setup and Installation

Prerequisites

  1. Python >=3.11 and <=3.13 with pip and venv
  2. Docker (runs ESP-IDF in a container) OR locally installed ESP-IDF
  3. (optional) ESP32-S3-Korvo-2 development board and two USB cables (power and serial connection)

Important

You can also participate in the challenge if you do not want to buy a Korvo-2 dev board, but consider that you will not be able to check if your model is actually deployable on the Korvo system. If the deployable model (.tflite) does not exist or isn't able to run on our system, you will be ranked lower in the competition. We still recommend to buy the Korvo-2 dev board to get the full embedded experience of this task.

Installation Steps

  1. Clone the repository:
git clone https://github.com/birdnet-team/BioDCASE-Tiny-2026.git
cd BioDCASE-Tiny-2026
  1. Install your favorite python version (as long as it is able to build the requirements, see prerequisities for working version).

  2. Create a virtual environment (recommended) here with python version 3.13 as example:

python3.13 -m venv .venv
source .venv/bin/activate
  1. Install Python dependencies depending on the framework you want to use (pytorch or tensorflow):
pip install -r requirements_<pytorch|tensorflow>.txt
  1. Install Docker on your system. Afterwards you have to activate the docker deamon and add it to your user group. On Linux (depends on your distribution) this can be achieved with:
systemctl status docker.socket
systemctl enable docker.socket
sudo gpasswd -a <your_username> docker

To test if your Docker runs you can do:

docker run hello-world
  1. (alternatively) install the ESP-IDF framework on your local PC and compile the code using idf.py commands. You have to have a look into the code of the repository and figure out which docker commands are used for building and deploying the code.

Configuration

  1. Move the downloaded dataset to any location on your PC, for instance, /path/to/your/downloaded/dataset/ and edit config.yaml file at following location (the path can also be relative to the path you start the script):
datamodule:
  dataset:
    root_path: /path/to/your/downloaded/dataset/

you can also change the intermediate and cache (feature) paths at:

datamodule:
  intermediate:
    root_path: ./output/01_intermediate/
  caching:
    root_path: ./output/02_features/
  1. (optional) Make sure to add rights to your usb device connecting to the Korvo-2 dev board. This depends a bit on the system, on Linux, you have to add udev rules in /etc/udev/rules.d/, e.g. add a file there /etc/udev/rules.d/10-custom-usb.rules with content:
# ubuntu vs. arch: GROUP="dialout" vs. GROUP="uucp"
# rule for esp32 (devkit-c or korvo)
KERNEL=="ttyUSB0", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", GROUP="uucp", MODE="0666"

and add to your group ("uucp" for arch, "dialout" for ubuntu), then reload and restart your PC:

sudo gpasswd -a <your_username> uucp
sudo udevadm control --reload-rules
  1. (optional) Set your serial device port in the config.yaml for Linux it is usually /dev/ttyUSB0
generate_embedded_code:
  serial_device: <YOUR_DEVICE> 

Running on Windows

We recommend using Windows Subsystem for Linux (WSL) to run this project. To make your device accessible for WSL you can use this Guide. To determine your serial device port you can use the following command:

dmesg | grep tty

You might also need to grant rights to run the deployment:

sudo adduser $USER dialout
sudo chmod a+rw $SERIAL_PORT

Development

  • Modify config.yaml to change feature extraction or model parameters.
  • Modify corresponding model files in either pipeline_pytorch/ or pipeline_tensorflow/ framework folders.

Important

Writing custom features rather than using the implemented ones, requires implementing a numerically equivalent version on the embedded target too! This is a necessary condition for the evaluated model to behave identically on the host and on the embedded target likewise. Note, that this is a non-trivial undertaking and we generally advice to stick to already implemented feature extraction in this repository!

Quickstart

To run the complete pipeline on the pytorch framework execute:

python biodcase2026_tiny_ml_pytorch.py

and for the tensorflow framework:

python biodcase2026_tiny_ml_tensorflow.py

This will run the data preprocessing, extraction of features, training of the model, and deployment on your development board. Once deployed, the benchmark code on the ESP32-S3 will display information about the runtime performance of the preprocessing steps and the deployed model via serial monitor (over USB cable).

Code Structure

  • biodcase2026_tiny_ml__<pytorch|tensorflow>.py - Main execution pipeline
  • datamodule.py - Datamodule for preprocessing, feature extraction, and data storage
  • pipeline_pytorch/ - Pytorch framework folder
  • pipeline_tensorflow/ - Tensorflow framework folder
  • model_evaluation.py - Evaluate models
  • biodcase_tiny/embedded/firmware/main - Firmware source code that will be copied and modified for the ESP target
  • biodcase_tiny/embedded/esp_target.py - ESP build target creation
  • biodcase_tiny/embedded/esp_toolchain.py - ESP toolchain with Docker IDF to build, flash, and monitor
  • submission/ - Guidelines and testing of your submission package

Data Processing and Feature Extraction

Both data processing and feature extraction is handled by datamodule.py and follows following steps:

  1. Raw audio files are read, checked, and stored.
  2. Features are extracted by feature_handler.py according to the configuration set in config.yaml where both feature_extraction and feature_handler_add_kwargs are passed to the FeatureHandler class. The config to adapt is:
datamodule:
  feature_extraction:
    window_len: 4096
    window_stride: 512
    ...
  feature_handler_add_kwargs:
    target_sample_rate: 24000
    transpose_features_extracted: True
    ...
  1. The preprocessed data (intermediate) and features (caching) are stored and reloaded once they exist. Therefore, if you change the feature extraction parameters you either have to delete the cached folders or set the redo flags to True in
datamodule:
  redo_all: False
  redo_intermediate: False
  redo_cache: False

or you change the ids in

datamodule:
    intermediate:
      root_path: './output/01_intermediate'
      intermediate_id: 'intermediate0'
      ...
    caching:
      root_path: './output/02_features'
      cache_id: 'cache0'
      ...

If you want to run only the data preprocessing and feature extraction with a visualization of data samples (and audio playback) execute:

python datamodule.py

Model Training

The model training is started either by biodcase2026_tiny_ml_pytorch.py or biodcase2026_tiny_ml_tensorflow.py depending on your framework of choice.

Pytorch Framework

When choosing the pytorch framework, the model files are located in ./pipeline_pytorch. The model training process is managed in model_training.py where the training/validation steps are defined in model_base.py by the ModelBase class. The model architecture can be customized in model_tiny_ml.py by overwriting any function you wish to change. You can also create a new model file, but make sure that your model class inherits ModelBase which is required for the submission process. To configure the model training change fields in config.yaml at:

pytorch_framework:
  dataloader_train_kwargs:
    batch_size: 32
    shuffle: true
  dataloader_validation_and_test_kwargs:
    batch_size: 32
    shuffle: false
  model:
    module: pipeline_pytorch.model_tiny_ml
    attr: Baseline
    args: []
    kwargs:
      device:
        use_cpu: False
        device_name: 'cuda:0'
      criterion: {'module': 'torch.nn', 'attr': 'CrossEntropyLoss', 'kwargs': {}}
      optimizer: {'module': 'torch.optim', 'attr': 'Adam', 'kwargs': {'lr': 0.001, 'betas': [0.9, 0.999]}}
      verbose: False
  model_training:
    num_epochs: 100

The dataloader kwargs are useful for setting the batch size in training. In the model entry, the module is the python package (or file), attr the function (in this case the model class), and args and kwargs are passed to this model class.

Tensorflow Framework

When choosing the pytorch framework, the model files are located in ./pipeline_tensorflow. The model training process is managed in model_training.py where Keras model creation and training step is defined in model.py. This framework was adapted from previous year's BioDCASE 2025 competition. You can configure your model training in config.yaml at:

tensorflow_framework:
  model_training:
    seed: 42
    n_epochs: 100
    shuffle_buff_n: 10000
    batch_size: 32
    early_stopping:
      patience: 100

Model Evaluation

Evaluate all models that were already trained and saved in ./output/03_models/ on classification performance with:

python model_evaluation.py

The resource efficiency from the .tflite models is not evaluated but can be found in the report directories output/04_reports/ as monitor_report.yaml file which is saved after training and deployment.

ESP32-S3 Build and Deployment

Our model build and deployment procedure to the ESP32-S3-Korvo-2 development board follows following three main steps:

  1. Build target creation
  2. Compilation (Docker or ESP-IDF)
  3. Deployment and Monitoring (Docker or ESP-IDF)

In the build target creation step, the firmware in ./biodcase_tiny/embedded/firmware/main/ is copied and processed with Jinja where the serialized .tflite model (stored by the pipeline in e.g. ./output/03_models/pytorch) and feature extraction parameters are inserted. The build target is stored in ./output/05_generated_embedded_code/src/.

Once the build target is ready, the compilation is done by:

python compile_embedded_src_code.py

Afterwards you can deploy the compiled code on the actual device with:

python deploy_embedded_compiled_code.py

Note: If you do not want to use docker, have a look into embedded_code_generation.py and biodcase_tiny/embedded/esp_toolchain.py where you find the corresponding idf.py commands for building (build), deploying (flash), and monitoring (monitor). We still recommend to use docker, because it stores the monitor output to e.g. ./output/04_reports/pytorch/monitor_report.yaml where the resource efficiency metrics on the device are shown.

Technical Details

The ESP32-S3-Korvo-2 development board features:

  • ESP32-S3 dual-core processor
  • Built-in microphone array
  • Audio codec for high-quality audio processing
  • Wi-Fi and Bluetooth connectivity
  • Software Support

and can be bought, for instance, here.

ESP32-S3-Korvo-2 development board

Development Tips

  1. Feature Extraction Parameters: Carefully tune the feature extraction parameters in config.yaml.
  2. Model Size: Keep your model compact. The ESP32-S3 has limited memory, so optimize your architecture accordingly.
  3. Profiling: Use the profiling tools to identify bottlenecks in your implementation.
  4. Memory Management: Be mindful of memory allocation on the ESP32. Monitor the allocations reported by the firmware.
  5. Docker Environment: The toolchain uses Docker to provide a consistent ESP-IDF environment, making it easier to build on any host system.

Submission

Rules and guidelines for submission are defined in the ./submission/README.md file here. In short, you will have to submit a .zip file containing:

  1. Inference model
  2. (optional) Embedding model (tflite)
  3. (optional) Built embedded code (src)
  4. (alternative) Feature extraction algorithm that does not follow the baseline algorithm
  5. A YAML metadata file describing details of your submission
  6. Technical report (.pdf)

Your solution will be evaluated on a hidden test set and the scores and technical reports will be presented in the upcoming results section of the BioDCASE website.

Evaluation Metrics

The BioDCASE-Tiny competition evaluates models based on multiple criteria on Classification Performance and Resource Efficiency:

  • Top-1 Accuracy: Accuracy of the highest predicted class to the target class
  • ROC AUC: Area Under the Receiver Operating Characteristic Curve
  • Model Size: .tflite model file size (KB)
  • ESP32-S3 Processing Times: Feature extraction, model, and total time for running the audio classification on the ESP32-S3 (on Korvo-2 dev board)
  • Peak Memory Usage: Maximum RAM usage during inference (KB)

Ranking

Participants will be ranked according to all evaluation metrics.

Baseline Results

The following table shows our baseline results on the pytorch framework evaluated on the validation dataset:

Inference Model Embedding Model Embedded Performance on ESP32-S3
ACC ROC AUC Size [Bytes] MACs ACC ROC AUC Size [Bytes] MACs Time Setup [ms] Time Preprocessing [ms] Time Model [ms] Time Total [ms] RAM Usage [Bytes]
0.5647 0.8921 393109 23326923 0.5628 0.8923 111408 23315232 4.44 3.11 330.36 337.9 202556

Challenge Results

The challenge results are now available at the BioDCASE2026 Task3 - results webpage. We thank each participant for joining the challenge and contributing research in tiny machine learning for bird sound recognition.

Limitations

This framework does not yet use real microphone data from the Korvo-2 dev board! Instead, it runs a profiler to evaluate the model and feature extraction in size and time consumption. Therefore, we are looking for interested collaborators to improve this project (especially on the embedded side) and create an even better challenge starting point for future editions of BioDCASE.

Support

If you find errors in code or if you have problems in getting started, please create a GitHub issue within this repository. We are happy to get any feedback to improve this repository!

License

This project is licensed under the Apache License 2.0 - see the license headers in individual files for details.

Citation

If you use the BioDCASE-Tiny framework or dataset in your research, please cite the following:

Framework Citation

@misc{biodcase_tiny_2026_repo,
  author = {Walter, Christian and Benhamadi, Yasmine and Seidel, Tom and Carmantini, Giovanni and Kahl, Stefan},
  title = {BioDCASE-Tiny 2026: A Framework for Bird Species Recognition on Resource-Constrained Hardware},
  year = {2026},
  type = {Software},
  publisher = {GitHub},
  journal = {GitHub Repository},
  howpublished = {\url{https://github.com/birdnet-team/BioDCASE-Tiny-2026}},
}

Dataset Citation

@dataset{biodcase_tiny_2026_dataset,
  author = {Kahl, Stefan, and Martin, Ralph},
  title = {BioDCASE 2026 Task 3: Bioacoustics for Tiny Hardware Development Set},
  year = {2026},
  publisher = {Zenodo},
  doi = {10.5281/zenodo.19453065},
  url = {https://doi.org/10.5281/zenodo.19453065}
}

Acknowledgement

  • C.W. was supported by the University of Veterinary Medicine, Vienna
  • Y.B. was supported by the EU MSCA Doctoral Network Bioacoustic AI (BioacAI, 101071532)
  • T.S. and S.K. were supported by Chemnitz University of Technology

About

Development framework for the BioDCASE-Tiny 2026 competition

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Contributors

Languages