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(self, pred, gt)[source]

Calculate the metric scores in every iteration and update record.

Parameters
  • pred (torch.Tensor) – The prediction tensor.

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

property score_fun(self)[source]

Calculate the final score (when an epoch ends).

Returns

A list of metric scores.

Return type

list

reinit(self)[source]

Reset record and bs (when an epoch ends).

class AccMetric[source]

Bases: AbsMetric

Calculate the accuracy.

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

Bases: AbsMetric

Calculate the Mean Absolute Error (MAE).

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