Skip to content

Commit c90f42c

Browse files
matt3opre-commit-ci[bot]tangy5SachidanandAlle
authored
Fix network loading (#1533)
* Add warning if the imported network does not have the right keys Signed-off-by: Matthias Hadlich <[email protected]> * Update warning Signed-off-by: Matthias Hadlich <[email protected]> * Set load_strict to false for deepedit Signed-off-by: Matthias Hadlich <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Set load_strict=False for all existing models Signed-off-by: Matthias Hadlich <[email protected]> * Fix double load_strict=False Signed-off-by: Matthias Hadlich <[email protected]> --------- Signed-off-by: Matthias Hadlich <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: tangy5 <[email protected]> Co-authored-by: SACHIDANAND ALLE <[email protected]>
1 parent 7208641 commit c90f42c

File tree

16 files changed

+17
-3
lines changed

16 files changed

+17
-3
lines changed

monailabel/tasks/infer/bundle.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def __init__(
8787
extend_load_image: bool = True,
8888
add_post_restore: bool = True,
8989
dropout: float = 0.0,
90+
load_strict=False,
9091
**kwargs,
9192
):
9293
self.valid: bool = False
@@ -149,6 +150,7 @@ def __init__(
149150
dimension=dimension,
150151
description=description,
151152
preload=strtobool(conf.get("preload", "false")),
153+
load_strict=load_strict,
152154
**kwargs,
153155
)
154156

sample-apps/endoscopy/lib/infers/deepedit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def __init__(
5555
labels=labels,
5656
dimension=dimension,
5757
description=description,
58+
load_strict=False,
5859
**kwargs,
5960
)
6061

sample-apps/endoscopy/lib/infers/inbody.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class InBody(BundleInferTask):
2424
"""
2525

2626
def __init__(self, path: str, conf: Dict[str, str], **kwargs):
27-
super().__init__(path, conf, type=InferType.CLASSIFICATION, add_post_restore=False, **kwargs)
27+
super().__init__(path, conf, type=InferType.CLASSIFICATION, add_post_restore=False, load_strict=False, **kwargs)
2828

2929
# Override Labels
3030
self.labels = {"InBody": 0, "OutBody": 1}

sample-apps/endoscopy/lib/infers/tooltracking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ToolTracking(BundleInferTask):
2828
"""
2929

3030
def __init__(self, path: str, conf: Dict[str, str], **kwargs):
31-
super().__init__(path, conf, type=InferType.SEGMENTATION, **kwargs)
31+
super().__init__(path, conf, type=InferType.SEGMENTATION, load_strict=False, **kwargs)
3232

3333
# Override Labels
3434
self.labels = {"Tool": 1}

sample-apps/pathology/lib/infers/classification_nuclei.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ClassificationNuclei(BundleInferTask):
2424
"""
2525

2626
def __init__(self, path: str, conf: Dict[str, str], **kwargs):
27-
super().__init__(path, conf, type=InferType.CLASSIFICATION, add_post_restore=False, **kwargs)
27+
super().__init__(path, conf, type=InferType.CLASSIFICATION, add_post_restore=False, load_strict=False, **kwargs)
2828

2929
# Override Labels
3030
self.labels = {

sample-apps/pathology/lib/infers/nuclick.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def __init__(self, path: str, conf: Dict[str, str], **kwargs):
3838
conf,
3939
type=InferType.ANNOTATION,
4040
add_post_restore=False,
41+
load_strict=False,
4142
**kwargs,
4243
pre_filter=[LoadImaged, SqueezeDimd],
4344
post_filter=[KeepLargestConnectedComponentd, SaveImaged],

sample-apps/pathology/lib/infers/segmentation_nuclei.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def __init__(
4848
labels=labels,
4949
dimension=dimension,
5050
description=description,
51+
load_strict=False,
5152
**kwargs,
5253
)
5354

sample-apps/radiology/lib/infers/deepedit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def __init__(
6565
input_key="image",
6666
output_label_key="pred",
6767
output_json_key="result",
68+
load_strict=False,
6869
**kwargs,
6970
)
7071

sample-apps/radiology/lib/infers/deepgrow.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def __init__(
6363
labels=labels,
6464
dimension=dimension,
6565
description=description,
66+
load_strict=False,
6667
**kwargs,
6768
)
6869

sample-apps/radiology/lib/infers/deepgrow_pipeline.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def __init__(
6868
dimension=dimension,
6969
description=description,
7070
config={"cache_transforms": True, "cache_transforms_in_memory": True, "cache_transforms_ttl": 300},
71+
load_strict=False,
7172
)
7273
self.model_3d = model_3d
7374
self.spatial_size = spatial_size

0 commit comments

Comments
 (0)