-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the schema for MONAI Bundle #7303
Comments
I have prepared a new bundle schema which should address these open issues and a few other issues I've considered/discovered. The following will include a "required_packages_version" component, an ability to differentiate between raw network output and postprocess output, a way to specify the types of arguments and return values which can be other than tensors, and an ability to specify the data format for multiple networks using pattern-based properties. {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$defs": {
"tensor": {
"$comment": "Represents a tensor object argument/return value, can be MetaTensor.",
"type": "object",
"properties": {
"type": { "type": "string" },
"format": { "type": "string" },
"num_channels": { "type": "integer" },
"spatial_shape": {
"type": "array",
"items": {
"type": ["string", "integer"]
}
},
"dtype": { "type": "string" },
"value_range": {
"type": "array",
"items": { "type": "number" }
},
"is_patch_data": { "type": "boolean" },
"channel_def": { "type": "object" }
},
"required": [
"type",
"format",
"num_channels",
"spatial_shape",
"dtype",
"value_range"
]
},
"argument": {
"$comment": "Acceptable input types for model forward pass, arbitrary Python objects not covered.",
"anyOf": [
{ "type": "number" },
{ "type": "integer" },
{ "type": "string" },
{ "type": "boolean" },
{ "$ref": "#/$defs/tensor" }
]
},
"result": {
"$comment": "Return value from a model's forward pass, same as an argument for now.",
"$ref": "#/$defs/argument"
},
"network_io": {
"description": "Defines the format, shape, and meaning of inputs and outputs to the model.",
"type": "object",
"$comment": "Arguments/return values described by pattern property, order considered significant.",
"properties": {
"inputs": {
"type": "object",
"patternProperties": {
"^.+$": { "$ref": "#/$defs/argument" }
}
},
"outputs": {
"type": "object",
"patternProperties": {
"^.+$": { "$ref": "#/$defs/result" }
}
},
"post_processed_outputs": {
"$comment": "Return value format after post-processing, not needed if not changed.",
"type": "object",
"patternProperties": {
"^.+$": { "$ref": "#/$defs/result" }
}
}
},
"required": [
"inputs",
"outputs"
]
}
},
"type": "object",
"properties": {
"schema": {
"description": "URL of the schema file.",
"type": "string"
},
"version": {
"description": "Version number of the bundle.",
"type": "string"
},
"changelog": {
"description": "Dictionary relating previous version names to strings describing the version.",
"type": "object"
},
"monai_version": {
"description": "Version of MONAI the bundle was generated with.",
"type": "string"
},
"pytorch_version": {
"description": "Version of PyTorch the bundle was generated with.",
"type": "string"
},
"numpy_version": {
"description": "Version of NumPy the bundlewas generated with.",
"type": "string"
},
"required_packages_version": {
"description": "Dictionary relating required additional package names to their versions.",
"type": "object"
},
"optional_packages_version": {
"description": "Dictionary relating optional additional package names to their versions.",
"type": "object"
},
"task": {
"description": "Plain-language description of what the bundle is meant to do.",
"type": "string"
},
"description": {
"description": "Longer form description of what the bundle is, what it does, etc.",
"type": "string"
},
"authors": {
"description": "State author(s) of the bundle.",
"type": "string"
},
"copyright": {
"description": "State copyright of the bundle.",
"type": "string"
},
"data_source": {
"description": "Where to download or prepare the data used in this bundle.",
"type": "string"
},
"data_type": {
"description": "Type of the data, like: `dicom`, `nibabel`, etc.",
"type": "string"
},
"image_classes": {
"description": "Description for every class of the input tensors.",
"type": "string"
},
"label_classes": {
"description": "Description for every class of the input tensors if present.",
"type": "string"
},
"pred_classes": {
"description": "Description for every class of the output prediction(s).",
"type": "string"
},
"eval_metrics": {
"description": "Dictionary relating evaluation metrics to the achieved scores.",
"type": "object"
},
"intended_use": {
"description": "What the bundle is to be used for, ie. what task it accomplishes.",
"type": "string"
},
"references": {
"description": "List of published referenced relating to the bundle.",
"type": "array"
},
"network_data_format": { "$ref": "#/$defs/network_io" }
},
"$comment": "This permits definitions for multiple networks with format <network-name>_data_format",
"patternProperties": {
"^[_a-zA-Z0-9]+_data_format$": { "$ref": "#/$defs/network_io" }
},
"required": [
"schema",
"version",
"monai_version",
"pytorch_version",
"numpy_version",
"required_packages_version",
"optional_packages_version",
"task",
"description",
"authors",
"copyright",
"network_data_format"
]
} |
Points about this schema:
|
Both |
Since we already know all of the packages we need after the bundle was created, we could remove 'optional_packages_version', which may be confusing, and instead, directly use 'required_packages_version'. What do you think? cc @Nic-Ma |
So do we currently have such a need to add multiple networks in a bundle?
Instead of renaming and replying on the pattern property, I think these two generative models missing the |
Hi @ericspod, thanks for the new schema you updated, I agree with the idea of |
There are several things we want to update in the schema.
https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json
optional_packages_version
torequired_packages_version
, Renameoptional_packages_version
torequired_packages_version
#7253The text was updated successfully, but these errors were encountered: