Module 14: Computer Vision for EM

Apply computer vision methods to EM imagery for segmentation support, morphology extraction, and quality diagnostics.

Stylized vector art: a convolution window sliding across an image grid toward a feature map.

Lesson Flow

Learn

Goals and Concepts

Start with the capability target and concept set for this module.

Practice

Studio Activity

Apply the ideas in a guided activity tied to realistic outputs.

Check

Assessment Rubric

Use the rubric to verify competency and identify improvement targets.

Interactive Lab

Practice in short loops: checkpoint quiz, microtask decision, and competency progress tracking.

EM Segmentation Model Checkpoint

Q1. A candidate model halves the split rate and adds 15% more merges, improving every aggregate score. Why might you still reject it?

A split is conspicuous: a neurite ends, a proofreader sees it, the repair is local. A merge writes false edges into the meshes, the synapse table and the graph, and is rarely seen again. The decision is not which model scores better but where your team's measured merge-to-split cost ratio sits relative to the break-even point.

Q2. Your held-out ground truth comes from a well-stained, artifact-free block. What does this module require of the report?

Dense ground truth exists where annotation was cheap, which is where segmentation is easy, so one number from it describes the easy part of the volume. Pooling hides exactly the figure you need. Widening an interval admits ignorance without measuring anything; holding out a fold, a section loss or the weakest-stained block measures it.

Q3. Which of these is a release gate?

A gate is a statement that can fail, written before the candidate's numbers are known, because thresholds chosen afterwards are chosen to pass. The first option contains no number. The second moves with whichever metric the model happened to win, which is precisely how a merge-heavy model ships.

Model Recommendation Microtask

Two segmentation models tie on VI. Which comparison decides your recommendation?

Progress Tracker

State is saved locally in your browser for this module.

0% complete

Capability target

Design and evaluate a CV pipeline for EM imagery that is fit for a specific connectomics task and explicitly bounded by known failure modes. Concretely: choose an architecture from the shape of the task rather than from the benchmark leaderboard, decompose error into merges and splits instead of reporting one score, convert that decomposition into a downstream cost using a ratio your team has actually measured, and write a release gate that says in advance what result would stop the model from shipping.

Why this module matters

CV is what makes petascale connectomics possible at all: no group will manually trace 10^15 voxels. That leverage is also the risk. A segmentation model applied to a whole volume writes its errors into every downstream product — meshes, skeletons, the synapse table, the connectivity graph — and most of those errors are never seen by a human.

The asymmetry that governs every decision in this module is between the two error types. A split is conspicuous: a neuron ends abruptly, a proofreader sees it, and the repair is local. A merge is invisible in summary statistics. It manufactures connectivity that does not exist, and because motif counting is combinatorial, a small number of spurious edges biases motif counts superlinearly toward denser motifs. A model that trades a large reduction in splits for a modest increase in merges will look better on almost every aggregate metric and be worse for the science.

Concept set

1) Task-model fit

2) Error taxonomy over headline metrics

3) Validation is a release gate with numbers in it

4) Ground truth is small, expensive, and biased

5) Augmentation encodes the artifacts you expect to meet

Choosing an approach and choosing a metric

Approach Best when What it costs you
Affinity CNN + watershed + agglomeration You want modularity and cheap re-runs of the merge stage Quality depends heavily on boundary prediction; agglomeration errors need their own model and their own ground truth
Flood-filling network Highest instance quality with fewer post-processing stages Substantially more compute per volume; harder to re-run one stage; less modular to debug
2D segmentation plus cross-section linking Strongly anisotropic data where z-context is weak Linking errors accumulate along z; performs poorly across missing sections
Learned agglomeration on existing supervoxels Supervoxels are good and merging is the bottleneck Requires before/after proofreading correction pairs, which only exist after a proofreading effort
Question you are answering Metric that answers it Where it misleads
How volumetrically accurate is the labeling? VI, reported as split and merge components separately Size-sensitive; a single long-axon split is nearly invisible
Can a person trace a neurite through this? ERL Insensitive to boundary drift; depends on skeleton conventions
Is the connectivity right? Edge and synapse precision and recall Conflates segmentation error with synapse-detection error unless controlled
Are membranes placed correctly? Boundary F1 Can be high while the topology is wrong; least informative downstream

Worked example: two models, and why the better score loses

The numbers below are illustrative — they show the shape of the reasoning, not results from a specific published comparison.

You are choosing between an incumbent model A and a candidate model B for a production segmentation. Evaluation is on a proofread ground-truth subvolume containing 60 skeletonized neurites totaling about 42 mm of traced path.

  Model A (incumbent) Model B (candidate)
VI (total) 0.61 0.52
VI split component 0.44 0.19
VI merge component 0.17 0.33
ERL 142 µm 118 µm
Boundary F1 0.89 0.93
Splits in the subvolume 210 95
Merges in the subvolume 24 47

The naive reading. B wins on total VI and on boundary F1, which is the pair of numbers most benchmark tables would show. Ship B.

What the decomposition says. B’s entire VI advantage comes from splits: 0.44 down to 0.19. Its merge component nearly doubled, 0.17 to 0.33, and its merge count rose from 24 to 47. B is a model that is more willing to join things.

What ERL says. A gives 142 µm of expected error-free tracing against B’s 118 µm. So on the practical question — can someone follow a dendrite — A is better, and it is better because ERL is broken by both error types while VI is dominated by voxel volume.

Converting to a decision. Define r as the cost of one merge relative to one split, counting the time to find it as well as to fix it. Then A costs 210 + 24r split-equivalents and B costs 95 + 47r. Setting these equal: 115 = 23r, so r = 5. At r = 5 the two models are exactly tied. At r = 2, B is better (189 against 258). At r = 8, A is better (402 against 471). The entire decision rests on one ratio, and most teams have never measured it.

