Shortcuts

mmedit.evaluation.metrics.gradient_error

Module Contents

Classes

GradientError

Gradient error for evaluating alpha matte prediction.

class mmedit.evaluation.metrics.gradient_error.GradientError(sigma=1.4, norm_constant=1000, **kwargs)[source]

Bases: mmengine.evaluator.BaseMetric

Gradient error for evaluating alpha matte prediction.

Note

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

Note

pred_alpha should be masked by trimap before passing into this metric

Parameters
  • sigma (float) – Standard deviation of the gaussian kernel. Defaults to 1.4 .

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

Default prefix: ‘’

Metrics:
  • GradientError (float): Gradient Error

process(data_batch: Sequence[dict], data_samples: Sequence[dict]) None[source]

Process one batch of data samples and predictions. The processed results should be stored in self.results, which will be used to compute the metrics when all batches have been processed.

Parameters
  • data_batch (Sequence[dict]) – A batch of data from the dataloader.

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

compute_metrics(results: List)[source]

Compute the metrics from processed results.

Parameters

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

Returns

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

Return type

Dict

Read the Docs v: latest
Versions
master
latest
stable
zyh-re-docs
zyh-doc-notfound-extend
zyh-api-rendering
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.