Shortcuts

mmagic.models.editors.rdn.rdn_net

Module Contents

Classes

RDNNet

RDN model for single image super-resolution.

DenseLayer

Dense layer.

RDB

Residual Dense Block of Residual Dense Network.

class mmagic.models.editors.rdn.rdn_net.RDNNet(in_channels, out_channels, mid_channels=64, num_blocks=16, upscale_factor=4, num_layers=8, channel_growth=64)[source]

Bases: mmengine.model.BaseModule

RDN model for single image super-resolution.

Paper: Residual Dense Network for Image Super-Resolution

Adapted from ‘https://github.com/yjn870/RDN-pytorch.git’ ‘RDN-pytorch/blob/master/models.py’ Copyright (c) 2021, JaeYun Yeo, under MIT License.

Most of the implementation follows the implementation in: ‘https://github.com/sanghyun-son/EDSR-PyTorch.git’ ‘EDSR-PyTorch/blob/master/src/model/rdn.py’ Copyright (c) 2017, sanghyun-son, under MIT license.

Parameters
  • in_channels (int) – Channel number of inputs.

  • out_channels (int) – Channel number of outputs.

  • mid_channels (int) – Channel number of intermediate features. Default: 64.

  • num_blocks (int) – Block number in the trunk network. Default: 16.

  • upscale_factor (int) – Upsampling factor. Support 2^n and 3. Default: 4.

  • num_layer (int) – Layer number in the Residual Dense Block. Default: 8.

  • channel_growth (int) – Channels growth in each layer of RDB. Default: 64.

forward(x)[source]

Forward function.

Parameters

x (Tensor) – Input tensor with shape (n, c, h, w).

Returns

Forward results.

Return type

Tensor

class mmagic.models.editors.rdn.rdn_net.DenseLayer(in_channels, out_channels)[source]

Bases: mmengine.model.BaseModule

Dense layer.

Parameters
  • in_channels (int) – Channel number of inputs.

  • out_channels (int) – Channel number of outputs.

forward(x)[source]

Forward function.

Parameters

x (Tensor) – Input tensor with shape (n, c_in, h, w).

Returns

Forward results, tensor with shape (n, c_in+c_out, h, w).

Return type

Tensor

class mmagic.models.editors.rdn.rdn_net.RDB(in_channels, channel_growth, num_layers)[source]

Bases: mmengine.model.BaseModule

Residual Dense Block of Residual Dense Network.

Parameters
  • in_channels (int) – Channel number of inputs.

  • channel_growth (int) – Channels growth in each layer.

  • num_layers (int) – Layer number in the Residual Dense Block.

forward(x)[source]

Forward function.

Parameters

x (Tensor) – Input tensor with shape (n, 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.