monailabel.interfaces.tasks.infer module¶
- class monailabel.interfaces.tasks.infer.InferTask(path, network, type, labels, dimension, description, model_state_dict='model', input_key='image', output_label_key='pred', output_json_key='result', config=None, load_strict=True, roi_size=None, preload=False, train_mode=False, skip_writer=False)[source]¶
Bases:
monailabel.tasks.infer.basic_infer.BasicInferTask
- Parameters
path (
Union
[None
,str
,Sequence
[str
]]) – Model File Path. Supports multiple paths to support versions (Last item will be picked as latest)network (
Optional
[None
,Any
]) – Model Network (e.g. monai.networks.xyz). None in case if you use TorchScript (torch.jit).type (
Union
[str
,InferType
]) – Type of Infer (segmentation, deepgrow etc..)labels (
Union
[str
,None
,Sequence
[str
],Dict
[Any
,Any
]]) – Labels associated to this Inferdimension (
int
) – Input dimensiondescription (
str
) – Descriptionmodel_state_dict (
str
) – Key for loading the model state from checkpointinput_key (
str
) – Input key for running inferenceoutput_label_key (
str
) – Output key for storing result/label of inferenceoutput_json_key (
str
) – Output key for storing result/label of inferenceconfig (
Optional
[None
,Dict
[str
,Any
]]) – K,V pairs to be part of user configload_strict (
bool
) – Load model in strict moderoi_size – ROI size for scanning window inference
preload – Preload model/network on all available GPU devices
train_mode – Run in Train mode instead of eval (when network has dropouts)
skip_writer – Skip Writer and return data dictionary
- __init__(path, network, type, labels, dimension, description, model_state_dict='model', input_key='image', output_label_key='pred', output_json_key='result', config=None, load_strict=True, roi_size=None, preload=False, train_mode=False, skip_writer=False)¶
- Parameters
path (
Union
[None
,str
,Sequence
[str
]]) – Model File Path. Supports multiple paths to support versions (Last item will be picked as latest)network (
Optional
[None
,Any
]) – Model Network (e.g. monai.networks.xyz). None in case if you use TorchScript (torch.jit).type (
Union
[str
,InferType
]) – Type of Infer (segmentation, deepgrow etc..)labels (
Union
[str
,None
,Sequence
[str
],Dict
[Any
,Any
]]) – Labels associated to this Inferdimension (
int
) – Input dimensiondescription (
str
) – Descriptionmodel_state_dict (
str
) – Key for loading the model state from checkpointinput_key (
str
) – Input key for running inferenceoutput_label_key (
str
) – Output key for storing result/label of inferenceoutput_json_key (
str
) – Output key for storing result/label of inferenceconfig (
Optional
[None
,Dict
[str
,Any
]]) – K,V pairs to be part of user configload_strict (
bool
) – Load model in strict moderoi_size – ROI size for scanning window inference
preload – Preload model/network on all available GPU devices
train_mode – Run in Train mode instead of eval (when network has dropouts)
skip_writer – Skip Writer and return data dictionary