Skip to content

feat(dynacell): add dynacell-stain-{predict,train,eval} agent skills - #545

Draft
alxndrkalinin wants to merge 6 commits into
mainfrom
dynacell-stain-skills
Draft

alxndrkalinin wants to merge 6 commits into
mainfrom
dynacell-stain-skills

Conversation

@alxndrkalinin

@alxndrkalinin alxndrkalinin commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds three agent skills, dynacell-stain-predict, dynacell-stain-train and dynacell-stain-eval, for virtual staining with DynaCell, written for import into Biohub MCP. They follow the layout of the embed and phenotype skills in #540.

Skill Use Command
dynacell-stain-predict Predict organelles from Phase3D with released checkpoints (FNet3D, VSCyto3D/UNeXt2, CELL-Diff) or a user-trained one, on public DynaCell data or the user's own OME-Zarr dynacell predict -c predict.yml
dynacell-stain-train Train FNet3D or CELL-Diff on one GPU, on public DynaCell training archives or the user's paired data dynacell fit -c fit.yml
dynacell-stain-eval Score predictions against fluorescence: pixel metrics, segmentation masks, instance AP for nucleus and membrane dynacell evaluate ..., dynacell report ...

The PR contains Markdown and JSON only, with no code changes. It does not depend on #540, because these skills use fit, predict and evaluate, which are already on main.

Decisions for reviewers

  1. Evaluation scope. dynacell-stain-eval covers pixel and mask metrics, plus instance AP for nucleus and membrane. The feature tier (CP, DINOv3, DynaCLR and CellDINO distances, KID/FID) needs a cell segmentation store, CP reference statistics and checkpoints that aren't public, so the skill tells agents to pass compute_feature_metrics=false. The roadmap's "fidelity, biology, utility" needs those released first.
  2. Training is included (dynacell-stain-train), although the roadmap's v1 list has only stain, embed, phenotype and eval stain.
  3. Names. The skills are dynacell-stain-predict, dynacell-stain-train and dynacell-stain-eval, one command family read as "dynacell stain predict / train / eval". Skill names allow only lowercase letters, digits and hyphens, hence the hyphens. feat(dynacell): add embed and phenotype skills and commands #540's embed and phenotype would need the same prefix for the family to be consistent.
  4. Model registry. The roadmap's registry.json doesn't exist yet, and the Hugging Face checkpoint repo is private. The skills therefore read checkpoints from the public s3://dynacell/v1/models/ and its checkpoints.csv. They can switch to the registry once it is published.
  5. Families. UNetViT3D and Pix2Pix3D checkpoints are released, but no configuration for them was verified, so dynacell-stain-predict declares them out of scope. VSCyto2D is not in the public release.
  6. Checkpoint advice. "Choosing a checkpoint" in dynacell-stain-predict recommends VSCyto3D first, and joint when the user is unsure of their domain. That is a judgement call, not a benchmark result; please confirm it or replace it with the paper's ranking.

Verification

All of the following ran at runtime commit b67a38b0 (current main) on one 48 GB A40. Each run used a fresh worktree with its own venv from the documented uv sync --locked --package dynacell --extra eval --extra eval_gpu command, and read the public data and checkpoints without modifying them.

  • Install: the locked sync succeeded cold, with an empty HOME and no credentials.
  • dynacell-stain-predict: each predict block in references/configs.md is identical to the config that ran on test/SEC61B_mock.ozx, apart from paths.
    • FNet3D and VSCyto3D match the internal DynaCell evaluation of the same checkpoints on all 120 FOV x timepoint volumes (mean PCC 0.7261 and 0.7308; max difference 6e-6).
    • CELL-Diff with the fast sampler matches on the mean (0.705 vs 0.707 over 10 volumes).
    • The check catches a wrong normalization: FNet3D with CELL-Diff's normalization lost 0.34 PCC.
  • Own data: a plain two-FOV .zarr written with iohub, with no statistics, failed predict as expected (KeyError: 'norm_meta'). After viscy preprocess it gave VSCyto3D predictions with voxel PCC > 0.9999 against the archive run. Copying the archive's statistics into the store made the output bit-identical.
  • dynacell-stain-train:
    • FNet3D ran 20 steps with validation and checkpointing (19 GB of GPU memory).
    • The CELL-Diff block from the skill also ran 20 steps with TensorBoard logging and checkpointing. One patch per step used 31 GB; two patches ran out of memory on 48 GB.
    • The shipped configs/examples/fnet3d/fit.yml fails in four separate ways. The skill config fixes all four.
  • dynacell-stain-eval: the ER pixel + mask run and the membrane run (cpdino + instance AP) match the internal evaluation:
    • ER: PCC and Dice within 2e-5;
    • membrane: Dice within 0.004 and mAP within 0.003.
    • dynacell report ran on the outputs.
  • Checkpoint coverage: all 48 released fnet3d, vscyto3d, unext2 and celldiff checkpoints load into the skill's model blocks with strict key matching. As a control, an fnet3d checkpoint loaded into the VSCyto3D block fails.
  • Train → stain handoff: the FNet3D and CELL-Diff smoke checkpoints predict with the dynacell-stain-predict configs, and dynacell fit --ckpt_path last.ckpt resumes a run ("Restored all states", stops at the new max_steps).
  • Format and hooks: the YAML blocks parse, the relative links and anchors resolve, the evals JSON is valid, the pre-commit hooks pass, and no machine-specific paths remain.

