Shortcuts

mmagic.models.editors.restormer

Package Contents

Classes

Restormer

Restormer A PyTorch impl of: `Restormer: Efficient Transformer for High-

class mmagic.models.editors.restormer.Restormer(inp_channels=3, out_channels=3, dim=48, num_blocks=[4, 6, 6, 8], num_refinement_blocks=4, heads=[1, 2, 4, 8], ffn_expansion_factor=2.66, bias=False, LayerNorm_type='WithBias', dual_pixel_task=False, dual_keys=['imgL', 'imgR'])[source]

Bases: mmengine.model.BaseModule

Restormer A PyTorch impl of: Restormer: Efficient Transformer for High- Resolution Image Restoration. Ref repo: https://github.com/swz30/Restormer.

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

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

  • dim (int) – Number of feature dimension. Default: 48.

  • num_blocks (List(int)) – Depth of each Transformer layer. Default: [4, 6, 6, 8].

  • num_refinement_blocks (int) – Number of refinement blocks. Default: 4.

  • heads (List(int)) – Number of attention heads in different layers. Default: 7.

  • ffn_expansion_factor (float) – Ratio of feed forward network expansion. Default: 2.66.

  • bias (bool) – The bias of convolution. Default: False

  • LayerNorm_type (str|optional) – Select layer Normalization type. Optional: ‘WithBias’,’BiasFree’ Default: ‘WithBias’.

  • dual_pixel_task (bool) – True for dual-pixel defocus deblurring only. Also set inp_channels=6. Default: False.

  • dual_keys (List) – Keys of dual images in inputs. Default: [‘imgL’, ‘imgR’].

forward(inp_img)[source]

Forward function.

Parameters

inp_img (Tensor) – Input tensor with shape (B, C, H, W).

Returns

Forward results.

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.