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:

Name Type Description Default
pytorch_version str

Pytorch version.

required
torchvision_version str

Torchvision version.

required

Returns:

Type Description
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:

Name Type Description Default
config Configuration

CAREamics configuration.

required
name str

Name of the model.

required
general_description str

General description of the model.

required
data_description str

Description of the data the model was trained on.

required
authors list[Author]

Authors of the model.

required
inputs Union[Path, str]

Path to input .npy file.

required
outputs Union[Path, str]

Path to output .npy file.

required
weights_path Union[Path, str]

Path to model weights.

required
torch_version str

Pytorch version.

required
careamics_version str

CAREamics version.

required
config_path Union[Path, str]

Path to model configuration.

required
env_path Union[Path, str]

Path to environment file.

required
covers list of pathlib.Path or str

Paths to cover images.

required
channel_names Optional[list[str]]

Channel names, by default None.

None
model_version str

Model version.

"0.1.0"

Returns:

Type Description
ModelDescr

Model description.

extract_model_path(model_desc)

Return the relative path to the weights and configuration files.

Parameters:

Name Type Description Default
model_desc ModelDescr

Model description.

required

Returns:

Type Description
tuple of (path, path)

Weights and configuration paths.

get_unzip_path(zip_path)

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

Parameters:

Name Type Description Default
zip_path Path

Path to the bioimage.io model.

required

Returns:

Type Description
Path

Path to the unzipped folder.