Custom Models
Add your own model as a task node.
How a task node runs
Each model is a task node: a small HTTP service in its own conda environment, started and stopped by TissueLab.
- RegisterNode script + requirements
- EnvironmentConda env created for the node
- StartLaunched on a free port
- Run/init → /read → /execute
- ResultsWritten into the slide’s Zarr store
What a node implements
| Call | Purpose |
|---|---|
POST /init | Load the model |
POST /read | Receive the job, including the path of the slide's Zarr store |
POST /execute | Run inference and write the results |
GET /status | Health check |
GET /progress | Progress as Server-Sent Events |
A node writes into the group for its category, using the dataset names in Export Schema:
| Category | Zarr group |
|---|---|
NucleiSeg | Cell-Segmentation |
NucleiClassify | Cell-Classification |
TissueSeg | Patch-Segmentation |
TissueClassify | Patch-Classification |
Start from an existing node
- TissueLab Model Zoo: source of the existing nodes, including the H-optimus-0 nodes. Copy the closest one.
- TissueLab-SDK: helpers for slide readers and nodes.
Custom weights
- Wrap your PyTorch model in a node: load the weights in
/init, run it in/execute. - A foundation model such as H-optimus-0 fits
NucleiSeg(per-cell embeddings) orTissueSeg(per-patch embeddings). - Your script decides where its weights live. The service starts it from the script's own folder, so paths relative to the script work.
Register a node
Nodes can be registered in the app, or through the service API:
curl -X POST http://127.0.0.1:5001/api/tasks/v1/register_custom_node \
-H "Content-Type: application/json" \
-d '{
"model_name": "MyEmbedding",
"factory": "TissueSeg",
"python_version": "3.11",
"service_path": "/path/to/my_embedding_tasknode.py",
"dependency_path": "/path/to/requirements.txt"
}'The full API reference is served by your own instance at http://127.0.0.1:5001/api/v1/docs.