LibMTL.metrics

class AbsMetric[source]

Bases: object

An abstract class for the performance metrics of a task.

record

A list of the metric scores in every iteration.

Type:

list

bs

A list of the number of data in every iteration.

Type:

list

property update_fun[source]
Calculate the metric scores in every iteration and update :attr:`record`.
Parameters:
  • pred (torch.Tensor) – The prediction tensor.

  • gt (torch.Tensor) – The ground-truth tensor.

property score_fun[source]
Calculate the final score (when an epoch ends).
Returns:

A list of metric scores.

Return type:

list

reinit()[source]

Reset record and bs (when an epoch ends).

class AccMetric[source]

Bases: AbsMetric

Calculate the accuracy.

update_fun(pred, gt)[source]
score_fun()[source]
class L1Metric[source]

Bases: AbsMetric

Calculate the Mean Absolute Error (MAE).

update_fun(pred, gt)[source]
score_fun()[source]