Mask Generation
ONNX
sam2
segment-anything
sam-med3d
microscopy
medical-imaging
interactive-segmentation
feature-extraction
pixel-classification
dinov2
vgg16
cellpose
micro-sam
Instructions to use voxide/voxide-models with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sam2
How to use voxide/voxide-models with sam2:
# Use SAM2 with images import torch from sam2.sam2_image_predictor import SAM2ImagePredictor predictor = SAM2ImagePredictor.from_pretrained("voxide/voxide-models") with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): predictor.set_image(<your_image>) masks, _, _ = predictor.predict(<input_prompts>)# Use SAM2 with videos import torch from sam2.sam2_video_predictor import SAM2VideoPredictor predictor = SAM2VideoPredictor.from_pretrained("voxide/voxide-models") with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): state = predictor.init_state(<your_video>) # add new prompts and instantly get the output on the same frame frame_idx, object_ids, masks = predictor.add_new_points(state, <your_prompts>) # propagate the prompts to get masklets throughout the video for frame_idx, object_ids, masks in predictor.propagate_in_video(state): ... - Notebooks
- Google Colab
- Kaggle
File size: 12,164 Bytes
d59dcf8 90b0a59 d59dcf8 8929c79 90b0a59 d59dcf8 8929c79 90b0a59 d59dcf8 90b0a59 8929c79 d59dcf8 73600a2 90b0a59 d59dcf8 8929c79 90b0a59 8929c79 90b0a59 8929c79 90b0a59 8929c79 90b0a59 8929c79 90b0a59 8929c79 90b0a59 8929c79 90b0a59 8929c79 | 1 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | ---
license: other
license_name: per-file
license_link: https://huggingface.co/voxide/voxide-models#license-and-attribution
library_name: onnx
pipeline_tag: mask-generation
tags:
- onnx
- segment-anything
- sam2
- sam-med3d
- microscopy
- medical-imaging
- interactive-segmentation
- feature-extraction
- pixel-classification
- dinov2
- vgg16
- cellpose
- micro-sam
base_model:
- facebook/sam2.1-hiera-tiny
- facebook/sam2.1-hiera-small
- facebook/sam2.1-hiera-base-plus
- facebook/sam2.1-hiera-large
- facebook/dinov2-with-registers-small
- facebook/dinov2-with-registers-base
---
# Voxide segmentation models (ONNX)
ONNX exports of **SAM 2.1** and **SAM-Med3D (turbo)** used by
[Voxide](https://huggingface.co/voxide), a GPU volume viewer for microscopy, for interactive
segmentation. Each model is an encoder/decoder pair run on the CPU with ONNX Runtime.
Voxide ships the SAM 2.1 Tiny pair. It downloads the others on request from this repository at a
pinned revision and checks every file against the SHA-256 in [`SHA256SUMS`](SHA256SUMS), so a file
that does not match is never loaded.
It also downloads five **network-feature** models for its pixel classifier (a DINOv2 ViT-S/14,
a DINOv2 ViT-B/14, the first two VGG16 blocks, the Cellpose cyto3 backbone and micro-sam's ViT-T
light-microscopy encoder), pinned and checked the same way: see
[Network-feature models](#network-feature-models-pixel-classifier) for their files, provenance and
licences.
## Files
| Model | Encoder | Decoder | Use in Voxide |
|---|---|---|---|
| SAM 2.1 Hiera Tiny | `sam2.1_hiera_tiny_encoder.onnx` (110 MB) | `sam2.1_hiera_tiny_decoder.onnx` (17 MB) | 2D slices (default, fastest) |
| SAM 2.1 Hiera Small | `sam2.1_hiera_small_encoder.onnx` (139 MB) | `sam2.1_hiera_small_decoder.onnx` (17 MB) | 2D slices |
| SAM 2.1 Hiera Base+ | `sam2.1_hiera_base_plus_encoder.onnx` (278 MB) | `sam2.1_hiera_base_plus_decoder.onnx` (17 MB) | 2D slices |
| SAM 2.1 Hiera Large | `sam2.1_hiera_large_encoder.onnx` (853 MB) | `sam2.1_hiera_large_decoder.onnx` (17 MB) | 2D slices (best masks, slowest) |
| SAM-Med3D turbo | `sammed3d_turbo_encoder.onnx` (373 MB) | `sammed3d_turbo_decoder.onnx` (31 MB) | 3D volumes |
## Using them without the in-app download
Download the files you need and either use **Models → Import model…** in Voxide or copy them
into Voxide's model folder. The file names must stay as they are: Voxide finds each model by its
`<name>_encoder.onnx` / `<name>_decoder.onnx` pair.
```bash
pip install -U huggingface_hub
hf download voxide/voxide-models --include "sam2.1_hiera_small_*" --local-dir voxide-models
```
## How they were made
Unmodified inference exports of the upstream checkpoints, produced with PyTorch 2.9.0 (ONNX opset
18, IR version 8). No fine-tuning, quantization or other change to the weights.
## License and attribution
Both upstream model families are released under the **Apache License 2.0** (see [`LICENSE`](LICENSE)),
and so are these exports.
- **SAM 2.1** © Meta Platforms, Inc. — <https://github.com/facebookresearch/sam2>
- **SAM-Med3D** © the SAM-Med3D authors — <https://github.com/uni-medical/SAM-Med3D>
The network-feature models carry their own licences, so this card's licence is per file
(`license: other`): Apache-2.0, BSD-3-Clause or CC-BY-4.0 (micro-sam's ViT-T encoder), as listed for
each file in [their section](#network-feature-models-pixel-classifier), with the attribution each
licence requires under [Licences and attribution](#licences-and-attribution).
If you use these models in published work, please cite the original papers:
```bibtex
@article{ravi2024sam2,
title = {SAM 2: Segment Anything in Images and Videos},
author = {Ravi, Nikhila and others},
journal = {arXiv preprint arXiv:2408.00714},
year = {2024}
}
@article{wang2023sammed3d,
title = {SAM-Med3D: Towards General-purpose Segmentation Models for Volumetric Medical Images},
author = {Wang, Haoyu and others},
journal = {arXiv preprint arXiv:2310.15161},
year = {2023}
}
```
## Network-feature models (pixel classifier)
Feature extractors for Voxide's pixel classifier: each turns an image tile into a per-pixel feature
map that the classifier trains on. Single files, run on the CPU with ONNX Runtime; Voxide finds each
by its exact file name, so keep the names as they are when importing them by hand.
| Model | File | Size | SHA-256 | Licence |
|---|---|---|---|---|
| DINOv2 ViT-S/14 with registers | `dinov2-with-registers-small.onnx` | 88 522 426 bytes (89 MB) | `815e440d222e60294bb5b165491c4760e7f08dc7ecd2488a5450e93d50887efe` | Apache-2.0 |
| VGG16 blocks 1–2 | `vgg16-blocks12.onnx` | 1 042 858 bytes (1 MB) | `230fb1431be9f9b6088fc68c24d4ff8c4894e7ef8ae3b16e14e0116b351f1b45` | BSD-3-Clause |
| Cellpose cyto3 backbone | `cellpose-cyto3-backbone.onnx` | 26 483 022 bytes (26 MB) | `e689706a9709ba7fcf70480019bdd1a6a4a94eff05277dfd64d024f2d015195d` | BSD-3-Clause |
| DINOv2 ViT-B/14 with registers | `dinov2-with-registers-base.onnx` | 346 622 747 bytes (347 MB) | `419f8937888b0d4cd607dccaed37b790b48d79cd1aad65a66bf96c7769e3b48b` | Apache-2.0 |
| micro-sam ViT-T (light microscopy) | `microsam-vit-t-lm-encoder.onnx` | 27 983 702 bytes (28 MB) | `f4ee03d6c4e5286ee2a4caf92212ce2cc90349f9f26b0d45c3490e989dc814b3` | CC-BY-4.0 |
```bash
hf download voxide/voxide-models --include "dinov2-*" "vgg16-*" "cellpose-*" --local-dir voxide-models
hf download voxide/voxide-models --include "microsam-*" --local-dir voxide-models
```
### Provenance
- **DINOv2 ViT-S/14 with registers** — Meta AI's `facebook/dinov2-with-registers-small`, in the
fp32 ONNX export by onnx-community (`onnx-community/dinov2-with-registers-small`, file
`onnx/model.onnx` at revision `ec7abea1a8757ec4f9f7b26399d31234ffaa6e6a`), copied here unchanged
under a new name. Input `pixel_values` `[N, 3, H, W]` (H and W multiples of 14), output
`last_hidden_state`; opset 14.
- **DINOv2 ViT-B/14 with registers** — Meta AI's `facebook/dinov2-with-registers-base`, in the
fp32 ONNX export by onnx-community (`onnx-community/dinov2-with-registers-base`, file
`onnx/model.onnx` at revision `fcd050203baf48e192055356f379b5949a111255`), copied here unchanged
under a new name. Input `pixel_values` `[N, 3, H, W]` (H and W multiples of 14), output
`last_hidden_state`; opset 14. Voxide reads 768 features per 14 × 14 patch (768 × 32 × 32 for a
448 × 448 tile).
- **VGG16 blocks 1–2** — torchvision's ImageNet VGG16 (`VGG16_Weights.IMAGENET1K_V1`,
`vgg16-397923af.pth`), cut after the second convolution block: the ReLU outputs of conv1_2 (64
channels) and of conv2_2 (128 channels, upsampled ×2 inside the graph), concatenated to a
192-channel stride-1 map. Exported by
`scripts/export_vgg16_onnx.py` in the Voxide repository (pinned
torch 2.9, torchvision 0.24, onnx 1.22; opset 17). The weights are unmodified.
- **Cellpose cyto3 backbone** — Cellpose 3's built-in `cyto3` model (cellpose 3.1.1), the U-Net's
32-channel stride-1 decoder output before the final 1×1 output convolution (no flows or cell
probability). Input `pixel_values` `[1, 2, H, W]` (H and W multiples of 16; channel 0 the
1st–99th-percentile-normalised plane, channel 1 the nuclei channel or zeros). Exported by
`scripts/export_cellpose_onnx.py` in the Voxide repository (pinned cellpose 3.1, onnx 1.22;
opset 17). The weights are unmodified.
- **micro-sam ViT-T (light microscopy)** — the image encoder of micro-sam's SAM LM Generalist
ViT-T (`vit_t_lm`), from the BioImage Model Zoo record `faithful-chicken` v1.1, file `vit_t.pt`
(SHA-256 `32b92ab64959088878a1cc3e52b9b64aaa0ba4b24c98e9959746d7390bec7b7a`). Exported by
`scripts/export_microsam_vit_t_onnx.py` in the Voxide repository (pinned torch 2.14, onnx 1.22;
opset 17): the image encoder alone (no prompt encoder or mask decoder), with a bilinear resize of
the 448 × 448 input to 1024 × 1024 baked in front of it and its attention biases set to zero, as
micro-sam's runtime has them. Input `pixel_values` `[1, 3, 448, 448]` (fixed; ImageNet-normalised
RGB), output `features` `[1, 256, 64, 64]`: one 256-vector per 7 × 7 input pixels.
### Licences and attribution
- **DINOv2** © Meta Platforms, Inc., Apache License 2.0 (see [`LICENSE`](LICENSE)) —
<https://github.com/facebookresearch/dinov2>, <https://huggingface.co/facebook/dinov2-with-registers-small>;
ONNX export by onnx-community — <https://huggingface.co/onnx-community/dinov2-with-registers-small>.
- **DINOv2 ViT-B/14** © Meta Platforms, Inc., Apache License 2.0 (see [`LICENSE`](LICENSE)) —
<https://github.com/facebookresearch/dinov2>, <https://huggingface.co/facebook/dinov2-with-registers-base>;
ONNX export by onnx-community — <https://huggingface.co/onnx-community/dinov2-with-registers-base>.
- **VGG16 weights** from torchvision — <https://github.com/pytorch/vision>, BSD-3-Clause
(<https://github.com/pytorch/vision/blob/main/LICENSE>).
- **Cellpose** © Howard Hughes Medical Institute (HHMI) / MouseLand — <https://github.com/MouseLand/cellpose>,
BSD-3-Clause (<https://github.com/MouseLand/cellpose/blob/main/LICENSE>). The same cyto3 weights
are redistributed by the BioImage Model Zoo as `famous-fish` ("CellPose(cyto3)",
<https://bioimage.io/#/?id=famous-fish>) under BSD-3-Clause. **Note:** per the Cellpose README,
the datasets the built-in models were trained on include images under CC-BY-NC licences; check
that your use fits those terms. Use of the built-in models in Voxide was confirmed with the
Cellpose authors on 2026-10-24.
- **micro-sam ViT-T** (CC-BY-4.0) — SAM LM Generalist (ViT-T) image encoder from micro-sam, by
Anwai Archit and Constantin Pape (University of Göttingen;
https://github.com/computational-cell-analytics/micro-sam), BioImage Model Zoo `faithful-chicken`
v1.1 (https://bioimage.io/#/?id=faithful-chicken), licensed under CC BY 4.0
(https://creativecommons.org/licenses/by/4.0/). Changed: the image encoder alone, converted to
ONNX, with a bilinear resize of a 448 × 448 input to 1024 × 1024 in front of it and its attention
biases set to zero as micro-sam's runtime has them. Provided as is, without warranties. Please
cite: Archit, A., Freckmann, L., Nair, S. et al. Segment Anything for Microscopy. Nat Methods 22,
579–591 (2025). https://doi.org/10.1038/s41592-024-02580-4. Architecture: MobileSAM / TinyViT
(Apache-2.0, https://github.com/ChaoningZhang/MobileSAM), built on Segment Anything (© Meta,
Apache-2.0).
If you use these models in published work, please cite the original papers:
```bibtex
@article{oquab2023dinov2,
title = {DINOv2: Learning Robust Visual Features without Supervision},
author = {Oquab, Maxime and others},
journal = {arXiv preprint arXiv:2304.07193},
year = {2023}
}
@article{darcet2023registers,
title = {Vision Transformers Need Registers},
author = {Darcet, Timoth{\'e}e and Oquab, Maxime and Mairal, Julien and Bojanowski, Piotr},
journal = {arXiv preprint arXiv:2309.16588},
year = {2023}
}
@article{simonyan2014vgg,
title = {Very Deep Convolutional Networks for Large-Scale Image Recognition},
author = {Simonyan, Karen and Zisserman, Andrew},
journal = {arXiv preprint arXiv:1409.1556},
year = {2014}
}
@article{stringer2021cellpose,
title = {Cellpose: a generalist algorithm for cellular segmentation},
author = {Stringer, Carsen and Wang, Tim and Michaelos, Michalis and Pachitariu, Marius},
journal = {Nature Methods},
volume = {18},
pages = {100--106},
year = {2021}
}
@article{stringer2025cellpose3,
title = {Cellpose3: one-click image restoration for improved cellular segmentation},
author = {Stringer, Carsen and Pachitariu, Marius},
journal = {Nature Methods},
year = {2025}
}
@article{archit2025microsam,
title = {Segment Anything for Microscopy},
author = {Archit, Anwai and Freckmann, Luca and Nair, Sushmita and others},
journal = {Nature Methods},
volume = {22},
pages = {579--591},
year = {2025},
doi = {10.1038/s41592-024-02580-4}
}
```
|