Skip to main content

Python functionality for the bioimage model zoo

Project description

core-bioimage-io-python

Python specific core utilities for bioimage.io resources (in particular models).

Installation

Via Mamba/Conda

The bioimageio.core package can be installed from conda-forge via

mamba install -c conda-forge bioimageio.core

If you do not install any additional deep learning libraries, you will only be able to use general convenience functionality, but not any functionality for model prediction. To install additional deep learning libraries use:

  • Pytorch/Torchscript:

    CPU installation (if you don't have an nvidia graphics card):

    mamba install -c pytorch -c conda-forge bioimageio.core pytorch torchvision cpuonly
    

    GPU installation (for cuda 11.6, please choose the appropriate cuda version for your system):

    mamba install -c pytorch -c nvidia -c conda-forge bioimageio.core pytorch torchvision pytorch-cuda=11.8
    

    Note that the pytorch installation instructions may change in the future. For the latest instructions please refer to pytorch.org.

  • Tensorflow

    Currently only CPU version supported

    mamba install -c conda-forge bioimageio.core tensorflow
    
  • ONNXRuntime

    Currently only cpu version supported

    mamba install -c conda-forge bioimageio.core onnxruntime
    

Via pip

The package is also available via pip (e.g. with recommended extras onnx and pytorch):

pip install bioimageio.core[onnx,pytorch]

Set up Development Environment

To set up a development conda environment run the following commands:

mamba env create -f dev/env.yaml
mamba activate core
pip install -e . --no-deps

There are different environment files available that only install tensorflow or pytorch as dependencies.

💻 Use the Command Line Interface

bioimageio.core installs a command line interface (CLI) for testing models and other functionality. You can list all the available commands via:

bioimageio

Check that a model adheres to the model spec:

bioimageio validate <MODEL>

Test a model (including prediction for the test input):

bioimageio test-model <MODEL>

Run prediction for an image stored on disc:

bioimageio predict-image <MODEL> --inputs <INPUT> --outputs <OUTPUT>

Run prediction for multiple images stored on disc:

bioimagei predict-images -m <MODEL> -i <INPUT_PATTERN> - o <OUTPUT_FOLDER>

<INPUT_PATTERN> is a glob pattern to select the desired images, e.g. /path/to/my/images/*.tif.

🐍 Use in Python

bioimageio.core is a python package that implements prediction with bioimageio models including standardized pre- and postprocessing operations. These models are described by---and can be loaded with---the bioimageio.spec package.

In addition bioimageio.core provides functionality to convert model weight formats.

To get an overview of this functionality, check out these example notebooks:

and the developer documentation.

Model Specification

The model specification and its validation tools can be found at https://github.com/bioimage-io/spec-bioimage-io.

Changelog

0.6.3

  • Fix #386
  • (in model inference testing) stop assuming model inputs are tileable

0.6.2

0.6.1

0.6.0

  • add compatibility with new bioimageio.spec 0.5 (0.5.2post1)
  • improve interfaces

0.5.10

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

bioimageio.core-0.6.3.tar.gz (62.9 kB view hashes)

Uploaded Source

Built Distribution

bioimageio.core-0.6.3-py3-none-any.whl (68.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page