Skip to content

Bioimage

Source

Bioimage Model Zoo format functions.

create_env_text(pytorch_version, torchvision_version)

Create environment yaml content for the bioimage model.

This installs an environment with the specified pytorch version and the latest changes to careamics.

Parameters:

  • pytorch_version (str) –

    Pytorch version.

  • torchvision_version (str) –

    Torchvision version.

Returns:

  • str

    Environment text.

create_model_description(config, name, general_description, data_description, authors, inputs, outputs, weights_path, torch_version, careamics_version, config_path, env_path, covers, channel_names=None, model_version='0.1.0')

Create model description.

Parameters:

  • config (Configuration) –

    CAREamics configuration.

  • name (str) –

    Name of the model.

  • general_description (str) –

    General description of the model.

  • data_description (str) –

    Description of the data the model was trained on.

  • authors (list[Author]) –

    Authors of the model.

  • inputs (Union[Path, str]) –

    Path to input .npy file.

  • outputs (Union[Path, str]) –

    Path to output .npy file.

  • weights_path (Union[Path, str]) –

    Path to model weights.

  • torch_version (str) –

    Pytorch version.

  • careamics_version (str) –

    CAREamics version.

  • config_path (Union[Path, str]) –

    Path to model configuration.

  • env_path (Union[Path, str]) –

    Path to environment file.

  • covers (list of pathlib.Path or str) –

    Paths to cover images.

  • channel_names (Optional[list[str]], default: None ) –

    Channel names, by default None.

  • model_version (str, default: "0.1.0" ) –

    Model version.

Returns:

  • ModelDescr

    Model description.

extract_model_path(model_desc)

Return the relative path to the weights and configuration files.

Parameters:

  • model_desc (ModelDescr) –

    Model description.

Returns:

  • tuple of (path, path)

    Weights and configuration paths.

get_unzip_path(zip_path)

Generate unzipped folder path from the bioimage.io model path.

Parameters:

  • zip_path (Path) –

    Path to the bioimage.io model.

Returns:

  • Path

    Path to the unzipped folder.