Shortcuts

mmedit.evaluation.functional.prepare_vgg_feat

mmedit.evaluation.functional.prepare_vgg_feat(dataloader: torch.utils.data.dataloader.DataLoader, metric: mmengine.evaluator.metric.BaseMetric, data_preprocessor: Optional[torch.nn.modules.module.Module] = None, auto_save=True) numpy.ndarray[source]

Prepare vgg feature for the input metric.

  • If metric.vgg_pkl is an online path, try to download and load it. If cannot download or load, corresponding error will be raised.

  • If metric.vgg_pkl is local path and file exists, try to load the file. If cannot load, corresponding error will be raised.

  • If metric.vgg_pkl is local path and file not exists, we will extract the vgg feature manually and save to ‘vgg_pkl’.

  • If metric.vgg_pkl is not defined, we will extrace the vgg feature and save it to default cache dir with default name.

Parameters
  • datalaoder (Dataloader) – The dataloader of real images.

  • metric (BaseMetric) – The metric which needs vgg features.

  • data_preprocessor (Optional[nn.Module]) – Data preprocessor of the module. Used to preprocess the real images. If not passed, real images will automatically normalized to [-1, 1]. Defaults to None.

  • Returns – np.ndarray: Loaded vgg feature.

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.