Repository navigation
DynaCell 2D: FNet-2D VSCyto2D-aug baseline, lite predicts, and a new-channel tutorial - #541
Draft
alxndrkalinin wants to merge 10 commits into
Draft
alxndrkalinin wants to merge 10 commits into
alxndrkalinin wants to merge 10 commits into
Conversation
The 2D counterpart of the fnet3d_bigpatch / fnet3d_vscyto3daug ablation. FNet3D trained with a 384x384 patch and the VSCyto3D augmentations works out of domain where vanilla FNet fails, and no 2D FNet had been trained that way: every fnet2d fit uses 64x64 patches and flips only. - fnet2d_bigpatch: 384x384 patch, fnet2d's flips (isolates patch size). - fnet2d_vscyto2daug: the same plus the VSCyto2D GPU augmentation stack, verbatim from fcmae_vscyto2d_fit.yml, from a 600x600 CPU crop (isolates the augmentations). Both keep fnet2d's batch 48, store, normalization, model, optimizer, 32-true precision and 200k steps, and take no speed flags (2D FNet leaves are pinned flags-off). Nucleus, iPSC-trained, phase input. Tests pin the arm-vs-arm and arm-vs-fnet2d differences. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzpgExfYMKCgogfnhcSgDc
… bf16 The arms are the new 2D FNet baseline for fast iteration on phase reconstructions, so they take trainer.benchmark, channels_last and bf16-mixed. Measured on an A40 (aug arm, steps 90-158): 1.216 s/step without flags at 32-true, 1.162 with the flags, 0.492 with flags plus bf16-mixed; peak memory 27.9 -> 11.7 GB. MSE loss is unaffected by the bf16-SSIM cancellation issue, and the 3D pair already trains at bf16. Both arms keep identical settings so they stay paired. The speed-flag test lists the two models as 2D leaves that opt into the flags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzpgExfYMKCgogfnhcSgDc
Phase-reconstruction variants trained on this baseline need a seed-to-seed spread to beat on the lite test set; a second draw gives it. The leaf is the baseline with seed_everything: 1 and its own run tree. The speed-flag test now matches the 2D FNet models by prefix so the seed draw and per-reconstruction variants inherit the flags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzpgExfYMKCgogfnhcSgDc
…nels Phase reconstructions (e.g. waveorder outputs) arrive as separate plates whose phase channel is named Phase3D like the existing one. Training needs them next to Phase3D (the focus-slab anchor) and the target in one store, and the registered stores must stay untouched. assemble_channel_store.py copies kept channels (and their normalization stats) from a base store and adds renamed channels from other stores, refusing a (T, Z, Y, X) or position mismatch, duplicate channel names and an existing output. Added channels get stats from viscy preprocess. Checked on 3 lite FOVs: the added and kept channels equal their sources bitwise and the scale is preserved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzpgExfYMKCgogfnhcSgDc
…aseline Both seeds of fnet2d_vscyto2daug predict the iPSC lite test set and the three A549 h2b lite conditions on the focus2d slab only, using new lite plane files built with precompute-gt build.focus_planes (the full A549 files have 10 timepoints against 5 in the lite stores). These are the baselines every phase-reconstruction variant is compared against. Submit with --ckpt best. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzpgExfYMKCgogfnhcSgDc
…nnels Step-by-step guide for iterating on phase reconstructions: assemble a train store with the new channel (assemble_channel_store, viscy preprocess, extract_focus_slab_store), write a per-reconstruction variant of the fnet2d_vscyto2daug leaf, launch it, predict on DynaCell-lite with the lite plane files, and score the fast metric tier. Every command was run once on an A40 (2026-11-17) unless marked; the fast eval reproduced the full-benchmark 2D eval on the same FOVs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzpgExfYMKCgogfnhcSgDc
All input and output stores now close through one ExitStack, and the tool no longer writes an empty normalization attribute when no base channel is kept, so viscy preprocess starts from a clean store. Output chunks take one channel per chunk regardless of the base chunking. Verified as the tutorial runs it: the 50-FOV lite test store predicts bitwise-identically to the registered store, and the 8-FOV train store slabs equal production cell_focus.zarr bitwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzpgExfYMKCgogfnhcSgDc
Re-ran the store-assembly steps exactly as written and updated their checks and timings. Adds a section on new datasets and target channels (single-plane eval flags, direct io.* paths, compute_pixel_metrics for PSNR/FRC only), pins the GPU type for predicts, moves resolved configs off node-local /tmp, and marks what was not run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzpgExfYMKCgogfnhcSgDc
… scores The guide's "5-plane train store" read as if the 2D model trains on a 5-plane input. It trains on one plane per sample drawn from the in-focus plane +/-2, predicts the 3-plane slab, and scores the single GT-anchored focus plane. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzpgExfYMKCgogfnhcSgDc
The first 200k-step fnet2d_vscyto2daug fits reached their minimum validation loss at step 3818 (seed 0) and 2158-2988 (seed 1), about 2% of the budget, then rose 12% by step 36k while training loss kept falling. At 384^2 x batch 48 each step carries 36x the pixels of fnet2d's 64^2 patches, so fnet2d's 200k-step budget is far too long. 20k steps is about 5x the best step (~1.7 h on an A100). The running baseline fits keep 200k (their resolved configs are fixed); with a constant learning rate their best checkpoints compare directly with 20k-step variants. The tutorial explains the budget. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzpgExfYMKCgogfnhcSgDc
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A 2D FNet baseline built for fast iteration, and a tutorial so a new user can plug in a new source channel (e.g. a waveorder phase reconstruction from brightfield), train, predict on DynaCell-lite and score it.
fnet2d_vscyto2daug: 384² patch with the VSCyto2D augmentation stack copied verbatim.fnet2d_bigpatch: the same patch with flips only. This config is kept but not trained.trainer.benchmarkandchannels_last. Measured on an A40: 1.216 s/step with no flags at fp32, 1.162 with flags, 0.492 with flags + bf16; peak memory 27.9 → 11.7 GB.fnet2d. The speed-flag test matches 2D FNet models by name prefix, so per-reconstruction variants inherit the flags.fnet2d_vscyto2daug_seed1: a second draw of the baseline, which gives the seed-to-seed spread a reconstruction must beat.precompute-gt build.focus_planes.tools/assemble_channel_store.py(with tests): builds a new store from kept base channels plus renamed channels from other stores. It refuses mismatched shapes or positions, duplicate channel names and an existing output.applications/dynacell/docs/2d-virtual-staining-tutorial.md: the step-by-step guide, linked from the dynacell README.Verification
Each step in the tutorial was run once on an A40 (2026-11-17); untested steps are marked (not run) in the doc.
fnet2dnucleus checkpoint on the same FOVs: pixel metrics within 5e-4 per FOV, Dice within 1e-3, mean mAP within 0.003. Scoring takes about 2.5 min per test set and predicting under 1 min.Phase3Ditself as the stand-in for a reconstruction, the store built withassemble_channel_store.pyandviscy preprocesspredicts bitwise-identically to the registered store (max abs diff 0, 50 FOVs).assemble_channel_store.py,viscy preprocessandextract_focus_slab_store.py, the slabs equal productioncell_focus.zarrbitwise on 8 FOVs. A 40-step fit from a variant config ran with bf16 and both flags.test_benchmark_config_composition,test_submit_benchmark_{job,batch},test_bake_best_ckpt,test_cli_routing,test_evaluate_compose,generate_lite_benchmark_configs_test,generate_grouped_eval_configs_testandassemble_channel_store_test.Running
The baseline fits are running from this branch: 38159918 (seed 0) and 38159930 (seed 1). Their lite predicts and evals are chained to run when the fits finish.
🤖 Generated with Claude Code
https://claude.ai/code/session_01MzpgExfYMKCgogfnhcSgDc