コード例 #1
0
class ModelParent(PyBioSchema):
    uri = fields.URI(
        bioimageio_description=
        "Url of another model available on bioimage.io or path to a local model in the "
        "bioimage.io specification. If it is a url, it needs to be a github url linking to the page containing the "
        "model (NOT the raw file).")
    sha256 = fields.SHA256(
        bioimageio_description="Hash of the weights of the parent model.")
コード例 #2
0
class WithFileSource(PyBioSchema):
    source = fields.URI(
        required=True,
        bioimageio_description="Link to the source file. Preferably a url.")
    sha256 = fields.String(
        validate=validate.Length(equal=64),
        missing=None,
        bioimageio_description="SHA256 checksum of the source file specified. "
        + _common_sha256_hint,
    )
コード例 #3
0
class BioImageIoManifestNotebookEntry(PyBioSchema):
    id = fields.String(required=True)
    name = fields.String(required=True)
    documentation = fields.String(required=True)
    description = fields.String(required=True)

    cite = fields.List(fields.Nested(CiteEntry), missing=list)
    authors = fields.List(fields.String, required=True)
    covers = fields.List(fields.URI, missing=list)

    badges = fields.List(fields.Nested(Badge), missing=list)
    tags = fields.List(fields.String, missing=list)
    source = fields.URI(required=True)
    links = fields.List(fields.String, missing=list)  # todo: make List[URI]?
コード例 #4
0
class Badge(PyBioSchema):
    label = fields.String(required=True)
    icon = fields.URI()
    url = fields.URI()
コード例 #5
0
class Spec(PyBioSchema):
    format_version = fields.String(
        validate=validate.OneOf(raw_nodes.FormatVersion.__args__),
        required=True,
        bioimageio_description_order=0,
        bioimageio_description=
        f"""Version of the BioImage.IO Model Description File Specification used.
This is mandatory, and important for the consumer software to verify before parsing the fields.
The recommended behavior for the implementation is to keep backward compatibility and throw an error if the model yaml
is in an unsupported format version. The current format version described here is
{raw_nodes.FormatVersion.__args__[-1]}""",
    )
    name = fields.String(required=True)
    description = fields.String(
        required=True,
        bioimageio_description="A string containing a brief description.")

    authors = fields.List(
        fields.String,
        required=True,
        bioimageio_description="""A list of author strings.
A string can be separated by `;` in order to identify multiple handles per author.
The authors are the creators of the specifications and the primary points of contact.""",
    )
    cite = fields.Nested(
        CiteEntry,
        many=True,
        required=True,
        bioimageio_description="""A citation entry or list of citation entries.
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 = fields.String(
        validate=validate.URL(schemes=["http", "https"]),
        missing=None,
        bioimageio_description=
        """A url to the git repository, e.g. to Github or Gitlab.
If the model is contained in a subfolder of a git repository, then a url to the exact folder
(which contains the configuration yaml file) should be used.""",
    )
    tags = fields.List(fields.String,
                       required=True,
                       bioimageio_description="A list of tags.")
    license = fields.String(
        required=True,
        bioimageio_description=
        "A string to a common license name (e.g. `MIT`, `APLv2`) or a relative path to the "
        "license file.",
    )

    documentation = fields.URI(
        required=True,
        bioimageio_description=
        "Relative path to file with additional documentation in markdown.")
    covers = fields.List(
        fields.URI,
        missing=list,
        bioimageio_description=
        "A list of cover images provided by either a relative path to the model folder, or a "
        "hyperlink starting with 'https'.Please use an image smaller than 500KB and an aspect ratio width to height "
        "of 2:1. The supported image formats are: 'jpg', 'png', 'gif'.",  # todo: validate image format
    )
    attachments = fields.Dict(
        fields.String,
        fields.Union([fields.URI(), fields.List(fields.URI)]),
        missing=dict,
        bioimageio_maybe_required=True,
        bioimageio_description=
        """Dictionary of text keys and URI (or a list of URI) values to additional, relevant
files. E.g. we can place a list of URIs under the `files` to list images and other files that are necessary for the
documentation or for the model to run, these files will be included when generating the model package.""",
    )

    run_mode = fields.Nested(
        RunMode,
        missing=None,
        bioimageio_description=
        "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).",
    )
    config = fields.Dict(missing=dict)

    language = fields.String(
        validate=validate.OneOf(raw_nodes.Language.__args__),
        missing=None,
        bioimageio_maybe_required=True,
        bioimageio_description=
        f"Programming language of the source code. One of: "
        f"{', '.join(raw_nodes.Language.__args__)}. This field is only required if the field `source` is present.",
    )
    framework = fields.String(
        validate=validate.OneOf(raw_nodes.Framework.__args__),
        missing=None,
        bioimageio_description=
        f"The deep learning framework of the source code. One of: "
        f"{', '.join(raw_nodes.Framework.__args__)}. This field is only required if the field `source` is present.",
    )
    dependencies = fields.Dependencies(
        missing=None,
        bioimageio_description=
        "Dependency manager and dependency file, specified as `<dependency manager>:<relative "
        "path to file>`. For example: 'conda:./environment.yaml', 'maven:./pom.xml', or 'pip:./requirements.txt'",
    )
    timestamp = fields.DateTime(
        required=True,
        bioimageio_description=
        "Timestamp of the initial creation of this model in [ISO 8601]"
        "(#https://en.wikipedia.org/wiki/ISO_8601) format.",
    )
コード例 #6
0
class Weights(PyBioSchema):
    source = fields.URI(required=True)
    hash = fields.Dict()