Downloads · 30 days
0
gsstephenson/membrane2former-swinv2-large-fibsem-seed42
membrane2former-swinv2-large-fibsem-seed42 is a machine learning model from gsstephenson. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
35-class organelle segmentation from FIB-SEM electron microscopy images.
Downloads · 30 days
0
Access
Public
Updated Apr 14, 2026
Repo size
3.8 GB
Likes
0
Public
Click a slice to open those files.
.pt3.8 GB · 100%
From the Hugging Face model README
35-class organelle segmentation from FIB-SEM electron microscopy images.
Membrane2Former architecture with SwinV2-Large backbone, trained on FIB-SEM volumes from the OpenOrganelle / CellMap dataset.
| Architecture | Membrane2Former + SwinV2-L-384 |
| Classes | 35 atomic organelle classes |
| Input | 2.5D — 3 adjacent Z-slices at 384×384 px |
| Best val Dice | 0.4504 (epoch 300) |
| Seed | 42 |
ecs, pm, mito_mem, mito_lum, mito_ribo, golgi_mem, golgi_lum, ves_mem,
ves_lum, endo_mem, endo_lum, er_mem, er_lum, nuc, lyso_mem, lyso_lum,
ld_mem, ld_lum, eres_mem, eres_lum, ne_mem, ne_lum, np_out, np_in,
hchrom, echrom, nucpl, mt_out, cyto, mt_in, perox_mem, perox_lum,
nhchrom, nechrom, nucleo
The best.pt file is a full training checkpoint:
| Key | Description |
|---|---|
ema_state_dict | EMA model weights — use for inference |
model_state_dict | Raw training weights (lower quality than EMA) |
optimizer_state_dict | Adam optimizer state — enables fine-tuning resumption |
scheduler_state_dict | LR schedule state |
scaler_state_dict | AMP scaler state |
config | Full training config dict |
logit_adj | Logit adjustment tensor (class imbalance correction) |
epoch | 300 |
best_dice | 0.4504 |
git clone https://github.com/gsstephenson/OrganelleSeg.git
cd OrganelleSeg
micromamba activate csc
pip install -e third_party/MSDeformAttn/
from huggingface_hub import hf_hub_download
path = hf_hub_download(
repo_id="gsstephenson/membrane2former-swinv2-large-fibsem-seed42",
filename="best.pt",
local_dir="checkpoints/",
)
print("Downloaded to:", path)
Generate EM, GT, and prediction TIFF volumes for a zarr crop:
python scripts/visualization/generate_3d_volumes.py \
--checkpoints checkpoints/best.pt \
--names swin_seed42 \
--dataset jrc_hela-2 \
--crop crop28 \
--output-dir /path/to/output \
--device cuda
Output files:
em_<dataset>_<crop>.tif — raw EM volume (ZYX, uint8)gt_<dataset>_<crop>.tif — ground truth argmax labels (ZYX, uint8)pred_swin_seed42_<dataset>_<crop>.tif — model predictions (ZYX, uint8)organelle_35cls.lut — ImageJ lookup tableclass_legend.csv — label index → class name + colourOpen in Fiji:
File → Open each TIFFImage → Lookup Tables → Load LUT → select organelle_35cls.lutAnalyze → Tools → Synchronize Windows to link slicesCLI options:
| Flag | Default | Description |
|---|---|---|
--crop-size | auto (384) | Tile size for inference |
--overlap | 0.5 | Tile overlap fraction |
--save-probs | off | Also save per-class probability volumes |
--no-gaussian | off | Use uniform instead of Gaussian tile blending |
--device | cuda | cuda or cpu |
Compare seed42 and seed123 side by side:
python scripts/visualization/generate_3d_volumes.py \
--checkpoints checkpoints/seed42/best.pt checkpoints/seed123/best.pt \
--names swin_seed42 swin_seed123 \
--dataset jrc_hela-2 --crop crop28 \
--output-dir /path/to/output \
--device cuda
This model is part of an ongoing study targeting publication in Nature Methods. Citation details will be added upon publication.