animal2vec workshop · MPIABDay 2 · 14:15–15:00
Beyond the label
What an embedding is—and what it is not.
Julian C. Schäfer-Zimmermann
Max Planck Institute of Animal Behavior
Department for the Ecology of Animal Societies
Communication and Collective Movement (CoCoMo) Group
animal2vec workshop · MPIABDay 2 · 14:15–15:00

A representation is not a prediction

Embeddings

[T, D]
T time positions; D learned features.
Useful for comparison and downstream analysis.

Label scores

[T, C]
The same T positions; C trained labels.
Useful for the supervised detection task.

The baseline has 1,024 feature dimensions. So, for 1s of audio, using the default settings, we get 200 1,024 dimensional vectors. This is a very high-dimensional space to explore.
animal2vec workshop · MPIABDay 2 · Introduction to embeddings

What is an embedding?

Audio over time

Current segment: noise 0–5 ms · frame 1 / 90

2D view of embedding space

One point per frame
dimension 1 dimension 2
noisecall_A call_Bcurrent frame

Interpretation

An embedding is a learned vector representation of a sound in context.

Current 5 ms bin

Regionnoise Point(0.0, 0.0)

This frame is in the noise region.

Animation controls

Slowed for teaching
Jump to

Synthetic illustration, not model output.
Real embeddings are high-dimensional.

animal2vec workshop · MPIABDay 2 · Introduction to embeddings

Pretrained vs fine-tuned embeddings

Audio over time

Current segment: noise 0–5 ms · frame 1 / 90

2D view of embedding space

Pretrained
visualization axis 1 visualization axis 2
noisecall_A call_Bcurrent frame

Animation controls

PlaybackSlowed for teaching
Jump to

Current 5 ms bin

Example labelnoise Plotted point(0.0, 0.0)

Switch models to compare this same frame.

Synthetic comparison, not measured embeddings.
Clean clustering is illustrative, not guaranteed.

animal2vec workshop · MPIABDay 2 · Introduction to embeddings

What should one point represent?

Audio over time

Current segment: call_A

Frame vectors and their summaries

Temporal mean
feature 1 feature 2
noisecall_Acall_Bsummary

Choose the unit

90 frame vectors[90, D]

Jump to

Synthetic 2D vectors; real data have D features.
One mean per interval, not a new model prediction.

[T, D] → choose intervals → one D-dimensional vector per interval05 / C
animal2vec workshop · MPIABDay 2 · Introduction to embeddings

Many frames, one summary vector

Audio over time

2D toy embedding space

feature 1 feature 2
noisecall_Acall_Bsummary

Choose the aggregation

Synthetic vectors · for real data, pool in D dimensions before plotting05 / D
animal2vec workshop · MPIABDay 2 · 14:15–15:00

What the built-in a2v routine returns

Attribute Shape / type Meaning
result.embeddings [T, D] Layer-averaged frame representations
result.probabilities [T, C] Independent sigmoid label scores
result.timestamps [T] Frame-center times in recording seconds
result.events Tuple of intervals Pooled, thresholded, fused predictions

Arrays are returned as CPU tensors. Exact T comes from the audio geometry and endpoint trimming.

animal2vec workshop · MPIABDay 2 · 14:15–15:00

Extract all three aligned arrays in one pass

from a2v2 import InferenceRunner
from a2v2.data import load_audio

runner = InferenceRunner("MODEL.native.pt")
waveform, sample_rate = load_audio("AUDIO.wav")
result = runner.run_tensor(waveform, sample_rate)

Z = result.embeddings.numpy()    # [T, D]
t = result.timestamps.numpy()    # [T], seconds
p = result.probabilities.numpy() # [T, C]
e = result.events                # [(S1, E2), ...] Tuple of intervals

Use the provided native frame checkpoint. Replace the two illustrative filenames.