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

Fix network loading #1533

Merged
merged 11 commits into from
Aug 31, 2023
2 changes: 2 additions & 0 deletions monailabel/tasks/infer/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def __init__(
extend_load_image: bool = True,
add_post_restore: bool = True,
dropout: float = 0.0,
load_strict=False,
**kwargs,
):
self.valid: bool = False
Expand Down Expand Up @@ -149,6 +150,7 @@ def __init__(
dimension=dimension,
description=description,
preload=strtobool(conf.get("preload", "false")),
load_strict=load_strict,
**kwargs,
)

Expand Down
1 change: 1 addition & 0 deletions sample-apps/endoscopy/lib/infers/deepedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def __init__(
labels=labels,
dimension=dimension,
description=description,
load_strict=False,
**kwargs,
)

Expand Down
2 changes: 1 addition & 1 deletion sample-apps/endoscopy/lib/infers/inbody.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class InBody(BundleInferTask):
"""

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

# Override Labels
self.labels = {"InBody": 0, "OutBody": 1}
Expand Down
2 changes: 1 addition & 1 deletion sample-apps/endoscopy/lib/infers/tooltracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ToolTracking(BundleInferTask):
"""

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

# Override Labels
self.labels = {"Tool": 1}
Expand Down
2 changes: 1 addition & 1 deletion sample-apps/pathology/lib/infers/classification_nuclei.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ClassificationNuclei(BundleInferTask):
"""

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

# Override Labels
self.labels = {
Expand Down
1 change: 1 addition & 0 deletions sample-apps/pathology/lib/infers/nuclick.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(self, path: str, conf: Dict[str, str], **kwargs):
conf,
type=InferType.ANNOTATION,
add_post_restore=False,
load_strict=False,
**kwargs,
pre_filter=[LoadImaged, SqueezeDimd],
post_filter=[KeepLargestConnectedComponentd, SaveImaged],
Expand Down
1 change: 1 addition & 0 deletions sample-apps/pathology/lib/infers/segmentation_nuclei.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def __init__(
labels=labels,
dimension=dimension,
description=description,
load_strict=False,
**kwargs,
)

Expand Down
1 change: 1 addition & 0 deletions sample-apps/radiology/lib/infers/deepedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def __init__(
input_key="image",
output_label_key="pred",
output_json_key="result",
load_strict=False,
**kwargs,
)

Expand Down
1 change: 1 addition & 0 deletions sample-apps/radiology/lib/infers/deepgrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def __init__(
labels=labels,
dimension=dimension,
description=description,
load_strict=False,
**kwargs,
)

Expand Down
1 change: 1 addition & 0 deletions sample-apps/radiology/lib/infers/deepgrow_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def __init__(
dimension=dimension,
description=description,
config={"cache_transforms": True, "cache_transforms_in_memory": True, "cache_transforms_ttl": 300},
load_strict=False,
)
self.model_3d = model_3d
self.spatial_size = spatial_size
Expand Down
1 change: 1 addition & 0 deletions sample-apps/radiology/lib/infers/localization_spine.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def __init__(
labels=labels,
dimension=dimension,
description=description,
load_strict=False,
**kwargs,
)
self.target_spacing = target_spacing
Expand Down
1 change: 1 addition & 0 deletions sample-apps/radiology/lib/infers/localization_vertebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def __init__(
labels=labels,
dimension=dimension,
description=description,
load_strict=False,
**kwargs,
)
self.target_spacing = target_spacing
Expand Down
1 change: 1 addition & 0 deletions sample-apps/radiology/lib/infers/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def __init__(
labels=labels,
dimension=dimension,
description=description,
load_strict=False,
**kwargs,
)
self.target_spacing = target_spacing
Expand Down
1 change: 1 addition & 0 deletions sample-apps/radiology/lib/infers/segmentation_spleen.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def __init__(
labels=labels,
dimension=dimension,
description=description,
load_strict=False,
**kwargs,
)
self.target_spacing = target_spacing
Expand Down
1 change: 1 addition & 0 deletions sample-apps/radiology/lib/infers/segmentation_vertebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def __init__(
labels=labels,
dimension=dimension,
description=description,
load_strict=False,
**kwargs,
)
self.target_spacing = target_spacing
Expand Down
1 change: 1 addition & 0 deletions sample-apps/radiology/lib/infers/vertebra_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def __init__(
labels=task_seg_vertebra.labels,
dimension=task_seg_vertebra.dimension,
description=description,
load_strict=False,
**kwargs,
)

Expand Down