MONAI
MONAI copied to clipboard
Adding metadata schema to the code base itself
Fixes #7303 #6959.
Description
This adds the schema file into the code base (but this maybe should be elsewhere). The changes implement a number of new things:
- Moved definitions into a
$defssection per the JSON schema standard - Permits multiple input arguments and return results from networks with arbitrary names using the
patternPropertiesmechanism - Allows the types of inputs and outputs to be, additional to just tensors, numbers, booleans, or strings
- Outputs after post processing can be specified with the
post_processed_outputssection if they are significantly changed with the post-process transforms defined in scripts - Multiple network IO formats can be specified in addition to
network_data_format, these must follow the pattern<name>_data_format required_packages_versionadded in addition tooptional_packages_version
#7253 depends on this schema change.
Types of changes
- [x] Non-breaking change (fix or new feature that would not break existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running
./runtests.sh -f -u --net --coverage. - [ ] Quick tests passed locally by running
./runtests.sh --quick --unittests --disttests. - [ ] In-line docstrings updated.
- [ ] Documentation updated, tested
make htmlcommand in thedocs/folder.
Should this file exist here or put elsewhere? Currently the schema is stored in extra-test-data within a release, but it has to be somewhere accessible through a URL in the metadata.json files. #4048 references the issue of making this URL accessible.
Should this file exist here or put elsewhere? Currently the schema is stored in
extra-test-datawithin a release, but it has to be somewhere accessible through a URL in themetadata.jsonfiles. #4048 references the issue of making this URL accessible.
Yes, just make this draft PR to help review and leave comments. After finished we can move it in extra-test-data or somewhere else.
Can we prepare a test case, like using 1) this schema and 2) prepare a fake metadata.json file to use verify_metadata in monai.bundle.scripts to verify that it works?
Can we prepare a test case, like using 1) this schema and 2) prepare a fake metadata.json file to use
verify_metadatainmonai.bundle.scriptsto verify that it works?
Yes I can put that together shortly.
Can we prepare a test case, like using 1) this schema and 2) prepare a fake metadata.json file to use
verify_metadatainmonai.bundle.scriptsto verify that it works?
@yiheng-wang-nv I've added a notebook demonstrating this now. We won't want to merge this into dev, it's just a demo as the schema file is.
Outstanding discussion points:
- Should
required_packages_versionand/oroptional_packages_versionbe required at all? Ifrequired_packages_versionis required then model zoo bundles will need updating. - Should we allow multiple network formats with added
[NAME]_data_formatblocks but require there to always be anetwork_data_formatblock? The diffusion models in the zoo will need fixing if so.
I've made required_packages_version mandatory but not optional_packages_version. We'll keep the [NAME]_data_format content of the schema. I've added documentation about other details as well.
Hi @ericspod @KumoLiu @Nic-Ma , I rechecked this draft PR's changes.
I agree to use required_packages_version and enable multiple network formats. After this PR is merged, we can start to update MONAI model zoo bundles to use this schema.
Hi @ericspod , are there any other blockers for this PR? (we can remove the notebook before merge)
@yiheng-wang-nv I don't have any blockers for this PR. The jupyter notebook and schema file should be removed and the schema file instead uploaded here where the other versions live.
@yiheng-wang-nv I don't have any blockers for this PR. The jupyter notebook and schema file should be removed and the schema file instead uploaded here where the other versions live.
I see. Thanks for the response. Do you think we should add supported_apps into this schema directly? (sorry for mis-clicked the close button and reopen button)
I agree we can directly add supported_apps to the schema and make it optional. In this PR, we'll only merge the rst file and add the new schema here. After that, we need to merge this PR: https://github.com/Project-MONAI/MONAI/pull/7253. Subsequently, we will update all bundles for consistency.
So The first step is to add supported_apps and upload the new schema. What do you think?
agree we can directly add
supported_appsto the schema and make it optional. In this PR, we'll only merge the rst file and add the new schema here. After that, we need to merge this PR: #7253. Subsequently, we will update all bundles for consistency. So The first step is to addsupported_appsand upload the new schema. What do you think?
I've added supported_apps to the schema, please check the wording of the description and documentation matches the intent.
My comments are minor and please feel free to skip/close them as needed for merge. Thanks!
I've addressed comments and remove the schema file now.
The schema is now uploaded as meta_schema_20240725.json.
/build
Thanks @ericspod for the contribution. I will use the new schema in: https://github.com/Project-MONAI/model-zoo/pull/605