Skip to content
intermediateaudio

DCASE Few-Shot Bioacoustic Event Detection

Mark every meerkat call of one class in ten real DCASE 2022 Task 5 windows, using a spectrogram, released pre-annotations, and hf-audio-tagger training.

Get This Design

View on GitHub(opens in a new tab)

Clone or download from the repository

Quick start:

bash
git clone https://github.com/davidjurgens/potato-showcase.git
cd potato-showcase/audio/bioacoustics/dcase-few-shot-bioacoustic-events
potato start config.yaml

About this dataset

DCASE 2022 Task 5 asks for few-shot bioacoustic event detection. A system receives one long field recording and the onset and offset times of the first five events of one class of interest, and has to find every other event of that class. Inês Nolasco, Dan Stowell, and colleagues released the development set on Zenodo under CC BY 4.0 with 192 audio files from several taxa. The training set has 174 recordings (21 hours, 47 classes, 14,229 events) and the validation set has 18 recordings (5 hours and 57 minutes, 5 classes, 1,077 events). The paper in Ecological Informatics (2023) describes the task and the 14 datasets across the challenge.

In the released annotation files, each row gives a start time, an end time, and a label. Validation files carry one class of interest per recording with POS or UNK, and training files carry POS, NEG, or UNK for each class. UNK marks events the annotators were unsure about, and the evaluation excludes the UNK regions. The protocol fixes the five shots as the first five POS events, and the metric ignores everything before the end of the fifth. The design uses two meerkat recordings from the validation set (ME1, move calls, and ME2, alarm calls). Each item plays a clip with the five shots, then a window of the same recording that starts after the fifth shot. The released POS and UNK segments for that window are loaded as pre-annotations, so annotators check the segments, fix the segment edges, and add missed calls. One window contains no event. The segments have times only, because the dataset marks no frequency bounds, and the design has no NEG label because the validation files do not use one.

The model_training block turns on training and writeback. The hf-audio-tagger trainer is chosen on the /admin/training page and fine-tunes a wav2vec 2.0-style speech encoder on the confirmed segments. Each 20 millisecond frame is labeled POS, UNK, or neither. Predictions are written only onto windows outside the training split, where the predictions replace the dataset segments loaded into the same predictions field. The trainer is a conventional supervised tagger, not the prototypical-network few-shot method of the paper, and the trainer does not use the five shots as a support set. Ten windows from two recordings show the loop and are not enough to train a useful detector.

Audio files (development set)
192
Training set
174 recordings, 21 hours, 47 classes, 14,229 events
Validation set
18 recordings, 5 hours 57 minutes, 5 classes, 1,077 events
ME subset used here
2 recordings, 20 minutes, 73 annotated events (62 POS, 11 UNK)
Shots per recording
first 5 POS events
License
CC BY 4.0

Configuration File

This Potato config reproduces the annotation task. Save it as config.yaml and run potato start config.yaml to try it.

