Shortcuts

mmagic.models.editors.tof

Package Contents

Classes

TOFlowVFINet

PyTorch implementation of TOFlow for video frame interpolation.

ToFResBlock

ResNet architecture.

TOFlowVSRNet

PyTorch implementation of TOFlow.

class mmagic.models.editors.tof.TOFlowVFINet(rgb_mean=[0.485, 0.456, 0.406], rgb_std=[0.229, 0.224, 0.225], flow_cfg=dict(norm_cfg=None, pretrained=None), init_cfg=None)[source]

Bases: mmengine.model.BaseModule

PyTorch implementation of TOFlow for video frame interpolation.

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
  • rgb_mean (list[float]) – Image mean in RGB orders. Default: [0.485, 0.456, 0.406]

  • rgb_std (list[float]) – Image std in RGB orders. Default: [0.229, 0.224, 0.225]

  • flow_cfg (dict) – Config of SPyNet. Default: dict(norm_cfg=None, pretrained=None)

  • init_cfg (dict, optional) – Initialization config dict. Default: None.

forward(imgs)[source]
Parameters

imgs – Input frames with shape of (b, 2, 3, h, w).

Returns

Interpolated frame with shape of (b, 3, h, w).

Return type

Tensor

class mmagic.models.editors.tof.ToFResBlock[source]

Bases: torch.nn.Module

ResNet architecture.

Three-layers ResNet/ResBlock

forward(frames)[source]
Parameters

frames (Tensor) – Tensor with shape of (b, 2, 3, h, w).

Returns

Interpolated frame with shape of (b, 3, h, w).

Return type

Tensor

class mmagic.models.editors.tof.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

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.