Skip to content

Usage¤

Recommendations¤

  • Use the bioimageio.core Python package to not only validate the format of your bioimageio.yaml/rdf.yaml file, but also test and deploy it (e.g. model inference).
  • bioimageio.spec keeps evolving. Try to use and upgrade to the most current format version! Note: The command line interface bioimageio (part of bioimageio.core) has the update-format command to help you with that.

Examples¤

We provide some bioimageio.yaml/rdf.yaml example files to describe models, applications, notebooks and datasets; more examples are available at bioimage.io. There is also an example notebook demonstrating how to programmatically access the models, applications, notebooks and datasets descriptions in Python. For integration of bioimageio resources we recommend the bioimageio.core Python package.

bioimageio command-line interface (CLI)¤

The bioimageio CLI has moved to bioimageio.core.

API overview¤

bioimageio.spec implements type and format version specific pydantic.BaseModel models for resources shared on bioimage.io.

The return type of load_description is ResourceDescr. This is a typing.Union over various format type and format version specific and unspecific classes including InvalidDescr and GenericDescr. The individual *Descr-classes of this Union can be instantiated in code to create a bioimage.io resource description in the first place.

For more narrow type hints and runtime-checks during loading dedicated load_*_description methods may be used:

Another way to narrow/check the return type is to call load_description/load_model_description... with format_version="latest", returning LatestResourceDescr/ModelDescr (instead of AnyModelDescr)/... .

To export resource descriptions:

Environment variables¤

See bioimageio.spec.settings

Logging¤

bioimageio.spec (and bioimageio.core) use loguru for logging. To enable logs from bioimageio.spec (and bioimageio.core) use:

from loguru import logger

logger.enable("bioimageio")