#all_skip
from fastMONAI.vision_all import *
from monai.apps import DecathlonDataset
Inference with exported learner
#task = 'Task09_Spleen'
= 'Task01_BrainTumour' task
= Path('../data')
path =True) path.mkdir(exist_ok
= DecathlonDataset(root_dir=path, task=task, section="test", download=True,
test_data =0, num_workers=3) cache_num
= [data['image'] for data in test_data.data] test_imgs
= load_learner('braintumor_model.pkl', cpu=False); learn_inf
= load_variables(pkl_fn='vars.pkl')
_, reorder, resample reorder, resample
(False, [1.0, 1.0, 1.0])
= Path('../data/results/braintumor')
save_path =True, exist_ok=True) path.mkdir(parents
= 3
idx = test_imgs[idx] img_fn
= inference(learn_inf, reorder, resample, fn, save_path=save_path) pred_fn
from torchio import Subject, ScalarImage, LabelMap
= Subject(image=ScalarImage(img_fn), mask=LabelMap(pred_fn))
subject =(10,5)) subject.plot(figsize