cellmap_flow.models.bioimage_catalog
The BioImage Model Zoo’s models, for the dashboard’s picker.
They come from bioimage.io’s artifact server (Hypha), whose listing holds
each model’s whole description: its axes (so 2D or 3D, and any declared
voxel size, without a fetch per model) and weights. The legacy
collection.json index, which lags it (125 models to its 157 in
October 2026), is the fallback when the server cannot be reached.
list_bioimage_models answers from a cache file under
~/.cellmap_flow/bioimage once there is one, so opening the Models tab
does not download the zoo’s index each time; refresh_bioimage_models
fetches it again; cached_bioimage_models reads the cache alone, never
fetching. They give {"fetched": <ISO time>, "models": [...]},
the index’s models in its order, each as normalise gives it. A failed
fetch raises ZooIndexError, whose message says why, and leaves the
cache as it was.
None of the zoo’s models declares the voxel size it was trained at, so the
EM ones’ were looked up by hand, in bioimage_voxel_sizes.yaml beside
this module: trained_at reads it, and each listed model carries its
row as trained (None for a model not in it).
bioimage_entry is the model entry of a zoo model, and entry_voxel_size
decides what voxel_size it carries, by the rule the model’s server
applies (BioModelConfig._input_voxel_size): the one place the Models
tab’s Submit and models.resolve decide it.
Attributes
Exceptions
The zoo's index could not be fetched or read. |
Classes
What |
Functions
|
One index entry as the picker shows it. |
|
One Hypha artifact as the picker shows it: |
|
What |
|
The zoo's models, from the cache when there is a current one, with |
|
|
|
Fetch the zoo's index again, and cache it. |
|
The cached model whose id, nickname or key is |
|
The voxel size (nm, z y x) the model's description declares, None when it declares none. |
|
The model entry of the zoo model |
|
The |
Module Contents
- cellmap_flow.models.bioimage_catalog.ZOO_INDEX_URL = 'https://uk1s3.embassy.ebi.ac.uk/public-datasets/bioimage.io/collection.json'
- cellmap_flow.models.bioimage_catalog.HYPHA_ARTIFACTS = 'https://hypha.aicell.io/bioimage-io/artifacts'
- cellmap_flow.models.bioimage_catalog.HYPHA_MODELS_URL = ''
- cellmap_flow.models.bioimage_catalog.FETCH_TIMEOUT_S = 30
- cellmap_flow.models.bioimage_catalog.BIOIMAGE_CACHE_DIR
- cellmap_flow.models.bioimage_catalog.BIOIMAGE_CACHE_FILE
- cellmap_flow.models.bioimage_catalog.CACHE_FORMAT = 2
- cellmap_flow.models.bioimage_catalog.STALE_AFTER_S = 3600
- cellmap_flow.models.bioimage_catalog.ZOO_PAGE_URL = 'https://bioimage.io/#/artifacts/{}'
- exception cellmap_flow.models.bioimage_catalog.ZooIndexError
The zoo’s index could not be fetched or read.
- cellmap_flow.models.bioimage_catalog.normalise(raw: dict) dict
One index entry as the picker shows it.
idis the index’s (a Zenodo DOI for older models, the nickname for newer ones),nicknamethe animal name (“affable-shark”) or None, andkeythe one to load it by, the nickname when there is one.dimsis “2d”, “3d” or None;emwhether its tags, name or description say electron microscopy;weight_formatsshort names (“pytorch”, “onnx”).
- cellmap_flow.models.bioimage_catalog.normalise_artifact(artifact: dict) dict | None
One Hypha artifact as the picker shows it:
normalise’s fields from its description, with 2D/3D and the declared voxel size from its input’s axes. None for an artifact with no description.
- cellmap_flow.models.bioimage_catalog.TRAINED_VOXEL_SIZES_FILE
- cellmap_flow.models.bioimage_catalog.trained_at(model) dict | None
What
bioimage_voxel_sizes.yamlsays the model (an entry, or its nickname) was trained at: {“voxel_size” (absent when trained across resolutions), “trained_on”, “confidence”, “source”, “note”?}, or None.
- cellmap_flow.models.bioimage_catalog.list_bioimage_models() dict
The zoo’s models, from the cache when there is a current one, with
stalesaying whether it is older than STALE_AFTER_S.A cache in an older format is fetched again; when that fails it is still read, as a list that is older is better than none.
- cellmap_flow.models.bioimage_catalog.cached_bioimage_models() dict | None
list_bioimage_models’s answer from the cache alone: None when nothing is cached in this format, rather than fetching the index. The Finetune tab’s ranking lists the zoo’s models so (routes/finetune/rank_routes.py): its list must not wait on bioimage.io, and the Models tab’s BioImage Zoo list, once opened, has cached them.
- cellmap_flow.models.bioimage_catalog.refresh_bioimage_models() dict
Fetch the zoo’s index again, and cache it.
- cellmap_flow.models.bioimage_catalog.find_bioimage_model(key: str) dict | None
The cached model whose id, nickname or key is
key, or None.Only the cache is read: the Models tab’s submit must not wait on the network, and a model the tab listed is in it.
- cellmap_flow.models.bioimage_catalog.declared_voxel_size(entry: dict) list | None
The voxel size (nm, z y x) the model’s description declares, None when it declares none.
Read from its RDF (
rdf_source) with a plain fetch, so the dashboard, which has no bioimageio.core, can refuse a blank voxel size at Submit: the server would otherwise refuse it after its job started, out of sight. Remembered per model. Raises ZooIndexError when the description cannot be read, which the caller treats as “don’t know”.
- cellmap_flow.models.bioimage_catalog.bioimage_entry(model: str, voxel_size=None, name: str | None = None) dict
The model entry of the zoo model
model(an id or nickname bioimageio.core loads, or a description’s path or URL), atvoxel_size(nm, z y x; None leaves it to the model’s server, seeentry_voxel_size) and calledname.
- class cellmap_flow.models.bioimage_catalog.VoxelSizeChoice
What
entry_voxel_sizedecided.voxel_sizeis what the entry gets, None to leave it to the model’s server;sourcesays why: “given”, “declared” (the description declares one, which the server reads), “trained” (cellmap-flow’s table says what it was trained at), “none” (it declares none, and the table does not know it: its server would refuse it), “unread” (listed, but its description could not be read) or “unlisted” (not in the cached listing).declaredandtrainedare what was found.- voxel_size: list | None
- source: str
- declared: list | None
- trained: dict | None
- cellmap_flow.models.bioimage_catalog.entry_voxel_size(model: str, given=None, *, listed: dict | None = None, online: bool = True) VoxelSizeChoice
The
voxel_sizea zoo model’s entry gets, by the rule its server applies (BioModelConfig._input_voxel_size: the one given, else the description’s, else the one it was trained at, else a refusal), with what the launcher can see of it.givenis what the user typed, if anything.listedis the model’s entry in the zoo’s listing (find_bioimage_model), when it is in it: its description’s declared voxel size is read from the listing, or fetched when the listing lacks it andonline. A declared voxel size is left to the server to read. The one it was trained at is written into the entry, so the server need not find the table’s row by another key.