Skip to content

Commit

Permalink
Update the shape description
Browse files Browse the repository at this point in the history
Adapted from #52 by @esgomezm
  • Loading branch information
constantinpape committed Dec 4, 2020
1 parent a6507e6 commit 9d1dfb6
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To get a quick overview of the config file, see an example file [here](https://g

## Model Specification

A model entry in the bioimage.io model zoo is defined by a configuration file `<model name>.model.yaml`.
A model entry in the bioimage.io model zoo is defined by a configuration file `model.yaml`.
The configuration file must contain the following \[optional\]* keys (* denotes that the field is optional depending on input to another field):


Expand All @@ -36,7 +36,7 @@ The authors are the creators of the specifications and the primary points of con

- `cite`
A citation entry or list of citation entries.
Each entry contains of a mandatory `text` field and either one or both of `doi` and `url`.
Each entry contains a mandatory `text` field and either one or both of `doi` and `url`.
E.g. the citation for the model architecture and/or the training data used.

- `git_repo`
Expand All @@ -62,12 +62,20 @@ Must be a list of *tensor specification keys*.
*tensor specification keys*:
- `name` tensor name
- `data_type` data type (e.g. float32)
- `data_range` tuple of (minimum, maximum)
- `axes` string of axes identifying characters from: btczyx
- `shape` specification of tensor shape\
Either as *exact shape with same length as `axes`*,\
or (only for input) as {`min` *minimum shape with same length as `axes`*, `step` *minimum shape change with same length as `axes`*},\
or (only for output) as {`reference_input` *input tensor name*, `scale` *list of factors 'output_pix/input_pix' for each dimension*, `offset` *position of origin wrt to input*, `halo` *the halo to crop from the output tensor (for example to crop away boundary efects or for tiling)*}
- `data_range` tuple of (minimum, maximum), e.g. [0, 1]
- `axes` string of axes identifying characters from: btczyx. Same length and order as the axes in `shape`.
- `shape` specification of tensor shape. It can be specified in three diffeent ways:
1. as exact shape with same length as `axes`, e.g. `shape: [1, 512, 512, 1]`
2. (only for input) as a sequence of valid shapes.\
The valid shapes are given by `shape = min + k * step for k in {0, 1, ...}`. Specified by the following fields:
- `min` the minimum input shape with same length as `axes`
- `step` the minimum shape change with same length as `axes`
3. (only for output) in reference to the shape of an input tensor.\
The shape of the output tensor is `shape = shape(input_tensor) * scale + offset`. Specified by the following fields:
- `reference_input` name of the reference input tensor
- `scale` list of factors 'output_pix/input_pix' for each dimension
- `offset` position of origin wrt to input
- `halo` the halo to crop from the output tensor (for example to crop away boundary efects or for tiling). The halo should be croped from both size, i.e. `shape_after_crop = shape - 2 * halo`.
- `[preprocessing]` (only for input) list of transformations describing how this input should be preprocessed. Each entry has these keys:
- `name` name of preprocessing (see [supported_formats_and_operations.md#preprocessing](https://github.com/bioimage-io/configuration/blob/master/supported_formats_and_operations.md#preprocessing) for valid names).
- `[kwargs]` key word arguments for `preprocessing`.
Expand Down Expand Up @@ -134,19 +142,19 @@ For example:
- `[sample_inputs]` list of URIs to sample inputs to illustrate possible inputs for the model, for example stored as png or tif images.
- `[sample_outputs]` list of URIs to sample outputs corresponding to the `sample_inputs`.

- `weights` The weights for this model. Weights can be given for different formats, but should otherwise be equivalent.
- `weights` The weights for this model. Weights can be given for different formats, but should otherwise be equivalent. The available weight formats determine which consumers can use this model.
- `weight_format` Format of this set of weights. Weight formats can define additional (optional or required) fields. See [supported_formats_and_operations.md#Weight Format](https://github.com/bioimage-io/configuration/blob/master/supported_formats_and_operations.md#weight_format)
- `[authors]` a list of authors.
- `source` link to the weights file. Preferably an url to the weights file.
- `sha256` SHA256 checksum of the model weight file specified by `source` (see `models` section above for how to generate SHA256 checksum)
- `sha256` SHA256 checksum of the model weight file specified by `source` (see `sha256` section for how to generate the checksum)
- `[attachments]` weight specific attachments that will be included when generating the model package.

- `[run_mode]` Custom run mode for this model: for more complex prediction procedures like test time data augmentation that currently cannot be expressed in the specification. The different run modes should be listed in [supported_formats_and_operations.md#Run Modes](https://github.com/bioimage-io/configuration/blob/master/supported_formats_and_operations.md#run modes)
- `name` the name of the `run_mode`
- `[kwargs]` keyword arguments for this `run_mode`

- `[config]`
A custom configuration field that can contain any other keys which are not defined above. It can be very specifc to a framework or specific tool. To avoid conflicted defintions, it is recommended to wrap configuration into a sub-field named with the specific framework or tool name.
A custom configuration field that can contain any other keys which are not defined above. It can be very specifc to a framework or specific tool. To avoid conflicted definitions, it is recommended to wrap configuration into a sub-field named with the specific framework or tool name.

For example:
```yaml
Expand Down

0 comments on commit 9d1dfb6

Please sign in to comment.