nemo_curator.stages.audio.postprocessing.sed_postprocessing
nemo_curator.stages.audio.postprocessing.sed_postprocessing
SED Postprocessing stage: label audio entries with detected sound events.
Reads the per-frame probability matrix from task data (in-memory, preferred) or from an NPZ sidecar file (fallback), then detects events for each sound class group (speech, music, noise, etc.) using thresholding. The detected events are added as labels to the task data — no filtering or segmentation is performed.
Requires: pip install numpy (scipy optional for smoothing)
Module Contents
Classes
API
Bases: ProcessingStage[AudioTask, AudioTask]
Label audio entries with detected sound events from SED framewise output.
Reads framewise data from task data (in-memory _sed_framewise key,
preferred) or falls back to reading from NPZ file (npz_filepath key).
For each sound class group in SUPERCLASS_GROUPS (speech, music, noise,
etc.), aggregates probabilities, converts to events via thresholding, and
stores all detected events as sed_events on the output task.
This is a labeling stage — the task passes through with event labels attached, no filtering or fan-out is performed.
Parameters:
Aggregation mode for class groups. Default "noisy_or".
Probability threshold for event detection. Default 0.4.
Minimum event duration. Default 0.3.
Median filter window in seconds (0 = disabled).
Low threshold for hysteresis (None = simple threshold).
High threshold for hysteresis (None = simple threshold).
Merge events with gaps smaller than this (0 = disabled).
If True, aggregate probabilities per superclass group
(noisy-or across member class indices) and emit one event series per
superclass (e.g. "speech", "music"). Default False.
When False (default), every AudioSet class index is thresholded
independently; each event carries label (e.g. "electric_guitar")
and superclass (e.g. "music").
Key in task data for in-memory framewise array. Default "_sed_framewise".
Key in task data for NPZ path (fallback). Default "npz_filepath".
Key for output events list. Default "sed_events".
Detect events for all SUPERCLASS_GROUPS and return a merged, sorted list.