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[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 Infer

  • dimension (int) – Input dimension

  • description (str) – Description

  • model_state_dict (str) – Key for loading the model state from checkpoint

  • input_key (str) – Input key for running inference

  • output_label_key (str) – Output key for storing result/label of inference

  • output_json_key (str) – Output key for storing result/label of inference

  • config (Optional[Dict[str, Any]]) – K,V pairs to be part of user config

  • load_strict (bool) – Load model in strict mode

  • roi_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[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 Infer

  • dimension (int) – Input dimension

  • description (str) – Description

  • model_state_dict (str) – Key for loading the model state from checkpoint

  • input_key (str) – Input key for running inference

  • output_label_key (str) – Output key for storing result/label of inference

  • output_json_key (str) – Output key for storing result/label of inference

  • config (Optional[Dict[str, Any]]) – K,V pairs to be part of user config

  • load_strict (bool) – Load model in strict mode

  • roi_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