File size: 2,336 Bytes
9e3995b | 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 | ---
license: bsd-3-clause
library_name: onnx
tags:
- onnx
- spot-detection
- fluorescence-microscopy
- bioimage-analysis
- spotiflow
---
# Spotiflow ONNX — General
ONNX export of the **general** pretrained [Spotiflow](https://github.com/weigertlab/spotiflow) model for 2D fluorescent spot detection in microscopy images.
## Model Details
| Property | Value |
|---|---|
| Architecture | Spotiflow (U-Net backbone + stereographic flow head) |
| Input | `float32 [B, 1, H, W]` — single-channel grayscale image |
| Output 0 | `float32 [B, 1, H, W]` — heatmap (pre-sigmoid logits) |
| Output 1 | `float32 [B, 3, H, W]` — stereographic flow `(z, y, x)` |
| ONNX opset | 16 |
| Pretrained variant | `general` |
## Usage
### Python (onnxruntime)
```python
import onnxruntime as ort
import numpy as np
session = ort.InferenceSession("model.onnx")
image = np.random.rand(1, 1, 512, 512).astype(np.float32)
outputs = session.run(None, {"input": image})
heatmaps, flow = outputs[0], outputs[-1] # flow has shape [B, 3, H, W]
```
### Rust (spotiflow-rs)
```rust
use spotiflow_rs::{SpotiflowSession, PredictParams};
let mut session = SpotiflowSession::new("model.onnx")?;
let (spots, heatmaps, flows) = session.predict(&image_f32, h, w, PredictParams::default())?;
```
## Export
Exported from the official PyTorch weights using a wrapper that converts the model's dictionary output to an explicit `(heatmaps, flow)` tuple for correct ONNX tracing:
```bash
python scripts/export_onnx.py --model general --output model.onnx
```
## License
BSD 3-Clause — same as the [original Spotiflow repository](https://github.com/weigertlab/spotiflow).
Copyright (c) 2023, Albert Dominguez Mantes, Martin Weigert.
## Citation
```bibtex
@article{dominguez2024spotiflow,
title={Spotiflow: accurate and efficient spot detection for fluorescence microscopy with deep stereographic flow regression},
author={Dominguez Mantes, Albert and Herrera, Antonio and Khven, Irina and Schlaeppi, Anjalie and Aho, Eftychia and Erskine, Amber and Laubscher, Eleonora and Hendriks, Gert-Jan and Thiran, Jean-Philippe and Bhatt, Deepak K and Wegner, Joerg D and Weigert, Martin},
journal={bioRxiv},
year={2024},
publisher={Cold Spring Harbor Laboratory}
}
```
|