Skip to content

Commit d587183

Browse files
Update requirements and fix data shape handling in Monai nUNet Bundle Inference Operator
Signed-off-by: Simone Bendazzoli <[email protected]>
1 parent cbbc7a4 commit d587183

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

examples/apps/ai_spleen_nnunet_seg_app/requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ numpy-stl>=2.12.0
77
trimesh>=3.8.11
88
nibabel>=3.2.1
99
torch>=1.12.0
10-
monai>=1.0.0
11-
nnunetv2>=2.5.1
10+
git+https://github.com/SimoneBendazzoli93/dynamic-network-architectures.git
11+
git+https://github.com/SimoneBendazzoli93/MONAI.git@dev
12+
git+https://github.com/SimoneBendazzoli93/nnUNet.git

monai/deploy/operators/monai_nnunet_bundle_inference_operator.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ def _init_config(self, config_names):
7575

7676
super()._init_config(config_names)
7777
parser = get_bundle_config(str(self._bundle_path), config_names)
78-
parser['bundle_root'] = str(Path(self._bundle_path).parent.parent.parent)
7978
self._parser = parser
8079

8180
self._nnunet_predictor = parser.get_parsed_content("network_def")
@@ -85,4 +84,6 @@ def predict(self, data: Any, *args, **kwargs) -> Union[Image, Any, Tuple[Any, ..
8584

8685
self._nnunet_predictor.predictor.network = self._model_network
8786
#os.environ['nnUNet_def_n_proc'] = "1"
88-
return self._nnunet_predictor(torch.unsqueeze(data, 0))
87+
if len(data.shape) == 4:
88+
data = data[None]
89+
return self._nnunet_predictor(data)

0 commit comments

Comments
 (0)