ModelABC#

class ModelABC[source]#

Abstract base class for models used in tiatoolbox.

Methods

forward

Torch method, this contains logic for using layers defined in init.

infer_batch

Run inference on an input batch.

postproc

Define the post-processing of this class of model.

preproc

Define the pre-processing of this class of model.

Attributes

postproc_func

Return the current post-processing function of this instance.

preproc_func

Return the current pre-processing function of this instance.

abstract forward(*args, **kwargs)[source]#

Torch method, this contains logic for using layers defined in init.

abstract static infer_batch(model, batch_data, on_gpu)[source]#

Run inference on an input batch.

Contains logic for forward operation as well as I/O aggregation.

Parameters:
  • model (nn.Module) – PyTorch defined model.

  • batch_data (ndarray) – A batch of data generated by torch.utils.data.DataLoader.

  • on_gpu (bool) – Whether to run inference on a GPU.

static postproc(image)[source]#

Define the post-processing of this class of model.

property postproc_func#

Return the current post-processing function of this instance.

static preproc(image)[source]#

Define the pre-processing of this class of model.

property preproc_func#

Return the current pre-processing function of this instance.