Skip to content

j0126 tutorial: clarify native resolution and add data download script - #218

Merged
donglaiw merged 1 commit into
masterfrom
tutorial/j0126-reproducible
Sep 2, 2026
Merged

j0126 tutorial: clarify native resolution and add data download script#218
donglaiw merged 1 commit into
masterfrom
tutorial/j0126-reproducible

Conversation

@donglaiw

@donglaiw donglaiw commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR clarifies the j0126 tutorial's data resolution and adds tooling to download the EM volume from the public mirror. The key insight is that the native FFN grid is 9 × 9 × 20 nm (x, y, z), not 10 nm isotropic as previously implied. All published results use this anisotropic native resolution.

Key Changes

Documentation & Configuration:

  • Corrected resolution references throughout: the im_align_10nm.zarr store is byte-for-byte equal to mip 0 (9 × 9 × 20 nm), not a 10 nm isotropic resample
  • Simplified and reorganized 1_affinity_supervised.yaml:
    • Removed 60+ lines of dense technical commentary into focused subsections
    • Clarified that the supervised reference is trained on 25 cubes (held-out 8 for validation), not all 33
    • Explicitly listed all 25 training and 8 validation cube paths instead of globbing
    • Updated resolution from [10, 10, 10] to [20, 9, 9] (ZYX native grid)
    • Corrected window/stride/divisibility explanation to match the actual [48, 96, 96] patch size

Data Access:

  • Added scripts/download_precompute.py: a general-purpose Neuroglancer precomputed downloader that:
    • Fetches arbitrary public precomputed layers (image or segmentation) into local zarr
    • Supports partial downloads via --bbox for testing
    • Handles sharded jobs with --shard-id / --num-shards for whole-volume runs
    • Includes progress tracking and resumable downloads
    • Documented with examples for both full j0126 EM (~660 GB) and test crops

README Reorganization:

  • Moved resource budget and cleanup procedures to separate RESOURCE.md and CLEANUP.md files
  • Rewrote "Step 0 — get the data" section with clear instructions for:
    • Downloading the 33 labelled cubes (395 MB)
    • Downloading the public EM volume (with sharding guidance)
    • Clarifying that mip 0 is the correct grid (not a resample)
  • Updated 1_affinity_zeroshot.yaml comments to reference native 9 × 9 × 20 nm resolution
  • Updated params.yaml with resolution clarification

Notable Details

  • The supervised affinity train/val split is deterministic: sort 33 cube names, take every 4th starting at index 2 for validation (8 cubes, including 2 of the 4 large 128×256×256 ones)
  • The released checkpoint predates this split and trained on all 33 cubes; retraining with the new config gives an honest held-out validation curve
  • Window size [48, 96, 96] is near-isotropic in physical space (960 × 864 × 864 nm) despite anisotropic voxels, matching the trained model's normalization statistics
  • All inference and evaluation use native mip 0; no resampling to 10 nm isotropic

https://claude.ai/code/session_014WVoz5xNr9MAkRpdGRytt7

… docs

The volume is 9 x 9 x 20 nm (native FFN mip 0), not 10 nm isotropic.
Verified: im_align_10nm.zarr/0 is byte-identical to rawdata_realigned mip 0
at the same coordinates on scattered blocks, and its voxel grid
[5700, 10913, 10664] matches mip 0 exactly -- a 20 -> 10 nm z-resample
would have doubled z. So:

* resolution [10,10,10] -> [20,9,9] in both step-1 configs (inert for
  training, where it only feeds nnU-Net source_spacing, but it is what the
  configs document about the data);
* the zero-shot config no longer instructs a resample that never happened
  and that the reference runs never used;
* params.data.raw_10nm -> raw_em, with the misnomer documented. The
  data.test `name` stays im_align_10nm: it is baked into the artifact
  filenames step 2 reads.

2_abiss.yaml's resolution_xyz [10,10,10] is left alone: it is fail-closed
checked against already-built precomputed layers, and error correction
already uses the correct [20,9,9] (skeletonize.py NATIVE_RESOLUTION_ZYX_NM),
so only the neuroglancer display scale is affected.

1_affinity_supervised.yaml now trains on a real 25/8 held-out split
(sorted cube names, every 4th from index 2 to val), instead of validating
on 3 cubes that were also in train. The released checkpoint and every
number in the results table predate this split and are noted as such. The
recipe itself is unchanged from base_banis+_zebrafinch_heavy: lr 1e-3,
200k steps, batch 8, patch [48,96,96], aug_em_neuron, from scratch.

Docs: resource budget -> RESOURCE.md, staged storage cleanup -> CLEANUP.md,
and a new Step 0 that downloads the labelled cubes from HuggingFace and the
EM volume with the new scripts/download_precompute.py (source location as
argument, mip 0, resumable, shardable). Smoke-tested: a downloaded crop is
bit-identical to the local reference zarr.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@donglaiw
donglaiw merged commit cd7e39a into master Sep 2, 2026
1 of 4 checks passed
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