Shortcuts

mmagic.evaluation.metrics.sad

Module Contents

Classes

SAD

Sum of Absolute Differences metric for image matting.

class mmagic.evaluation.metrics.sad.SAD(norm_const=1000, **kwargs)[源代码]

Bases: mmagic.evaluation.metrics.base_sample_wise_metric.BaseSampleWiseMetric

Sum of Absolute Differences metric for image matting.

This metric compute per-pixel absolute difference and sum across all pixels. i.e. sum(abs(a-b)) / norm_const

备注

Current implementation assume image / alpha / trimap array in numpy format and with pixel value ranging from 0 to 255.

备注

pred_alpha should be masked by trimap before passing into this metric

Default prefix: ‘’

参数

norm_const (int) – Divide the result to reduce its magnitude. Default to 1000.

Metrics:
  • SAD (float): Sum of Absolute Differences

default_prefix = ''[源代码]
metric = 'SAD'[源代码]
prepare(module: torch.nn.Module, dataloader: torch.utils.data.dataloader.DataLoader)[源代码]
process(data_batch: Sequence[dict], data_samples: Sequence[dict]) None[源代码]

Process one batch of data and predictions.

参数
  • data_batch (Sequence[Tuple[Any, dict]]) – A batch of data from the dataloader.

  • predictions (Sequence[dict]) – A batch of outputs from the model.

compute_metrics(results: List)[源代码]

Compute the metrics from processed results.

参数

results (dict) – The processed results of each batch.

返回

The computed metrics. The keys are the names of the metrics, and the values are corresponding results.

返回类型

Dict

Read the Docs v: latest
Versions
latest
stable
0.x
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.