lmd-vitl-p8-cellmap-lvd
Organelle segmentation model for volumetric EM data. It has one output channel per class of the CellMap Segmentation Challenge's label scheme for a total of 75 output channels, where channel k corresponds to the CellMap class id k (see below for a list of all organelle classes and their indices). The encoder is ai-hhmi/lmd-vitl-p8-simmim-lvd (DINOv3 LVD-1689M, then SimMIM on LMD). We fine-tuned it end to end with a UNETR decoder on 226 annotated crops from 22 CellMap volumes, each at its native voxel size (2 to 8 nm). This model holds the step-15,000 checkpoint of a 25k-step run.
| Model | Starts from | Training |
|---|---|---|
| ai-hhmi/lmd-vitl-p8-simmim-lvd | DINOv3 ViT-L/16, LVD-1689M | SimMIM on LMD, 100k steps |
| ai-hhmi/lmd-vitl-p8-simmim-scratch | random | SimMIM on LMD, 100k steps |
| ai-hhmi/lmd-vitl-p8-affinity-lvd | lmd-vitl-p8-simmim-lvd | neuron affinities, 100k steps |
| ai-hhmi/lmd-vitl-p8-affinity-scratch | lmd-vitl-p8-simmim-scratch | neuron affinities, 75k steps |
| ai-hhmi/lmd-vitl-p8-cellmap-lvd (this one) | lmd-vitl-p8-simmim-lvd | CellMap organelle classes, 15k steps |
Use
import json
import sys
from pathlib import Path
import torch
from huggingface_hub import snapshot_download
from safetensors.torch import load_file
sys.path.insert(0, "mia-train/src") # git clone https://github.com/AI-HHMI/mia-train && git -C mia-train checkout 4e71956
from layers.common.dense_heads import UNETRHead
from models.dinov3_vit3d import DinoVisionTransformer3D
class SemanticNet(torch.nn.Module):
"""(B, 1, X, Y, Z) image in [0, 1] -> (B, 75, X, Y, Z) logits; channel k = CellMap class id k."""
def __init__(self, config):
super().__init__()
self.encoder = DinoVisionTransformer3D(**config["model"]["kwargs"])
self.decoder_out = UNETRHead(**config["head"]["kwargs"])
self.skip_layers = config["skip_layers"]
def forward(self, x):
maps = self.encoder.get_intermediate_layers(x, n=self.skip_layers, reshape=True)
return self.decoder_out(list(maps), x)
root = Path(snapshot_download("ai-hhmi/lmd-vitl-p8-cellmap-lvd"))
config = json.loads((root / "config.json").read_text())
net = SemanticNet(config)
net.load_state_dict(load_file(root / "model.safetensors"))
names = [c["name"] for c in config["classes"]] # names[k] = CellMap class with id k, e.g. names[4] = "mito_lum"
device = "cuda" if torch.cuda.is_available() else "cpu"
net = net.to(device).eval()
# (batch, channel, x, y, z): the data's own voxel size (see Input), intensities in [0, 1], every side a multiple of 8
x = torch.rand(1, 1, 128, 128, 128, device=device)
with torch.no_grad(), torch.autocast(device, dtype=torch.bfloat16, enabled=device == "cuda"):
logits = net(x) # (1, 75, 128, 128, 128)
labels = logits.float().argmax(dim=1) # CellMap class id per voxel
mito = torch.isin(labels, torch.tensor(config["classes"][50]["members"], device=device)) # mito = ids 3, 4, 5
print(tuple(labels.shape), names[50], config["classes"][50]["members"])
Requirements: PyTorch (we used 2.13), NumPy, safetensors, huggingface_hub, and the model code
from mia-train at commit 4e71956. Put mia-train/src on
the path as above rather than installing mia-train. Its top-level packages have generic names
(models, layers, utils, distributed, data), and they shadow packages of the same name, such
as Dask's distributed.
- Outputs. The network gives 75 logits per voxel, and channel k is CellMap class id k. The table
under Classes and
config["classes"]name every channel.logits.argmax(1)gives each voxel's CellMap id. - Which channels the model uses. The training targets were CellMap's leaf classes, and 38 of its 53 leaf classes occur in the training crops. On our 43 test crops the argmax chose 36 channels, all of them leaf classes. It never chose channel 0 (unannotated, ignored in training), a composite channel, or a leaf class missing from the training crops.
- Composite classes. A composite class such as
mito(mito_mem∪mito_lum∪mito_ribo) is a union of leaf classes;config["classes"][k]["members"]lists its leaves. To get one, take the union of its leaves' labels, as the snippet does formito. The composite channels themselves were never a training target. - Weights. The file holds the encoder under
encoder.and the decoder underdecoder_out., sonet.encodercan also start a different head. - Inside mia-train. To use the model with mia-train's own trainer or
predict.py, buildSemanticSegmentationfromconfig["algorithm"]and load the file withsafetensors.torch.load_model. That function copes with the encoder's two names in that class. This route needs mia-train's own dependencies (itspyproject.toml).
Whole volumes
To score our benchmark, we predicted each test crop at its dataset's native voxel size, in 256³
windows at a stride of 128 voxels under bf16 autocast. We
mapped each window's logits to softmax probabilities, averaged overlapping windows with weights that
rise linearly from a window's faces to its center, and took the argmax (mia-train's
predict.py --argmax).
Input
- One channel, with axes ordered
(x, y, z). Arrays stored(z, y, x), as OME-Zarr and N5 volumes usually are, needarray.transpose(2, 1, 0). - The data's own voxel size, not resampled. Training and our evaluation read each CellMap dataset at its native voxel size: 2 nm isotropic, 4 × 4 × 3.24–5.24 nm (x × y × z) or 8 nm isotropic. We did not test other voxel sizes.
- Intensities in [0, 1]: 8-bit FIB-SEM divided by 255, as CellMap publishes it (membranes dark). Every training and test volume was 8-bit, and none was rescaled otherwise.
- Every side a multiple of 8 voxels. Training and our evaluation used 256³ windows. The model runs at other sizes, but we did not test them.
Classes
Channel k is CellMap class id k (classes.csv of the CellMap Segmentation Challenge, plus 0 for
unannotated voxels). Columns:
- Kind. A leaf class, or a composite class (the union of the leaves listed).
- Training crops. How many of the 226 training crops contain the class in their labels, counted on CellMap's label arrays at their own resolution. For a composite class, the count covers crops annotated only at the composite level.
- Test voxels predicted. The class's share of all voxels in our 43 test predictions.
- Test IoU. Given for the 48 classes the benchmark scores (CellMap's scored classes). Composite classes are scored as the union of their leaves' predictions.
| Channel | Class | Description | Kind | Training crops | Test voxels predicted | Test IoU |
|---|---|---|---|---|---|---|
| 0 | unannotated | unannotated or unknown voxels (ignored in training) | ignored | — | 0 | |
| 1 | ecs | extracellular space | leaf | 113 | 33.79% | 0.945 |
| 2 | pm | plasma membrane | leaf | 89 | 2.10% | 0.370 |
| 3 | mito_mem | mitochondrial membrane | leaf | 99 | 4.11% | 0.666 |
| 4 | mito_lum | mitochondrial lumen | leaf | 99 | 4.53% | 0.830 |
| 5 | mito_ribo | mitochondrial ribosome | leaf | 47 | 0.01% | 0.373 |
| 6 | golgi_mem | Golgi membrane | leaf | 15 | 0.15% | 0.333 |
| 7 | golgi_lum | Golgi lumen | leaf | 15 | 0.17% | 0.531 |
| 8 | ves_mem | vesicle membrane | leaf | 132 | 0.11% | 0.250 |
| 9 | ves_lum | vesicle lumen | leaf | 132 | 0.03% | 0.246 |
| 10 | endo_mem | endosome membrane | leaf | 125 | 0.34% | 0.326 |
| 11 | endo_lum | endosome lumen | leaf | 124 | 0.45% | 0.638 |
| 12 | lyso_mem | lysosome membrane | leaf | 50 | 0.09% | 0.246 |
| 13 | lyso_lum | lysosome lumen | leaf | 50 | 0.16% | 0.317 |
| 14 | ld_mem | lipid droplet membrane | leaf | 20 | 0.08% | 0.322 |
| 15 | ld_lum | lipid droplet lumen | leaf | 20 | 0.46% | 0.847 |
| 16 | er_mem | endoplasmic reticulum membrane | leaf | 136 | 3.66% | 0.419 |
| 17 | er_lum | endoplasmic reticulum lumen | leaf | 136 | 2.84% | 0.560 |
| 18 | eres_mem | endoplasmic reticulum exit site membrane | leaf | 25 | 0.02% | 0.246 |
| 19 | eres_lum | endoplasmic reticulum exit site lumen | leaf | 25 | <0.01% | 0.261 |
| 20 | ne_mem | nuclear envelope membrane | leaf | 33 | 0.26% | 0.355 |
| 21 | ne_lum | nuclear envelope lumen | leaf | 32 | 0.23% | 0.471 |
| 22 | np_out | nuclear pore out | leaf | 30 | 0.02% | 0.167 |
| 23 | np_in | nuclear pore in | leaf | 30 | <0.01% | 0.280 |
| 24 | hchrom | heterochromatin | leaf | 30 | 1.45% | 0.737 |
| 25 | nhchrom | nucleolus-associated heterochromatin | leaf | 1 | 0.03% | |
| 26 | echrom | euchromatin | leaf | 26 | 0.08% | 0.004 |
| 27 | nechrom | nucleolus-associated euchromatin | leaf | 2 | 0 | |
| 28 | nucpl | nucleoplasm | leaf | 32 | 3.61% | 0.874 |
| 29 | nucleo | nucleolus | leaf | 1 | 0.04% | |
| 30 | mt_out | microtubule out | leaf | 56 | 0.09% | 0.193 |
| 31 | cent | centrosome | leaf | 0 | 0 | |
| 32 | cent_dapp | centrosome distal appendage | leaf | 2 | <0.01% | |
| 33 | cent_sdapp | centrosome subdistal appendage | leaf | 2 | <0.01% | |
| 34 | ribo | ribosomes | leaf | 0 | 0 | |
| 35 | cyto | cytosol | leaf | 140 | 40.25% | 0.900 |
| 36 | mt_in | microtubule in | leaf | 56 | 0.03% | 0.215 |
| 37 | nuc | nucleus | union of 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 | 35 | 0 | 0.961 |
| 38 | vim | vimentin | leaf | 0 | 0 | |
| 39 | glyco | glycogen | leaf | 0 | 0 | |
| 40 | golgi | Golgi | union of 6, 7 | 0 | 0 | 0.633 |
| 41 | ves | vesicle | union of 8, 9 | 0 | 0 | 0.366 |
| 42 | endo | endosome | union of 10, 11 | 0 | 0 | 0.639 |
| 43 | lyso | lysosome | union of 12, 13 | 0 | 0 | 0.338 |
| 44 | ld | lipid droplet | union of 14, 15 | 7 | 0 | 0.835 |
| 45 | rbc | red blood cells | leaf | 0 | 0 | |
| 46 | eres | endoplasmic reticulum exit site | union of 18, 19 | 0 | 0 | 0.368 |
| 47 | perox_mem | peroxisome membrane | leaf | 24 | 0.38% | 0.227 |
| 48 | perox_lum | peroxisome lumen | leaf | 24 | 0.33% | 0.739 |
| 49 | perox | peroxisome | union of 47, 48 | 12 | 0 | 0.645 |
| 50 | mito | mitochondria | union of 3, 4, 5 | 13 | 0 | 0.945 |
| 51 | er | endoplasmic reticulum | union of 16, 17, 18, 19, 20, 21, 22, 23 | 0 | 0 | 0.759 |
| 52 | ne | nuclear envelope | union of 20, 21, 22, 23 | 0 | 0 | 0.683 |
| 53 | np | nuclear pore | union of 22, 23 | 0 | 0 | 0.371 |
| 54 | chrom | chromatin | union of 24, 25, 26, 27 | 0 | 0 | 0.740 |
| 55 | mt | microtubule | union of 30, 36 | 0 | 0 | 0.316 |
| 56 | isg_mem | insulin secretory granule membrane | leaf | 0 | 0 | |
| 57 | isg_lum | insulin secretory granule lumen | leaf | 0 | 0 | |
| 58 | isg_ins | insulin secretory granule insulin | leaf | 0 | 0 | |
| 59 | isg | insulin secretory granule | union of 56, 57, 58 | 0 | 0 | |
| 60 | cell | cell | union of 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 47, 48, 56, 57, 58, 61, 62 | 0 | 0 | 0.980 |
| 61 | actin | actin | leaf | 0 | 0 | |
| 62 | tbar | t-bar | leaf | 1 | 0 | |
| 63 | bm | basement membrane | leaf | 7 | 0.10% | |
| 64 | er_mem_all | endoplasmic reticulum membrane collective | union of 16, 18, 20 | 0 | 0 | 0.416 |
| 65 | ne_mem_all | nuclear envelope membrane collective | union of 20, 22, 23 | 0 | 0 | 0.393 |
| 66 | cent_all | centrosome collective | union of 31, 32, 33 | 0 | 0 | |
| 67 | chloroplast_mem | chloroplast membrane | leaf | 0 | 0 | |
| 68 | chloroplast_lum | chloroplast lumen | leaf | 0 | 0 | |
| 69 | chloroplast_sg | chloroplast starch granule | leaf | 0 | 0 | |
| 70 | chloroplast | chloroplast | union of 67, 68, 69 | 0 | 0 | |
| 71 | vacuole_mem | vacuole membrane | leaf | 0 | 0 | |
| 72 | vacuole_lum | vacuole lumen | leaf | 0 | 0 | |
| 73 | vacuole | vacuole | union of 71, 72 | 0 | 0 | |
| 74 | plasmodesmata | plasmodesmata | leaf | 0 | 0 |
Model details
- Encoder: as in lmd-vitl-p8-simmim-lvd (DINOv3 ViT-L, 8³-voxel patches, 303 M parameters).
- Decoder: UNETR, 1.85 M parameters. It reads blocks 8, 16 and 24 (
skip_layers = [7, 15, 23], 0-based) and the raw image. It upsamples three times by 2, with 64, 32 and 16 channels at strides 4, 2 and 1, and ends in 75 output channels. model.safetensors: fp32, 1.22 GB.config.json: the constructor arguments of the encoder (model) and the decoder (head),skip_layers,classes(all 75 channels, as in the table), mia-train'salgorithmsettings, the input conventions and the source training run.
Training
- Initialization. Encoder from lmd-vitl-p8-simmim-lvd (step 100k); decoder random.
- Data. 226 annotated crops from 22 CellMap FIB-SEM datasets, each read at its dataset's native
voxel size: 123 crops at 8 nm, 86 at 4 × 4 × 3.24–5.24 nm and 17 at 2 nm. They include cultured
cells (COS-7, HeLa, Jurkat, macrophages, SUM159 and others) and tissues (mouse kidney, liver, heart
and nucleus accumbens; fly mushroom body and ventral nerve cord; zebrafish heart). These are the fit
split of our
cellmap_organelle_semanticbenchmark. Each training window was 256³ voxels, centered on a crop. - Labels. CellMap's per-voxel class ids. Training ignored voxels outside the crop and voxels labeled 0 (unannotated). Some crops are annotated only at the level of composite classes (nucleus, mitochondria, peroxisome, lipid droplet). There the loss rewarded the summed probability of the composite's leaf classes, and a crop with only composite labels was sampled a quarter as often as the others.
- Loss. Cross-entropy, averaged within each window and then over windows, plus a soft Dice term at equal weight. The Dice term is computed per class over all windows of a batch and averaged over the 74 classes other than unannotated; voxels labeled only at the composite level are left out of it.
- Optimization. A 25k-step run at a global batch of 8 on 8 GPUs; this checkpoint is from step 15,000. AdamW (β = 0.9, 0.95; weight decay 0.05, none on norms and biases). Learning rate 3e-4 after 3k warm-up steps, decaying linearly to 3e-7 at step 25k. Gradient clipping at 1.0, bf16 autocast. Augmentation: in-plane rotations, intensity scaling and shifts, noise, and dropped or shifted sections.
Evaluation
The test split of our cellmap_organelle_semantic benchmark has 43 completely annotated crops from 16
of the training datasets; no test crop overlaps a training crop. It scores the 48 classes of the
CellMap Segmentation Challenge (31 leaf, 17 composite) on each crop's own label grid. The score is
the mean IoU over classes, with each class's voxels pooled over all crops; unannotated voxels are
ignored.
| Metric | Test |
|---|---|
| mean IoU (48 classes) | 0.506 |
| mean Dice | 0.633 |
| voxel accuracy | 0.900 |
Per-class IoU is in the Classes table, and the other models are on the leaderboard. We scored all five checkpoints of this run on the test split: steps 5k, 10k, 15k, 20k and 25k scored 0.312, 0.460, 0.506, 0.472 and 0.458. We release the best one, so 0.506 is a best-of-five on the test split. The benchmark's fit split is the training crops themselves, so it cannot choose a checkpoint.
A known weakness: the model labels some cytosol as mitochondrial membrane, mostly in mouse liver and kidney crops (this affects ~1.1% of cytosol voxels).
License
DINOv3 License (LICENSE.md). This model is a derivative of Meta's DINOv3 weights and code, so that
agreement governs its use and redistribution. Publications that use the model must acknowledge
DINOv3. The training crops come from the CellMap Segmentation Challenge, published under CC BY 4.0;
please credit it as below.
References
- O. Siméoni et al. DINOv3. arXiv:2508.10104, 2025.
- Z. Xie et al. SimMIM: A Simple Framework for Masked Image Modeling. CVPR 2022.
- A. Hatamizadeh et al. UNETR: Transformers for 3D Medical Image Segmentation. WACV 2022.
- CellMap Project Team. CellMap Segmentation Challenge. Janelia Research Campus, 2024. doi:10.25378/janelia.28034561.
- L. Heinrich et al. Whole-cell organelle segmentation in volume electron microscopy. Nature 599, 2021.