Shortcuts

Metrics

Classification & Segmentation

Accuracy

common.utils.metric.accuracy(output, target, topk=(1, ))[source]

Computes the accuracy over the k top predictions for the specified values of k

Parameters
  • output (tensor) – Classification outputs, \((N, C)\) where C = number of classes

  • target (tensor) – \((N)\) where each value is \(0 \leq \text{targets}[i] \leq C-1\)

  • topk (sequence[int]) – A list of top-N number.

Returns

Top-N accuracies (N \(\in\) topK).

ConfusionMatrix

class common.utils.metric.ConfusionMatrix(num_classes)[source]
compute()[source]

compute global accuracy, per-class accuracy and per-class IoU

format(classes)[source]

Get the accuracy and IoU for each class in the table format

update(target, output)[source]

Update confusion matrix.

Parameters
  • target – ground truth

  • output – predictions of models

Shape:
  • target: \((minibatch, C)\) where C means the number of classes.

  • output: \((minibatch, C)\) where C means the number of classes.

Docs

Access comprehensive documentation for Transfer Learning Library

View Docs

Tutorials

Get started for Transfer Learning Library

Get Started