yaml
# yaml-language-server: $schema=https://potatoannotator.readthedocs.io/en/latest/schemas/potato-config.schema.json
# DCASE 2022 Task 5, few-shot bioacoustic event detection: find every call of
# one class after hearing five examples.
#
# Dataset: "DCASE 2022 Task 5: Few-shot Bioacoustic Event Detection Development
#   Set" (Nolasco, Singh, Strandburg-Peshkin, Gill, Pamula, Morford, Emmerson,
#   Jensen, Whitehead, Kiskin, Vidana-Vila, Lostanlen, Morfi, Stowell), Zenodo,
#   version 3. Data: https://zenodo.org/records/6482837
#   (DOI 10.5281/zenodo.6482837), CC BY 4.0.
# Task:    https://dcase.community/challenge2022/task-few-shot-bioacoustic-event-detection
# Paper:   Ecological Informatics 77, 102258, 2023. DOI: 10.1016/j.ecoinf.2023.102258
#   @article{Nolasco_2023,
#     title   = {Learning to detect an animal sound from five examples},
#     volume  = {77}, journal = {Ecological Informatics}, publisher = {Elsevier BV},
#     author  = {Nolasco, Ines and Singh, Shubhr and Morfi, Veronica and
#                Lostanlen, Vincent and Strandburg-Peshkin, Ariana and
#                Vida{\~n}a-Vila, Ester and Gill, Lisa and Pamu{\l}a, Hanna and
#                Whitehead, Helen and Kiskin, Ivan and Jensen, Frants H. and
#                Morford, Joe and Emmerson, Michael G. and Versace, Elisabetta and
#                Grout, Emily and Liu, Haohe and Ghani, Burooj and Stowell, Dan},
#     year    = {2023}, month = nov, pages = {102258},
#     DOI     = {10.1016/j.ecoinf.2023.102258}}
# Media:   twelve short MP3 excerpts in media/ are cut from the dataset's own
#   validation recordings ME1.wav and ME2.wav (meerkats) and are real. They are
#   CC BY 4.0; see media/LICENSE-media.txt for the attribution.
#
# The few-shot protocol, quoted from the paper (section 2.1) and the DCASE task
# page:
#   "Given one long audio recording (or multiple audio recordings), as well as
#   annotations on the onset and offset time for each of the first five sound
#   events of interest, identify the onset and offset times for all other such
#   sound events in the recording(s)."
#   "Participants must treat the task as a 5-shot setting and only use the first
#   five POS annotations for the class of interest for each file, when trying to
#   predict the rest."
#   "Each audio file should be treated separately of the rest, as there is
#   possible overlap between the classes of the evaluation set across different
#   audio files."
#   "Participants should keep in mind that our evaluation metric ignores
#   anything before the end time of the fifth positive event, hence using
#   randomly selected events from the validation set may lead to incorrect
#   performance values."
#
# Label glossary (paper section 2.2, task page):
#   POS  a positive example of the class of interest for this recording.
#   UNK  unknown: "where the human annotator(s) were unsure whether a sound event
#        should be considered in the positive class". Evaluation excludes UNK
#        time regions, because "their correct label is ambiguous".
#   NEG  a negative example (background or non-target event). The released
#        training set carries POS, NEG and UNK per class. The validation files
#        used here carry only POS and UNK for one class of interest, so this
#        design has no NEG label.
# The class of interest per file comes from DCASE2022_task5_Validation_set_classes.csv
# in the same record (ME1 is "Meerkat move call", ME2 is "Meerkat alarm call").
#
# Adaptations:
#   - The dataset has 18 validation recordings (hours long) and 174 training
#     recordings. This sample uses two meerkat validation recordings, ME1 and
#     ME2, cut into ten windows of 30 to 42 seconds, each re-encoded as 64 kbps
#     mono MP3. The windows are chosen to hold POS events, UNK events, or (item
#     dcase_002) no event at all.
#   - Counts and sampling rate. ME1.csv and ME2.csv hold 73 rows (62 POS and
#     11 UNK), although the DCASE task page labels 73 as events "excl. UNK".
#     The ME files are 48 kHz mono, 24-bit (read from the WAV headers, and the
#     task page gives 48000 Hz), while the paper's text gives 44.1 kHz for the
#     ME66 microphone. This design follows the files.
#   - Author name: Crossref and Zenodo spell it "Ines Nolasco" (kept in the
#     BibTeX below), while the paper's title page spells it "Inês Nolasco".
#   - Each window starts after the end of the fifth POS event of its recording
#     (13.2 s in ME1, 7.9 s in ME2). The "shots" are a separate clip, played above
#     the waveform, that holds exactly those five events. The paper also
#     says a system may assume the periods between the first five examples are
#     negative.
#   - The dataset's released POS and UNK segments for each window are loaded as
#     pre-annotations (pre_annotation), so annotators check and correct them.
#     Times are shifted to the window start. The original task asks a system, not
#     a person, to produce them. No event crosses a window edge.
#   - Segments are start and end times only, because the dataset marks no
#     frequency bounds (the annotation files have Starttime, Endtime and the
#     class column).
#
# Run from this folder:
#   potato start config.yaml -p 8000
#
# Training (optional). The hf-audio-tagger trainer consumes audio_annotation
# segments (pip install 'potato-annotation[train-audio]'). It fine-tunes a
# wav2vec 2.0-style speech encoder to say, for each frame of about 20 ms, which
# labels are active. Predictions are written only onto windows outside the
# training split, where they replace the dataset segments loaded into the same
# predictions field. It reads local audio files, which is
# why the excerpts ship in media/. A stretch nobody marked counts as "no label
# here", which suits a window where every event is marked and is wrong for a
# file where only the first five events were marked. The windows here are fully
# marked after the shots, so the rule holds. The trainer does not implement the few-shot method of the paper (a prototypical network), does
# not use the five shots as a support set, and does not serve or deploy the
# model. Twenty minutes of two recordings are a demonstration, not enough to train
# a useful detector. Open /admin/training with the key below, pick hf-audio-tagger
# and the events scheme, and click Train now. The base model is a public
# Hugging Face model downloaded on first use.
port: 8000
annotation_task_name: "DCASE 2022 few-shot bioacoustic events: meerkat calls"
task_dir: "."
output_annotation_dir: "annotation_output"
export_annotation_format: jsonl
data_files:
  - "sample-data.json"
item_properties:
  id_key: id
  text_key: audio_url

