Skip to content

Metrics Documentation

Kison Ho edited this page Jun 9, 2022 · 7 revisions

# Classes

Metric

The basic metric class

  • extends: torch.nn.Module

  • Could be use as a decorator of a function

  • Metric tensor is released from memory as soon as the result returned

  • [Deprecation Warning]: Method call is deprecated from v1.0.0 and will be removed from v1.1.0, override the forward method instead."

  • Properties:
    • result: The torch.Tensor of average metric results
  • Constructor

    • Parameters:
      • metric_fn: An optional Callable metrics function that accepts Any kind of prediction input and target and returns a metric torch.Tensor. A call method must be overriden if this parameter is set as None.
      • target: A str of target name in input and target during direct calling
  • forward

    • Forward the current result method
    • Parameters:
      • input: The prediction, or y_pred, in Any kind
      • target: The label, or y_true, in Any kind
    • Returns: The metric in torch.Tensor
  • reset

    • Reset the current results list

Accuracy

The traditional accuracy metric to compare two torch.Tensor

  • extends: Metric

SparseCategoricalAccuracy

The accuracy metric for normal integer labels

  • extends: Accuracy

  • Properties: - dim: An int of the probability dim index for the input

  • Constructor

      - Parameters:
      - dim: An `int` of the classification dimension
      - target: A `str` of target name in `input` and `target` during direct calling
    

CategoricalAccuracy

The accuracy metric for categorical labels

  • extends: SparseCategoricalAccuracy

MAE

The Mean Absolute Error metric

  • extends: Metric

ConfusionMetrics

The metric that calculates confusion metrics

  • extends: Metric

  • Constructor - Parameters: - num_classes: An int of the total number of classes - target: A str of target name in input and target during direct calling

InstanceIoU

The iIoU metric for segmentation

  • extends: ConfusionMetrics

MeanIoU

The mIoU metric for segmentation

  • extends: Metric

  • The old MIoU metric in v1.0.3 calculates iIoU and has been renamed to InstanceIoU

  • Constructor - Parameters: - dim: An int of class dimension - smooth: A float of smooth value to avoid zero devision

Clone this wiki locally