Skip to content

Sequences, streaming data, robotics, and scientific extensions · Entry index · SEQ007 · Model

SELDnet

A convolutional recurrent approach to joint sound-event detection and localization, predicting both event activity and associated directions.

Needs a data type CodeSplash doesn't load yet Component demo, not a trained model CodeSplash's own run

In CodeSplash

Running this needs images, audio, video, graphs or another data type CodeSplash doesn't load yet.

Availability
Needs a data type CodeSplash doesn't load yet
Code example
Component demo, not a trained model
Who ran it
CodeSplash's own run
CodeSplash's run
The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review, but on a different version of the code. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

A convolutional recurrent approach to joint sound-event detection and localization, predicting both event activity and associated directions. It extends audio tagging into spatial inference using multichannel spectral features; class presence alone does not locate a source.

Question / hypotheses

Which sound classes occur at each time, and from which directions do their active sources arrive? This is supervised multi-task prediction rather than a significance test; detection and localization must both be assessed.

Architecture / computational structure

Multichannel magnitude/phase features enter a shared convolutional recurrent backbone with parallel event-detection and direction-regression outputs. Joint heads associate classes with locations over time, but the output representation determines whether multiple instances of one class can be expressed.

Assumptions

Training requires time-aligned event labels and direction targets, with microphone-channel order and spatial conventions fixed. The original class-linked output design has limits for simultaneous same-class instances; later multi-track localization schemes should not be silently attributed to the original SELDnet.

Formula / computational definition

A schematic multi-task objective is L=λcBCE⁡(y,p^)+λd∑t,kytk∥dtk−d^tk∥2/∑t,kytk\mathcal L=\lambda_c\operatorname{BCE}(y,\hat p)+\lambda_d\sum_{t,k}y_{tk}\|d_{tk}-\hat d_{tk}\|^2/\sum_{t,k}y_{tk}, where yy is event activity and dd a Cartesian direction. Masking/weighting of inactive targets must match the implemented recipe.

Parameters and notation

Learned parameters: convolutional/recurrent encoder and classification/direction heads. Hyperparameters: spectral/phase representation, channel count, direction coordinates, loss balance, activity threshold, and temporal resolution. Angular errors should use normalized directions rather than treating arbitrary coordinate magnitudes as valid bearings.

Fitting, fine-tuning, and adaptation

Fit both tasks with calibrated loss scaling and then adapt the feature encoder/heads to new room or array conditions. Preserve geometry conventions and hold out rooms/trajectories. Threshold adaptation changes detection/localization tradeoffs; tune it on development recordings, not evaluation labels.

How to use and calibrate

Report localization error with detection-aware matching, event recall/precision, overlap conditions, and robustness to unseen locations. Do not compute angle error only on easy detected examples without also reporting missed events. Test channel permutation and synchronization failures explicitly.

Example application

Generate two distinct synthetic event classes at known directions and evaluate both overlap detection and angular error.

Interpretation / pitfalls

Watch out

Python: a documented SELDnet reference or custom convolutional recurrent implementation. R: reticulate for training; native vector calculations can verify angular scoring. The component example computes unit-vector angular error only and does not implement sound detection or model training.

Python and R code examples (dependencies/validation)

Python uses NumPy and the shared mse helper when called; base R uses the shared helper when called. Validation: Python component executed; R companion reviewed, not executed. Scope: the specific component described above, not the full model or its training.

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — synthetic mathematical component, not a full-model implementation

Shared setup for this chapter
import numpy as np

def mse(a,b):
    a,b=np.asarray(a),np.asarray(b)
    if a.shape!=b.shape or a.size==0:
        raise ValueError("MSE needs nonempty equal shapes")
    return float(np.mean((a-b)**2))
target=np.array([1.,0.,0.]); predicted=np.array([.9,.1,.1]); predicted/=np.linalg.norm(predicted)
result=float(np.degrees(np.arccos(np.clip(target@predicted,-1,1))))
print(result)
R

Component demo, not a trained model — synthetic mathematical component, not a full-model implementation

Shared setup for this chapter
mse <- function(a,b) {
  stopifnot(length(a)>0L, identical(dim(a),dim(b)), length(a)==length(b))
  mean((a-b)^2)
}
target <- c(1,0,0); predicted <- c(.9,.1,.1); predicted <- predicted/sqrt(sum(predicted^2))
result <- acos(max(-1,min(1,sum(target*predicted))))*180/pi
print(result)

Sources

From the CodeSplash reference, entry SEQ007.