require_password: false
admin_api_key: "demo-admin-key"

user_config:
  allow_all_users: true
  users: []

instance_display:
  fields:
    - key: class_of_interest
      type: text
      label: "Class of interest (the only class to mark)"
    - key: support_audio
      type: audio
      label: "The five shots (first five POS events of this recording)"
    - key: window
      type: text
      label: "Window to annotate"

pre_annotation:
  enabled: true
  field: predictions
  allow_modification: true

annotation_schemes:
  - annotation_type: audio_annotation
    name: events
    description: "Listen to the five shots, then mark the start and end of every other event of the class of interest in the window. Use POS when the sound is a call of that class and UNK when you are unsure."
    mode: label
    source_field: audio_url
    labels:
      - name: POS
        color: "#16a34a"
        key_value: "1"
      - name: UNK
        color: "#d97706"
        key_value: "2"
    zoom_enabled: true
    playback_rate_control: true
    spectrogram: true
    spectrogram_options:
      frequency_range: [0, 8000]
      color_map: viridis

annotation_instructions: "Each recording has one class of interest, named above the player. Play the five shots to learn the sound, then mark every other event of that class in the window with POS. Mark a sound UNK when you cannot tell whether it belongs to the class. Other sounds are background and are not marked. The five shots themselves are not in the window."

model_training:
  enabled: true
  writeback:
    schemas: ["events"]
    include_unlabeled: true
    min_confidence: 0.5

Sample Data

json
[
  {
    "id": "dcase_001",
    "audio_url": "/media/ME1_014s.mp3",
    "support_audio": "/media/ME1_shots_000s.mp3",
    "class_of_interest": "Meerkat move call",
    "recording": "ME1",
    "window_start_s": 14,
    "predictions": {
      "events": {
        "segments": [
          {
            "start_time": 3.963,
            "end_time": 4.215,
            "label": "POS"
          },
          {
            "start_time": 5.398,
            "end_time": 5.671,
            "label": "POS"
          },
          {
            "start_time": 14.83,
            "end_time": 15.123,
            "label": "POS"
          },
          {
            "start_time": 15.527,
            "end_time": 15.811,
            "label": "POS"
          },
          {
            "start_time": 17.171,
            "end_time": 17.376,
            "label": "POS"
          },
          {
            "start_time": 18.316,
            "end_time": 18.567,
            "label": "POS"
          },
          {
            "start_time": 28.612,
            "end_time": 28.727,
            "label": "UNK"
          }
        ]
      }
    },
    "window": "Recording ME1, 14 s to 46 s (the five shots end at 13.2 s). Segment times below start at 0 at the window start."
  },
  {
    "id": "dcase_002",
    "audio_url": "/media/ME1_100s.mp3",
    "support_audio": "/media/ME1_shots_000s.mp3",
    "class_of_interest": "Meerkat move call",
    "recording": "ME1",
    "window_start_s": 100,
    "predictions": {
      "events": {
        "segments": []
      }
    },
    "window": "Recording ME1, 100 s to 130 s (the five shots end at 13.2 s). Segment times below start at 0 at the window start."
  }
]

// ... and 8 more items

Dataset & paper

Nolasco et al., Ecological Informatics 2023

Paper DOI
10.1016/j.ecoinf.2023.102258
Dataset DOI
10.5281/zenodo.6482837

Citation (BibTeX)

bibtex
@article{Nolasco_2023,
  title = {Learning to detect an animal sound from five examples},
  volume = {77},
  ISSN = {1574-9541},
  url = {http://dx.doi.org/10.1016/j.ecoinf.2023.102258},
  DOI = {10.1016/j.ecoinf.2023.102258},
  journal = {Ecological Informatics},
  publisher = {Elsevier BV},
  author = {Nolasco, Ines and Singh, Shubhr and Morfi, Veronica and Lostanlen, Vincent and Strandburg-Peshkin, Ariana and Vidaña-Vila, Ester and Gill, Lisa and Pamuła, Hanna and Whitehead, Helen and Kiskin, Ivan and Jensen, Frants H. and Morford, Joe and Emmerson, Michael G. and Versace, Elisabetta and Grout, Emily and Liu, Haohe and Ghani, Burooj and Stowell, Dan},
  year = {2023},
  month = nov,
  pages = {102258}
}

Details

Annotation Types

audio_annotation

Domain

bioacousticsecology

Use Cases

few-shot sound event detectionanimal call detectionbioacoustic event annotation

Tags

dcase few-shot bioacoustic event detectiondcase 2022few-shotbioacousticsmeerkatsound event detectionaudio annotationpassive acoustic monitoring

Found an issue or want to improve this design?

Open an Issue(opens in a new tab)