Skip to content
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

Add undefined label prompt check #693

Merged
merged 25 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2f9c10e
Fix point bugs and finetuning issue
heyufan1995 Aug 27, 2024
d214d06
fixes racing condition when InvertD is used along with ThreadDataLoader
heyufan1995 Aug 27, 2024
14e2385
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 27, 2024
26749d9
Merge branch 'dev' into dev
yiheng-wang-nv Aug 29, 2024
a9e030c
Fix comments
heyufan1995 Aug 29, 2024
f859686
Merge branch 'dev' of github.com:heyufan1995/model-zoo into dev
heyufan1995 Aug 29, 2024
f5725fd
Merge branch 'dev' of https://github.com/Project-MONAI/model-zoo into…
heyufan1995 Sep 16, 2024
9d13d20
Small fix
heyufan1995 Sep 16, 2024
25d10fc
Resolve oom and update readme
heyufan1995 Sep 18, 2024
16f4864
Fix format
heyufan1995 Sep 19, 2024
502df2e
Merge branch 'dev' of https://github.com/Project-MONAI/model-zoo into…
heyufan1995 Sep 19, 2024
78f2902
Merge branch 'dev' of github.com:heyufan1995/model-zoo into dev
heyufan1995 Sep 26, 2024
4988add
Fix eval bug
heyufan1995 Sep 26, 2024
5e66231
Merge branch 'dev' of github.com:heyufan1995/model-zoo into dev
heyufan1995 Oct 9, 2024
551d4ba
Add undefined label prompt check
heyufan1995 Oct 9, 2024
b15ccec
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 9, 2024
702e227
Merge branch 'dev' into dev
yiheng-wang-nv Oct 10, 2024
75f6687
Merge branch 'dev' into dev
drbeh Oct 10, 2024
11ad8bc
Merge branch 'Project-MONAI:dev' into dev
heyufan1995 Oct 10, 2024
d6569e6
Update meta version
heyufan1995 Oct 10, 2024
67cb148
fix code format
yiheng-wang-nv Oct 10, 2024
6c78423
remove unnecessary list
yiheng-wang-nv Oct 10, 2024
987c242
remove set
yiheng-wang-nv Oct 10, 2024
8098584
ensure type correct
yiheng-wang-nv Oct 10, 2024
1e33e1e
update zero shot test case
yiheng-wang-nv Oct 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion ci/unit_tests/test_vista3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
TEST_CASE_INFER_MULTI_NEW_STR_PROMPT = [
{
"bundle_root": "models/vista3d",
"input_dict": {"label_prompt": ["new class 1", "new class 2", "new class 3"]},
"input_dict": {"label_prompt": ["new class 1"], "points": [[123, 212, 151]], "point_labels": [1]},
"patch_size": [32, 32, 32],
"checkpointloader#_disabled_": True, # do not load weights"
"initialize": ["$monai.utils.set_determinism(seed=123)"],
Expand Down Expand Up @@ -223,6 +223,26 @@
"error": "Label prompt can only be a single object if provided with point prompts.",
}
],
[
{
"bundle_root": "models/vista3d",
"input_dict": {"label_prompt": [16, 25, 26]},
"patch_size": [32, 32, 32],
"checkpointloader#_disabled_": True, # do not load weights"
"initialize": ["$monai.utils.set_determinism(seed=123)"],
"error": "Undefined label prompt detected. Provide point prompts for zero-shot.",
}
],
[
{
"bundle_root": "models/vista3d",
"input_dict": {"label_prompt": [136]},
"patch_size": [32, 32, 32],
"checkpointloader#_disabled_": True, # do not load weights"
"initialize": ["$monai.utils.set_determinism(seed=123)"],
"error": "Undefined label prompt detected. Provide point prompts for zero-shot.",
}
],
]


Expand Down
3 changes: 2 additions & 1 deletion models/vista3d/configs/metadata.json
Original file line number Diff line number Diff line change
@@ -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.5.3",
"version": "0.5.4",
"changelog": {
"0.5.4": "add undefined label prompt check",
"0.5.3": "update readme",
"0.5.2": "fix eval issue",
"0.5.1": "add description for zero-shot and upate eval",
Expand Down
4 changes: 4 additions & 0 deletions models/vista3d/scripts/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ def check_prompts_format(self, label_prompt, points, point_labels):
raise ValueError("Label prompt must be a list of single scalar, [1,2,3,4,...,].")
if not np.all([(x < 255).item() for x in label_prompt]):
raise ValueError("Current bundle only supports label prompt smaller than 255.")
if points is None:
supported_list = list({i + 1 for i in range(132)} - {16, 18, 129, 130, 131})
if not np.all([x in supported_list for x in label_prompt]):
raise ValueError("Undefined label prompt detected. Provide point prompts for zero-shot.")
Nic-Ma marked this conversation as resolved.
Show resolved Hide resolved
else:
raise ValueError("Label prompt must be a list, [1,2,3,4,...,].")
# check points
Expand Down
Loading