Not verified:

  • the mitochondria and nucleus evaluation paths;
  • predictions from checkpoints other than A549 ER and membrane. The others load strictly, but none of their outputs was scored.
  • the production CELL-Diff sampler, hiPSC data, fine-tuning, and training to convergence;
  • the literal git clone + git checkout --detach sequence. The runs used a worktree at the same commit with the same uv sync.
  • the behavioural evals in evals/evals.json, which were written but not executed against an agent;
  • the Biohub MCP contributing guide, which I could not read (it sits behind EvolutionaryScale SSO), so the format follows feat(dynacell): add embed and phenotype skills and commands #540 and waveorder.

The skills flag these gaps where they matter.

Biohub MCP import

  • Upstream folders: applications/dynacell/skills/dynacell-stain-{predict,train,eval}.
  • Contents: each folder is self-contained, with SKILL.md, a BSD-3-Clause LICENSE.md, references/*.md and evals/evals.json (4 cases each, including a client without shell access).
  • Execution: the skills call no Biohub tools; they serve instructions only, and everything runs in the user's own environment.
  • Runtime dependency: VisCy b67a38b0c0b9556b83291526935ce06f98ab9ec4.

Found while verifying, not fixed here

  • Shipped example configs: configs/examples/* fail on public data. They expect a Fluorescence channel, list it as a predict normalization key, have no training crop, request 4-GPU DDP by default, and use CSVLogger, which crashes on image logging.
  • unext2 example: configs/examples/unext2 builds the UNeXt2 architecture, but the released unext2 and vscyto3d checkpoints are fcmae.
  • README:
    • the evaluation quickstart uses target_name=sec61b (not a valid target) and omits required keys;
    • dynacell report needs +results_dirs.<name>=....
  • Error hints: they suggest pip install 'dynacell[...]', but dynacell isn't on PyPI.
  • Public internal paths: the public s3://dynacell/v1/models/checkpoints.csv (columns dst_path, src_ckpt, config_src) and the training config.yaml files expose internal storage paths. The skills use only the train_set, organelle, model and pub_filename columns.
  • S3 models/README.md: it says all models take 15 Z planes; the real windows are 32 (FNet3D), 15 (VSCyto3D/UNeXt2) and 8 (UNetViT3D, CELL-Diff tiles).

🤖 Generated with Claude Code

https://claude.ai/code/session_015kuht3npKtb2o5E6h19xbA

alxndrkalinin and others added 6 commits December 2, 2026 01:12
Agent skill for Biohub MCP: predict organelles from Phase3D with the
released FNet3D, VSCyto3D/UNeXt2 and CELL-Diff checkpoints on public
DynaCell archives or the user's own OME-Zarr. The predict configs are
the ones that reproduced the internal evaluation on the public A549 ER
test archive at runtime commit b67a38b.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015kuht3npKtb2o5E6h19xbA
Agent skill for Biohub MCP: fit FNet3D or CELL-Diff on public DynaCell
training archives or the user's paired data on one GPU with TensorBoard
logging. Both configs ran 20 steps with validation and checkpointing on
the public A549 ER training archive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015kuht3npKtb2o5E6h19xbA
Agent skill for Biohub MCP: pixel and mask metrics with dynacell
evaluate, instance AP for nucleus and membrane via Cellpose-DINO, and
model comparison with dynacell report. The feature tier stays off
because its references and checkpoints are not public.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015kuht3npKtb2o5E6h19xbA
All 48 released fnet3d, vscyto3d, unext2 and celldiff checkpoints load
into the stain skill's model blocks with strict key matching (an fnet3d
checkpoint in the VSCyto3D block fails, as a control), so the unext2
caveat is no longer needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015kuht3npKtb2o5E6h19xbA
200,000 steps at the measured ~4.2 s per step is about 10 days, not a
week. Angle-bracket placeholders in mermaid labels would render as HTML
tags on GitHub, so name the channel TARGET_prediction instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015kuht3npKtb2o5E6h19xbA
…in,eval}

Consistent product-prefixed names so the three skills read as one
command family (dynacell stain predict / train / eval). Skill names
allow only lowercase letters, digits and hyphens, so the words are
joined with hyphens. Folders, name fields, skill:// resource paths,
eval skill_name fields and cross-references move together.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015kuht3npKtb2o5E6h19xbA
@alxndrkalinin alxndrkalinin changed the title feat(dynacell): add stain, train-stain and eval-stain agent skills feat(dynacell): add dynacell-stain-{predict,train,eval} agent skills Dec 2, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant