Shortcuts

mmagic.models.editors.tdan

Package Contents

Classes

TDAN

TDAN model for video super-resolution.

TDANNet

TDAN network structure for video super-resolution.

class mmagic.models.editors.tdan.TDAN(generator, pixel_loss, lq_pixel_loss, train_cfg=None, test_cfg=None, init_cfg=None, data_preprocessor=None)[source]

Bases: mmagic.models.BaseEditModel

TDAN model for video super-resolution.

Paper:

TDAN: Temporally-Deformable Alignment Network for Video Super- Resolution, CVPR, 2020

Parameters
  • generator (dict) – Config for the generator structure.

  • pixel_loss (dict) – Config for pixel-wise loss.

  • lq_pixel_loss (dict) – Config for pixel-wise loss for the LQ images.

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

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

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

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

forward_train(inputs, data_samples=None, **kwargs)[source]

Forward training. Returns dict of losses of training.

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

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

Returns

Dict of losses.

Return type

dict

forward_tensor(inputs, data_samples=None, training=False, **kwargs)[source]

Forward tensor. Returns result of simple forward.

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

Returns

results of forward inference and

forward train.

Return type

(Tensor | List[Tensor])

class mmagic.models.editors.tdan.TDANNet(in_channels=3, mid_channels=64, out_channels=3, num_blocks_before_align=5, num_blocks_after_align=10)[source]

Bases: mmengine.model.BaseModule

TDAN network structure for video super-resolution.

Support only x4 upsampling.

Paper:

TDAN: Temporally-Deformable Alignment Network for Video Super- Resolution, CVPR, 2020

Parameters
  • in_channels (int) – Number of channels of the input image. Default: 3.

  • mid_channels (int) – Number of channels of the intermediate features. Default: 64.

  • out_channels (int) – Number of channels of the output image. Default: 3.

  • num_blocks_before_align (int) – Number of residual blocks before temporal alignment. Default: 5.

  • num_blocks_after_align (int) – Number of residual blocks after temporal alignment. Default: 10.

forward(lrs)[source]

Forward function for TDANNet.

Parameters

lrs (Tensor) – Input LR sequence with shape (n, t, c, h, w).

Returns

Output HR image with shape (n, c, 4h, 4w) and aligned LR images with shape (n, t, c, h, w).

Return type

tuple[Tensor]

Read the Docs v: latest
Versions
latest
stable
0.x
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.