Shortcuts

mmedit.models.editors.real_basicvsr.real_basicvsr

Module Contents

Classes

RealBasicVSR

RealBasicVSR model for real-world video super-resolution.

class mmedit.models.editors.real_basicvsr.real_basicvsr.RealBasicVSR(generator, discriminator=None, gan_loss=None, pixel_loss=None, cleaning_loss=None, perceptual_loss=None, is_use_sharpened_gt_in_pixel=False, is_use_sharpened_gt_in_percep=False, is_use_sharpened_gt_in_gan=False, is_use_ema=False, train_cfg=None, test_cfg=None, init_cfg=None, data_preprocessor=None)[源代码]

Bases: mmedit.models.editors.real_esrgan.RealESRGAN

RealBasicVSR model for real-world video super-resolution.

Ref: Investigating Tradeoffs in Real-World Video Super-Resolution, arXiv

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

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

  • gan_loss (dict, optional) – Config for the gan loss. Note that the loss weight in gan loss is only for the generator.

  • pixel_loss (dict, optional) – Config for the pixel loss. Default: None.

  • cleaning_loss (dict, optional) – Config for the image cleaning loss. Default: None.

  • perceptual_loss (dict, optional) – Config for the perceptual loss. Default: None.

  • is_use_sharpened_gt_in_pixel (bool, optional) – Whether to use the image sharpened by unsharp masking as the GT for pixel loss. Default: False.

  • is_use_sharpened_gt_in_percep (bool, optional) – Whether to use the image sharpened by unsharp masking as the GT for perceptual loss. Default: False.

  • is_use_sharpened_gt_in_gan (bool, optional) – Whether to use the image sharpened by unsharp masking as the GT for adversarial loss. Default: False.

  • train_cfg (dict) – Config for training. Default: None. You may change the training of gan by setting: disc_steps: how many discriminator updates after one generate update; disc_init_steps: how many discriminator updates at the start of the training. These two keys are useful when training with WGAN.

  • 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.

extract_gt_data(data_samples)[源代码]

extract gt data from data samples.

参数

data_samples (list) – List of EditDataSample.

返回

Extract gt data.

返回类型

Tensor

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 (Tuple[Tensor]) – Batch GT data.

返回

Dict of losses.

返回类型

dict

d_step_with_optim(batch_outputs: torch.Tensor, batch_gt_data: torch.Tensor, optim_wrapper: mmengine.optim.OptimWrapperDict)[源代码]

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

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

  • batch_gt_data (Tensor) – Batch GT data.

  • optim_wrapper (OptimWrapperDict) – Optim wrapper dict.

返回

Dict of parsed losses.

返回类型

dict

forward_train(batch_inputs, data_samples=None)[源代码]

Forward Train.

Run forward of generator with return_lqs=True

参数
  • batch_inputs (Tensor) – Batch inputs.

  • data_samples (List[EditDataSample]) – Data samples of Editing. Default:None

返回

Result of generator.

(outputs, lqs)

返回类型

Tuple[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.