Naming the assumption. This arithmetic assumes every merge is eventually found. It is the optimistic case. Merges are invisible in summary statistics and a proofreader is not prompted to look for them, so in practice some fraction survives into the released connectome and manufactures edges. That pushes the effective r upward, which favors A. It also means the honest report includes an estimate of the undetected merge rate, which cannot be obtained from the same ground truth that trained the comparison.

The decision and the gate. Measure r on your own team by timing 20 real repairs of each type, including search time. If the measured r exceeds 5, keep A. If it is below 5, adopt B but add a merge-focused review pass, and set the release gate to require that B’s merge component not exceed A’s after that pass. Record both models’ numbers in the model card either way, because the next team’s r will be different.

Core workflow

  1. Write the EM task as a sentence naming the input, the output, and the downstream consumer of that output.
  2. Define the acceptable error envelope in decomposed terms: maximum merge rate, minimum ERL, and the region in which those numbers must hold.
  3. Select a baseline and at most two candidate approaches, using the approach table and the voxel geometry of your data.
  4. Assemble evaluation data that includes at least one deliberately hard region, and keep clean-region and hard-region metrics separate.
  5. Evaluate with VI decomposed, ERL, and a connectivity-level metric; never report a single aggregate score alone.
  6. Convert the error counts into downstream cost using a merge-to-split ratio your team measured rather than assumed.
  7. Review 20-30 failure cases by eye in ambiguous regions and classify each by cause: weak stain, section loss, fold, thin neurite, or genuine ambiguity.
  8. Publish a model card with intended use, unsupported uses, the evaluation regions, the metrics with their region breakdown, and the release gate the model passed.

Pre-class preparation

60-minute tutorial run-of-show

  1. 00:00-08:00 task framing + exemplar failure modes. Show one split and one merge in the viewer and ask which is worse; collect reasons before giving the answer.
  2. 08:00-20:00 choose metrics tied to downstream biology. Each learner writes the metric they would gate on and the threshold, before seeing any model output.
  3. 20:00-34:00 evaluate baseline vs candidate model. Learners compute or are given VI components, ERL, and error counts for two models, then solve for the break-even merge-to-split ratio.
  4. 34:00-46:00 error taxonomy and triage discussion. Sample failure cases, classify each by cause, and identify which causes augmentation could have addressed.
  5. 46:00-56:00 model card drafting, including at least one unsupported use and the region breakdown of the metrics.
  6. 56:00-60:00 competency check: each learner states their release gate as a sentence that could fail.

Studio activity

Scenario: Compare two segmentation-support CV models for an EM subvolume. You are given the model outputs, a proofread ground-truth subvolume of roughly 40 mm of traced path drawn from a clean region, and a second, smaller ground-truth patch from a region containing a partial fold and two lost sections. Your team maintains the production segmentation and must recommend one model.

Tasks

  1. Compute or tabulate VI with its split and merge components, ERL, and error counts for both models, reported separately for the clean and the artifact-heavy region.
  2. Solve for the merge-to-split cost ratio at which the two models tie, and state which side of that ratio your team is on and how you know.
  3. Sample at least 15 failure cases across both models and classify each by cause.
  4. Write a release gate: a numeric criterion, decided before looking at the winner, that the chosen model must pass.
  5. Draft the model card limitation statement, including one use you would refuse to support.

Outputs

Assessment rubric

Key architectures for EM connectomics

U-Net (Ronneberger et al. 2015)

Encoder-decoder architecture with skip connections. The encoder downsamples the image to extract features; the decoder upsamples to produce pixel-level predictions; skip connections preserve fine-grained spatial detail. Originally designed for biomedical image segmentation. In connectomics, 3D U-Nets predict boundary/affinity maps at each voxel.

Why it works for EM: EM images have consistent texture and contrast patterns. The encoder learns to detect membranes, vesicles, and other structures; the decoder produces a per-voxel prediction map.

Practical constraint: the network is applied blockwise over petavoxels, and blocks must overlap, because a network needs context beyond the region it predicts. Insufficient overlap produces block-boundary seams that appear later as a regular grid of segmentation errors — diagnosable because their spatial distribution matches your block grid.

Flood-Filling Networks (Januszewski et al. 2018)

An iterative approach: a CNN predicts whether each neighboring voxel belongs to the same object as the current seed, and the segment “grows” outward. FFNs produce instance segmentation directly (each neuron gets a unique ID) without the separate watershed + agglomeration step.

When to use: FFNs are computationally expensive but produce high-quality segmentation with fewer post-processing stages. Used in FlyWire and other Google-based reconstructions.

Affinity prediction + watershed + agglomeration

The standard two-stage pipeline: (1) A 3D CNN predicts pairwise affinity between neighboring voxels (probability they belong to the same segment). (2) Watershed transform produces an over-segmentation of millions of supervoxels. (3) Agglomeration merges supervoxels based on affinity scores at boundaries.

When to use: More modular and parallelizable than FFN. Standard in academic pipelines (Funke et al. 2019).

Why the watershed threshold is set to over-segment: supervoxels are the immutable atoms every later stage is built on, so a supervoxel that spans two neurites is an error no amount of downstream proofreading can repair cleanly. The pipeline deliberately accepts many splits to avoid that.

Data augmentation for EM

Training data is expensive (manual annotation). Augmentation expands the effective training set:

Common errors and how to recover

What this module does not cover

Content library references

Teaching resources

References

Quick practice prompt

Document one CV result with one supported use case and one forbidden use case.

Teaching Materials

Activity Worksheet

Learner worksheet aligned to the studio activity and rubric.

Open worksheet

Slide Source

Marp source file for editing and rendering.

course/decks/marp/modules/module14.marp.md

Related Content