Shortcuts

mmedit.models.editors.dic.dic

Module Contents

Classes

DIC

DIC model for Face Super-Resolution.

class mmedit.models.editors.dic.dic.DIC(generator, pixel_loss, align_loss, discriminator=None, gan_loss=None, feature_loss=None, train_cfg=None, test_cfg=None, init_cfg=None, data_preprocessor=None)[源代码]

Bases: mmedit.models.editors.srgan.SRGAN

DIC model for Face Super-Resolution.

Paper: Deep Face Super-Resolution with Iterative Collaboration between

Attentive Recovery and Landmark Estimation.

参数
  • generator (dict) – Config for the generator.

  • pixel_loss (dict) – Config for the pixel loss.

  • align_loss (dict) – Config for the align loss.

  • discriminator (dict) – Config for the discriminator. Default: None.

  • gan_loss (dict) – Config for the gan loss. Default: None.

  • feature_loss (dict) – Config for the feature loss. Default: None.

  • train_cfg (dict) – Config for train. Default: None.

  • test_cfg (dict) – Config for testing. Default: None.

  • init_cfg (dict, optional) – The weight initialized config for BaseModule. Default: None.

  • data_preprocessor (dict, optional) – The pre-process config of BaseDataPreprocessor. Default: None.

forward_tensor(inputs, data_samples=None, training=False)[源代码]

Forward tensor. Returns result of simple forward.

参数
  • inputs (torch.Tensor) – batch input tensor collated by data_preprocessor.

  • data_samples (List[BaseDataElement], optional) – data samples collated by data_preprocessor.

  • training (bool) – Whether is training. Default: False.

返回

results of forward inference and

forward train.

返回类型

(Tensor | Tuple[List[Tensor]])

if_run_g()[源代码]

Calculates whether need to run the generator step.

if_run_d()[源代码]

Calculates whether need to run the discriminator step.

g_step(batch_outputs, batch_gt_data)[源代码]

G step of GAN: Calculate losses of generator.

参数
  • batch_outputs (Tensor) – Batch output of generator.

  • batch_gt_data (Tensor) – Batch GT data.

返回

Dict of losses.

返回类型

dict

d_step_with_optim(batch_outputs, batch_gt_data, optim_wrapper)[源代码]

D step with optim of GAN: Calculate losses of discriminator and run optim.

参数
  • batch_outputs (Tuple[Tensor]) – Batch output of generator.

  • batch_gt_data (Tuple[Tensor]) – Batch GT data.

  • optim_wrapper (OptimWrapper) – Optim wrapper of discriminator.

返回

Dict of parsed losses.

返回类型

dict

static extract_gt_data(data_samples)[源代码]

extract gt data from data samples.

参数

data_samples (list) – List of EditDataSample.

返回

Extract gt data.

返回类型

Tensor

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

Free document hosting provided by Read the Docs.