PyTorch-only StarDist 2D inference for Keras H5 StarDist weights.
Project description
cistardist_pytorch
PyTorch-only StarDist 2D inference for existing TensorFlow/Keras StarDist .h5
weights. The first target model is models/SD_Nuclei_Versatile.
This repo intentionally does not depend on TensorFlow, Keras, CSBDeep, or the
upstream stardist Python package.
Install
PyTorch is intentionally installed from requirements.txt so you can choose the
CUDA build explicitly.
conda create -n cistardist_pytorch python=3.10
conda activate cistardist_pytorch
pip install -r requirements.txt
pip install -e . --no-deps
After the package is published, install it with:
pip install cistardist_pytorch
If you need the CUDA-specific PyTorch wheel, install PyTorch first using this
repo's requirements.txt or your own environment policy.
Convert and Predict
cistardist-convert models/SD_Nuclei_Versatile
cistardist-predict models/SD_Nuclei_Versatile data/nuclei.tif --out outputs/nuclei_labels.tif
The converter reads config.json, thresholds.json, and weights_best.h5.
It writes a PyTorch checkpoint next to the source model as weights_best.pt.
Python API
import tifffile
from cistardist_pytorch import StarDist2D
model = StarDist2D.from_folder("models/SD_Nuclei_Versatile")
image = tifffile.imread("data/nuclei.tif")
labels, details = model.predict_instances(image)
Current Scope
- 2D grayscale inference
- Keras
.h5Conv2D weight conversion viah5py - StarDist-style polygon postprocessing with vendored BSD-compatible 2D geometry
- No training, no TensorFlow reference tests, no 3D, no multiclass models
Attribution
The 2D geometry and NMS behavior follows the BSD-3-Clause upstream StarDist project: https://github.com/stardist/stardist
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cistardist_pytorch-0.1.0.tar.gz.
File metadata
- Download URL: cistardist_pytorch-0.1.0.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c91cd283b65364536f7091250d32ff2b259a1c7b431d97217c89aff78cd22187
|
|
| MD5 |
aaf12a37c65205faa4589175a04d595b
|
|
| BLAKE2b-256 |
7618e888187f60c117ebbbdb399cb66acf6183f23e7d4eef38355126be5b8866
|
File details
Details for the file cistardist_pytorch-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cistardist_pytorch-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cf5faad83ef0c534c4905d570b150aee7b1b354b9c229f07e6fe4eb38506c4d
|
|
| MD5 |
7e98b2f0385d238b71cd72aae3167fc7
|
|
| BLAKE2b-256 |
e354e6918f5f85aef879b21e32bf892f1eb893295d4b9f7b0328f11792bc39cb
|