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quantem-core
|
| 4 |
+
pipeline_tag: image-segmentation
|
| 5 |
+
tags:
|
| 6 |
+
- electron-microscopy
|
| 7 |
+
- image-segmentation
|
| 8 |
+
- organelle
|
| 9 |
+
- mitochondria
|
| 10 |
+
- vision-transformer
|
| 11 |
+
- napari
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# QuantEM — organelle segmentation for electron microscopy
|
| 15 |
+
|
| 16 |
+
Eight segmentation models covering **mitochondria, endoplasmic reticulum, nucleus and lipid
|
| 17 |
+
droplets**, each in two encoder sizes:
|
| 18 |
+
|
| 19 |
+
| Family | Encoder | Params | Notes |
|
| 20 |
+
|---|---|--:|---|
|
| 21 |
+
| **QuantEM** | ViT-B/16 | 86 M | Trained from scratch on an EM corpus using the DINOv3 recipe. |
|
| 22 |
+
| **OmniEM** | ViT-L/14 | 302 M | Heads trained on the published OmniEM (EM-DINO) encoder. |
|
| 23 |
+
|
| 24 |
+
Recommended defaults: **QuantEM for mitochondria; OmniEM for ER, nucleus and lipid droplets.**
|
| 25 |
+
|
| 26 |
+
## Use
|
| 27 |
+
|
| 28 |
+
These files are not loaded directly. Install the library, which resolves, downloads, verifies and
|
| 29 |
+
assembles them for you:
|
| 30 |
+
|
| 31 |
+
```bash
|
| 32 |
+
pip install quantem-core
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
```python
|
| 36 |
+
from quantem_em.api import load_model, segment
|
| 37 |
+
|
| 38 |
+
model = load_model("quantem/mito") # downloads on first use, then cached
|
| 39 |
+
labels = segment(model, image, pixel_size_nm=8.0)
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
For a GUI, install the napari plugin instead — it wraps the same library with segmentation,
|
| 43 |
+
proofreading, head-only fine-tuning, batch mode and morphometrics:
|
| 44 |
+
|
| 45 |
+
```bash
|
| 46 |
+
pip install napari-quantem
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
Pre-seed a shared or air-gapped cache with:
|
| 50 |
+
|
| 51 |
+
```bash
|
| 52 |
+
python -m quantem_em.weights download --all
|
| 53 |
+
QUANTEM_MODEL_DIR=/srv/quantem python -m quantem_em.weights verify
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
## Files
|
| 57 |
+
|
| 58 |
+
Encoders are split so nothing is downloaded twice. **The split is not uniform**, because the
|
| 59 |
+
families adapt their encoders differently:
|
| 60 |
+
|
| 61 |
+
* **OmniEM** uses LoRA, which never touches the base weights — so `omniem-vitl` is a complete
|
| 62 |
+
encoder genuinely shared by all four heads, and each head is only ~26 MB.
|
| 63 |
+
* **QuantEM** mito/nucleus/LD fine-tune the **last four blocks**, which therefore differ per
|
| 64 |
+
organelle. `quantem-vitb-trunk` is blocks 0–7 plus embeddings and the final norm; blocks 8–11
|
| 65 |
+
ship inside each organelle file.
|
| 66 |
+
* **`quantem-er` is self-contained.** It was adapted with `full`, replacing the whole encoder, so
|
| 67 |
+
it needs no trunk.
|
| 68 |
+
|
| 69 |
+
| File | Size | Contents | SHA-256 |
|
| 70 |
+
|---|--:|---|---|
|
| 71 |
+
| `quantem-vitb-trunk.safetensors` | 227.7 MB | QuantEM ViT-B/16 blocks 0-7 + embeddings + final norm. Shared by the mitochondria, nucleus and lipid-droplet heads, whose own artifacts carry the fine-tuned blocks 8-11. | `637a8c321a7b2172…` |
|
| 72 |
+
| `omniem-vitl.safetensors` | 1.2 GB | OmniEM (EM-DINO) ViT-L/14 encoder. Untouched by LoRA, so genuinely shared by all four OmniEM heads. | `d7f2dffe2ec23138…` |
|
| 73 |
+
| `quantem-mito.safetensors` | 136.5 MB | model | `a897bf322872d1ae…` |
|
| 74 |
+
| `quantem-nucleus.safetensors` | 136.5 MB | model | `d5152b6c2b5ccdbf…` |
|
| 75 |
+
| `quantem-ld.safetensors` | 136.5 MB | model | `765d1a8e281edf7e…` |
|
| 76 |
+
| `quantem-er.safetensors` | 465.0 MB | Self-contained: adapt=full replaces the entire encoder, so this needs no trunk. | `50bcdfedc497041f…` |
|
| 77 |
+
| `omniem-mito.safetensors` | 25.7 MB | model | `7e5c2c8b6ffede26…` |
|
| 78 |
+
| `omniem-nucleus.safetensors` | 25.7 MB | model | `3142057d3b36b482…` |
|
| 79 |
+
| `omniem-ld.safetensors` | 25.7 MB | model | `ae5b0c356e0fb48d…` |
|
| 80 |
+
| `omniem-er.safetensors` | 135.2 MB | model | `3e3a693ea757d500…` |
|
| 81 |
+
|
| 82 |
+
Every file is verified against the SHA-256 above on download **and on every subsequent load**, so a
|
| 83 |
+
truncated or altered file is detected rather than trusted.
|
| 84 |
+
|
| 85 |
+
## Licence
|
| 86 |
+
|
| 87 |
+
**The weights are released under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).**
|
| 88 |
+
Commercial use, redistribution and modification are permitted; the only condition is attribution —
|
| 89 |
+
credit the QuantEM authors, link to the licence, and indicate if you made changes.
|
| 90 |
+
|
| 91 |
+
The `quantem-core` and `napari-quantem` **code** is BSD-3-Clause, which is a separate licence on a
|
| 92 |
+
separate thing.
|
| 93 |
+
|
| 94 |
+
CC BY rather than a software licence because weights are not source code: the "source and binary
|
| 95 |
+
form" language of BSD does not map onto a state dict. CC BY is also what most of the underlying
|
| 96 |
+
annotation data uses, which keeps the attribution chain coherent.
|
| 97 |
+
|
| 98 |
+
### Position on training data
|
| 99 |
+
|
| 100 |
+
Training data for the released heads is CC0 or CC BY 4.0 with the exceptions below. Two sources
|
| 101 |
+
carry copyleft rather than field-of-use terms:
|
| 102 |
+
|
| 103 |
+
| Source | Licence | Share of that organelle's train+val crops |
|
| 104 |
+
|---|---|--:|
|
| 105 |
+
| DeepContact | GPL-3.0 (applied to data) | mito 5.6 %, ER 11.4 % |
|
| 106 |
+
| ASEM / Incasem | CC BY-SA 4.0 | mito 2.5 %, ER 4.8 % |
|
| 107 |
+
|
| 108 |
+
**Our position is that trained weights are not a derivative work or adaptation of the training
|
| 109 |
+
images.** They are statistical parameters, not a reproduction or transformation of any particular
|
| 110 |
+
image. We state this explicitly rather than leaving it implied, and we apply it consistently —
|
| 111 |
+
we do not treat the weights as independent of the data here and as derived from it elsewhere.
|
| 112 |
+
Attribution is given in full below regardless, because attribution is owed to every CC-licensed
|
| 113 |
+
source whether or not ShareAlike is triggered.
|
| 114 |
+
|
| 115 |
+
Two sources with research-use-only terms — **Lucchi++** (EPFL) and **Kasthuri++**
|
| 116 |
+
(Harvard/Lichtman) — were present in earlier mitochondria runs and have been **removed**; the
|
| 117 |
+
released mitochondria head is retrained without them. A field-of-use restriction binds regardless
|
| 118 |
+
of how the derivative-work question is decided, so those could not be reasoned around.
|
| 119 |
+
|
| 120 |
+
## Attribution
|
| 121 |
+
|
| 122 |
+
Full per-source tables, with tile and crop counts and a DOI for every entry, are published as
|
| 123 |
+
datasets alongside these weights:
|
| 124 |
+
|
| 125 |
+
* **[`ArrojoeDrigoLab/quantem-organelle-model-sources`](https://huggingface.co/datasets/ArrojoeDrigoLab/quantem-organelle-model-sources)**
|
| 126 |
+
— the annotated ground truth behind these eight models, per organelle.
|
| 127 |
+
* **[`ArrojoeDrigoLab/quantem-base-model-sources`](https://huggingface.co/datasets/ArrojoeDrigoLab/quantem-base-model-sources)**
|
| 128 |
+
— all 655 datasets in the corpus the base encoder was pretrained on.
|
| 129 |
+
|
| 130 |
+
Those two tables are generated directly from the manuscript's supplementary tables, so they
|
| 131 |
+
cannot drift from what was actually trained on. They are the authoritative list; this card
|
| 132 |
+
deliberately does not keep a second copy.
|
| 133 |
+
|
| 134 |
+
**Modifications.** All sources were tiled, cropped and in some cases resampled; annotations were
|
| 135 |
+
consolidated onto a common organelle vocabulary. No source is redistributed here in its original
|
| 136 |
+
form.
|
| 137 |
+
|
| 138 |
+
**Pretraining corpus.** The QuantEM ViT-B encoder was pretrained on the wider EM corpus described
|
| 139 |
+
in the manuscript — public repositories under their own terms, plus data contributed directly by
|
| 140 |
+
27 authors under CC BY 4.0 for this purpose. Contributors are named in the manuscript
|
| 141 |
+
acknowledgements and Supplementary Table 1.
|
| 142 |
+
|
| 143 |
+
## Upstream components
|
| 144 |
+
|
| 145 |
+
| Component | Licence | Notes |
|
| 146 |
+
|---|---|---|
|
| 147 |
+
| `timm` (DINOv3 / DINOv2 architecture code) | Apache-2.0 | `timm/models/eva.py` states its DINOv3 code is a modification of the EVA model and is Apache-2.0 like the rest of timm; only *Meta's weights* remain under the DINOv3 licence. **No Meta weights are used or redistributed here.** |
|
| 148 |
+
| QuantEM ViT-B encoder | ours, CC BY 4.0 | Trained **from scratch** on our own EM corpus using the published DINOv3 recipe. No Meta checkpoint was used as initialisation and the released artifact contains no Meta tensors. |
|
| 149 |
+
| OmniEM (EM-DINO) ViT-L encoder | code MIT (`pku-maleilab/omniem-package`) | The four OmniEM heads are built on the encoder published by Lei Ma's group at PKU; please cite OmniEM if you use them. The heads themselves are ours. |
|
| 150 |
+
|
| 151 |
+
## Citation
|
| 152 |
+
|
| 153 |
+
Acree *et al.*, *QuantEM: An optimized platform of vision transformer-based models for
|
| 154 |
+
segmentation and analysis of electron microscopy data.* Citation details on publication.
|