Skip to content

Separate a signal, split a scene

Do low-rank and nonnegative factorizations recover the parts you meant, and how would you know without the simulated truth?

Notebook capstone 3~30 minadvanced Generated two-note spectrogram and 30-frame synthetic clip

The story

Two teams bring the same kind of problem. A music-practice app wants to split a recording of two overlapping notes into the notes, and a warehouse wants the moving forklifts separated from a fixed camera's background. Both are factorizations: a spectrogram as a sum of nonnegative note patterns, a clip as a low-rank background plus a sparse moving part.

Here both signals are generated in code, so the true parts are known and every claim can be checked: which fitted part matches which note, how much of the moving object lands in the sparse part, and how much background is flagged by mistake. Data type: separating sounds runs in CodeSplash on audio collections; video files stay Academy-only, so the scene part runs in the notebook only.

Data: Generated two-note spectrogram and 30-frame synthetic clip · Simulated. Generated in the notebooks (ML reference, audio NMF and video robust-PCA workflows).

Stage 1 · notebooks · ~15 min

Split two notes with NMF

Factor the spectrogram into two nonnegative parts, then match each true note to its most similar fitted template and activation, because NMF returns its parts in no particular order.

How well does each fitted part match a note, and why did the matching have to be by similarity?

Notebook exercise: Split two notes with NMF. Factor a synthetic magnitude spectrogram of two overlapping notes into spectral templates and activations, and check each part against the note it should be. 3 checks in Python or R.

Stage 2 · notebooks · ~15 min

Split a scene into background and motion

Split the clip into a low-rank background and a sparse moving part with robust PCA, then count the object pixels it finds and the background pixels it flags by mistake.

How much of the moving square does the sparse part find, and what does it flag that isn't moving?

Notebook exercise: Split a scene into background and motion. Separate a synthetic clip into a low-rank background and a sparse moving object with robust PCA, then count what it finds and what it wrongly flags. 3 checks in Python or R.

Hints
  • Factorizations return parts in an arbitrary order; match them to the truth by similarity.
  • Recall looks only at the true object pixels; the false-flag rate looks only at the background.
  • Both methods have assumptions (nonnegative parts, a still camera); say what breaks them.

brief

What factorization can and can't separate

Write a one-page brief for both teams: what each factorization recovered in the simulation, how you checked it, the assumptions behind each, and what to check on their real data.

  1. Two notes
  2. A still scene
  3. How we checked
  4. Assumptions and next checks
Rubric
CriterionPoints
Reports the template and activation matches and explains the matching by similarity.2
Reports recall on the object and the false-flag rate on the background.2
Names each method's assumptions (nonnegative additive parts; still camera, small moving part).2
Says audio separation runs in CodeSplash while video stays Academy-only.1
Proposes a check for real data where the truth is unknown.1

Model answer

Show the model answer

Two notes. Two nonnegative parts rebuild the spectrogram closely. Matching each true note to its most similar fitted template gives near-perfect cosines for both notes, and the activations line up with when each note plays, even where the notes overlap. The matching had to be by similarity: NMF returns its parts in an arbitrary order and has no idea which is which.

A still scene. Robust PCA puts the drifting background in a single low-rank direction and almost every pixel of the moving square in the sparse part, flagging about one background pixel in a hundred by mistake, mostly where sensor noise is large.

How we checked. Both signals were generated in code, so the true parts were known; on real data that truth is missing.

Assumptions and next checks. NMF assumes the sound adds up from nonnegative patterns; robust PCA assumes a still camera and a small moving part, so a pan or a lighting jump breaks it. On real data, check against a few hand-labeled frames or recordings with known stems, and check stability across starts and settings. In CodeSplash, Separate sounds with NMF runs on audio collections; video files stay in the Academy.