diff --git a/ci/unit_tests/test_vista3d.py b/ci/unit_tests/test_vista3d.py index 1f00eb31..6318f2d5 100644 --- a/ci/unit_tests/test_vista3d.py +++ b/ci/unit_tests/test_vista3d.py @@ -9,6 +9,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import json import os import shutil import sys @@ -441,6 +442,15 @@ def test_error_prompt_infer_config(self, override): original_exception = runtime_error.__cause__ self.assertEqual(str(original_exception), override["error"]) + @parameterized.expand([TEST_CASE_INFER]) + def test_labels_dict(self, override): + bundle_root = override["bundle_root"] + label_dict_file = os.path.join(bundle_root, "docs/labels.json") + if not os.path.isfile(label_dict_file): + raise ValueError(f"labels.json not found in {bundle_root}") + with open(label_dict_file) as f: + _ = json.load(f) + if __name__ == "__main__": loader = unittest.TestLoader() diff --git a/models/vista3d/configs/metadata.json b/models/vista3d/configs/metadata.json index dcf174b3..8f60e7d9 100644 --- a/models/vista3d/configs/metadata.json +++ b/models/vista3d/configs/metadata.json @@ -1,7 +1,8 @@ { "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20240725.json", - "version": "0.4.9", + "version": "0.5.0", "changelog": { + "0.5.0": "update json file link and add test", "0.4.9": "fix oom issue and update readme", "0.4.8": "use 0.3 overlap for inference", "0.4.7": "update tensorrt benchmark results", diff --git a/models/vista3d/docs/README.md b/models/vista3d/docs/README.md index a460ca11..6934ecbb 100644 --- a/models/vista3d/docs/README.md +++ b/models/vista3d/docs/README.md @@ -68,7 +68,7 @@ ConfigParser.export_config_file(parser.config, json_name, indent=4) ### Configurations #### `label_mappings` -The core concept of label_mapping is to convert ground-truth label index of each dataset to a unified class index. For example, "Spleen" in MSD09 groundtruth will be represented by 1, while in AbdomenCT-1K it's 3. We unified a global label index [`label_dict`](./labels.json) to represent all 132 classes, and create a label mapping to map those local index to this global index. So when a user is training on their own dataset, we need to know this mapping. +The core concept of label_mapping is to convert ground-truth label index of each dataset to a unified class index. For example, "Spleen" in MSD09 groundtruth will be represented by 1, while in AbdomenCT-1K it's 3. We unified a global label index (`docs/labels.json`) to represent all 132 classes, and create a label mapping to map those local index to this global index. So when a user is training on their own dataset, we need to know this mapping. The current label mapping `[[1, 3]]` indicates that training labels' class indices `1` is mapped to the VISTA model's class `3` (format `[[src_class_0, dst_class_0], [src_class_1, dst_class_1], ...]`). So during inference, "3" is used to segment spleen. @@ -173,7 +173,7 @@ list(set([i+1 for i in range(132)]) - set([2,16,18,20,21,23,24,25,26,27,128,129, - The `points` together with `label_prompts` for "Kidney", "Lung", "Bone" (class index [2, 20, 21]) are not allowed since those prompts will be divided into sub-categories (e.g. left kidney and right kidney). Use `points` for the sub-categories as defined in the `inference.json`. ### `label_prompt` and `label_dict` -The `label_dict` defined in [`labels.json`](../docs/labels.json) has in total 132 classes. However, there are 5 we do not support and we keep them due to legacy issue. So in total +The `label_dict` defined in `docs/labels.json` has in total 132 classes. However, there are 5 we do not support and we keep them due to legacy issue. So in total VISTA3D support 127 classes. ``` diff --git a/models/vista3d/large_files.yml b/models/vista3d/large_files.yml index 586150ff..987c6890 100644 --- a/models/vista3d/large_files.yml +++ b/models/vista3d/large_files.yml @@ -4,4 +4,6 @@ large_files: hash_val: "6ce45a8edde4400c5d28d5e74d7b61d5" hash_type: "md5" - path: "docs/labels.json" - url: "https://github.com/Project-MONAI/tutorials/blob/e66be5955d2b4f5959884ca026932762954b19c5/vista_3d/label_dict.json" + url: "https://raw.githubusercontent.com/Project-MONAI/tutorials/e66be5955d2b4f5959884ca026932762954b19c5/vista_3d/label_dict.json" + hash_val: "71ff501086a80fe973ab843d2f7974c2" + hash_type: "md5"