Skip to content

F0 network weights: s8_ft (current)

Latest

Choose a tag to compare

@KasparP KasparP released this 03 Dec 12:19
· 4 commits to main since this release
1fae4c3

Trained weights of the SLAP2 F0 network (s8_ft). It predicts the baseline fluorescence (F0) and per-frame noise SD (/sd) of every valid pixel and frame of a registered 80 Hz SLAP2 movie.

file model sha256
slap2_f0_s8_ft.pt s8_ft, the current model (locked in 2026-12-03): enc_v2 Stage-2 step 800, with the per-trial registration statistics encoder (--stats_width 24: Campbell cumulant, sample-count and 8-frame shared-mode SVD maps), valid-frame branch masking, pre-convolution half-plane modulation, quiet-weighted surround pooling, and sub-pixel alignment blur features c7b17ed845d92c5aa5ffe79db7b815c80d65c6e210c35793a31dba1e9b48df22

Earlier models remain available on release s7_ft (s7_ft for recordings without <stem>_REGSTATS-80Hz.h5 sidecars or to reproduce earlier runs, and s6_ft).

slap2_f0_s8_ft.pt holds only the weights, the model configuration and the window settings (no optimizer state), loads with torch.load(path, weights_only=True), and is 2.2 MB (507,276 parameters). SHA256SUMS lists its checksum: run sha256sum -c SHA256SUMS.

Performance of s8_ft versus earlier models

On held-out GFP ground truth without activity, s8_ft eliminates the systematic 1.7% (s7_ft) and 2.2% (s6_ft) baseline underestimation—landing within 0.14–0.17% of the true mean—and more than triples s7_ft's 8-frame baseline tracking gain over the static mean image (-0.86% MSE change vs -0.27% for s7_ft and -0.08% for s6_ft). By reading per-trial registration statistics (*_REGSTATS-80Hz.h5) and frame-by-frame sub-pixel motion blur, s8_ft keeps quiet-frame noise calibrated (z_var = 0.996 on GFP, 0.972 on held-out sensor mice) while cutting spurious event-induced variance inflation threefold (+5.3% on event frames vs +15.3% in s7_ft and +14.6% in s6_ft). Where events are injected, s8_ft does not follow event time courses (+0.5% slope) and absorbs +16.1% of mean added activity into the static baseline level—slightly less than s7_ft (+17.4%) and nearly half of an identically trained control model without the statistics encoder (+31.0%), whereas s6_ft erred in the opposite direction (-8.4%). On held-out iGluSnFR4f recordings, s8_ft matches s7_ft on unmasked labeled dendrite (4/8 mice each: 2/4 held-out test mice and 2/4 validation mice) and improves dim activity-free support (-30.0% vs -24.2%), with two practical caveats: like earlier models it still absorbs roughly half the mean shift of very weak (1–2%) sources, and it requires *_REGSTATS-80Hz.h5 sidecars (s7_ft remains available when they are absent).

What it is built for

Use s8_ft only on recordings that match all of these:

  • Recordings: SLAP2 multi-ROI raster recordings of iGluSnFR4f, registered at 80 Hz (*_REGISTERED_DOWNSAMPLED-80Hz) with per-trial registration statistics sidecars (*_REGSTATS-80Hz.h5, written automatically by giant register or added to earlier registrations by giant reg-stats). For movies without *_REGSTATS-80Hz.h5, use s7_ft.
  • Blind window: the baseline at a pixel and frame never sees that pixel or its neighbours within 4 rows and columns in the 8 frames on either side (17 frames, ±100 ms). Slower indicators whose events outlast that window need their own model (#32).
  • Context: 263 frames (3.3 s) on each side, and 27 pixels in space (ModelConfig.spatial_reach = 27).

Use

slap2-f0 predict-registered MOCO_DIR --ckpt s8_ft --out DIR --sd --fast
giant silo TABLE --f0-ckpt "$(slap2-f0 checkpoint s8_ft)"

--ckpt s8_ft downloads the file once into $SLAP2_F0_CKPT_CACHE (default ~/.cache/slap2_f0/checkpoints), checks its SHA-256 and reuses the cached file; slap2-f0 checkpoint s8_ft prints the cached path.

Ground-truth and held-out metrics

Scored on held-out trials (trials 4 & 5, 4 trial-paths, 216 sources, 48 displaced controls) of a GFP control recording (no glutamate signal) with known injected events (tools/injection_invariance.py), reported as s6_ft / s7_ft / s8_ft:

  • Baseline below the uninjected truth (orig): +2.18% / +1.69% / -0.14% at sources (+2.19% / +1.69% / -0.17% at controls).
  • 8-frame MSE vs the trial mean image on uninjected GFP (orig, all pixels): -0.08% / -0.27% / -0.86% (noise calibration z_var = 0.996).
  • Activity leak (share of mean injected activity absorbed into the baseline): -0.084 / +0.174 / +0.161 (+0.005 temporal event following; +0.014% baseline change at uninjected controls).
  • Event-invariance of predicted noise variance (/sd variance ratio, copy / original; 1.000 = invariant, naive photon scaling = 1.867): 1.146 / 1.153 / 1.053 on event frames (1.134 / 1.141 / 1.042 on quiet frames) — a threefold reduction in spurious event-driven noise inflation.

Details, training runs (ctrl vs enc_v2) and 8-mouse held-out sensor evaluations (tools/trusted_scores.py) are in docs/plan.md (section S8).

The weights are released under this repository's MIT licence.