Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: YunLiu <[email protected]>
  • Loading branch information
KumoLiu committed Oct 15, 2024
1 parent 0e1d13f commit 2b75338
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions models/spleen_ct_segmentation_real_time/scripts/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class InferenceWorkflow(PythonicWorkflow):
workflow.dataflow.update(input_loader({"image": "/workspace/Data/Task09_Spleen/imagesTr/spleen_38.nii.gz"}))
workflow.run()
# get output
output = workflow.dataflow[CommonKeys.PRED]
"""

def __init__(self, workflow_type: str = "inference", properties_path: str = "./properties.json"):
Expand Down Expand Up @@ -94,8 +96,9 @@ def initialize(self):
def run(self):
data = self.dataset[0]
inputs = data[CommonKeys.IMAGE].unsqueeze(0).to(self.device)
# define sliding window size and batch size for windows inference
data[CommonKeys.PRED] = self.inferer(inputs, self.net)
self.net.eval()
with torch.no_grad():
data[CommonKeys.PRED] = self.inferer(inputs, self.net)
self.dataflow.update({CommonKeys.PRED: self.postprocessing(data)[CommonKeys.PRED]})

def finalize(self):
Expand Down

0 comments on commit 2b75338

Please sign in to comment.