Shortcuts

mmagic.models.editors.tof.tof_vsr_net

Module Contents

Classes

TOFlowVSRNet

PyTorch implementation of TOFlow.

BasicModule

Basic module of SPyNet.

SPyNet

SPyNet architecture.

class mmagic.models.editors.tof.tof_vsr_net.TOFlowVSRNet(adapt_official_weights=False, init_cfg=None)[source]

Bases: mmengine.model.BaseModule

PyTorch implementation of TOFlow.

In TOFlow, the LR frames are pre-upsampled and have the same size with the GT frames.

Paper: Xue et al., Video Enhancement with Task-Oriented Flow, IJCV 2018 Code reference:

  1. https://github.com/anchen1011/toflow

  2. https://github.com/Coldog2333/pytoflow

Parameters

adapt_official_weights (bool) – Whether to adapt the weights translated from the official implementation. Set to false if you want to train from scratch. Default: False

forward(lrs)[source]
Parameters

lrs – Input lr frames: (b, 7, 3, h, w).

Returns

SR frame: (b, 3, h, w).

Return type

Tensor

class mmagic.models.editors.tof.tof_vsr_net.BasicModule[source]

Bases: torch.nn.Module

Basic module of SPyNet.

Note that unlike the common spynet architecture, the basic module here contains batch normalization.

forward(tensor_input)[source]
Parameters

tensor_input (Tensor) – Input tensor with shape (b, 8, h, w). 8 channels contain: [reference image (3), neighbor image (3), initial flow (2)].

Returns

Estimated flow with shape (b, 2, h, w)

Return type

Tensor

class mmagic.models.editors.tof.tof_vsr_net.SPyNet[source]

Bases: torch.nn.Module

SPyNet architecture.

Note that this implementation is specifically for TOFlow. It differs from the common SPyNet in the following aspects:

  1. The basic modules here contain BatchNorm.

  2. Normalization and denormalization are not done here, as

    they are done in TOFlow.

Paper:

Optical Flow Estimation using a Spatial Pyramid Network

Code reference:

https://github.com/Coldog2333/pytoflow

forward(ref, supp)[source]
Parameters
  • ref (Tensor) – Reference image with shape of (b, 3, h, w).

  • supp – The supporting image to be warped: (b, 3, h, w).

Returns

Estimated optical flow: (b, 2, h, w).

Return type

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.