Shortcuts

GenValLoop

class mmedit.engine.runner.GenValLoop(runner: mmengine.runner.runner.Runner, dataloader: Union[torch.utils.data.dataloader.DataLoader, Dict], evaluator: Union[mmengine.evaluator.evaluator.Evaluator, Dict, List])[source]

Validation loop for generative models. This class support evaluate metrics with different sample mode.

Parameters
  • runner (Runner) – A reference of runner.

  • dataloader (Dataloader or dict) – A dataloader object or a dict to build a dataloader.

  • evaluator (Evaluator or dict or list) – Used for computing metrics.

run()[source]

Launch validation. The evaluation process consists of four steps.

  1. Prepare pre-calculated items for all metrics by calling self.evaluator.prepare_metrics().

  2. Get a list of metrics-sampler pair. Each pair contains a list of metrics with the same sampler mode and a shared sampler.

  3. Generate images for the each metrics group. Loop for elements in each sampler and feed to the model as input by calling self.run_iter().

  4. Evaluate all metrics by calling self.evaluator.evaluate().

run_iter(idx, data_batch: dict, metrics: Sequence[mmengine.evaluator.metric.BaseMetric])[source]

Iterate one mini-batch and feed the output to corresponding metrics.

Parameters
  • idx (int) – Current idx for the input data.

  • data_batch (dict) – Batch of data from dataloader.

  • metrics (Sequence[BaseMetric]) – Specific metrics to evaluate.

Read the Docs v: zyh/doc-notfound-extend
Versions
master
latest
stable
zyh-doc-notfound-extend
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.