Shortcuts

mmagic.models.editors.liif

Package Contents

Classes

LIIF

LIIF model for single image super-resolution.

LIIFEDSRNet

LIIF net based on EDSR.

LIIFRDNNet

LIIF net based on RDN.

MLPRefiner

Multilayer perceptrons (MLPs), refiner used in LIIF.

class mmagic.models.editors.liif.LIIF(generator: dict, pixel_loss: dict, train_cfg: Optional[dict] = None, test_cfg: Optional[dict] = None, init_cfg: Optional[dict] = None, data_preprocessor: Optional[dict] = None)[source]

Bases: mmagic.models.base_models.BaseEditModel

LIIF model for single image super-resolution.

Paper: Learning Continuous Image Representation with

Local Implicit Image Function

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

  • pixel_loss (dict) – Config for the pixel loss.

  • pretrained (str) – Path for pretrained model. Default: None.

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

forward_tensor(inputs, data_samples=None, **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.

Returns

result of simple forward.

Return type

Tensor

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

Forward inference. Returns predictions of validation, testing, and simple inference.

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

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

Returns

predictions.

Return type

List[DataSample]

class mmagic.models.editors.liif.LIIFEDSRNet(encoder, imnet, local_ensemble=True, feat_unfold=True, cell_decode=True, eval_bsize=None)[source]

Bases: LIIFNet

LIIF net based on EDSR.

Paper: Learning Continuous Image Representation with

Local Implicit Image Function

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

  • imnet (dict) – Config for the imnet.

  • local_ensemble (bool) – Whether to use local ensemble. Default: True.

  • feat_unfold (bool) – Whether to use feature unfold. Default: True.

  • cell_decode (bool) – Whether to use cell decode. Default: True.

  • eval_bsize (int) – Size of batched predict. Default: None.

gen_feature(x)[source]

Generate feature.

Parameters

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

Returns

Forward results.

Return type

Tensor

class mmagic.models.editors.liif.LIIFRDNNet(encoder, imnet, local_ensemble=True, feat_unfold=True, cell_decode=True, eval_bsize=None)[source]

Bases: LIIFNet

LIIF net based on RDN.

Paper: Learning Continuous Image Representation with

Local Implicit Image Function

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

  • imnet (dict) – Config for the imnet.

  • local_ensemble (bool) – Whether to use local ensemble. Default: True.

  • feat_unfold (bool) – Whether to use feat unfold. Default: True.

  • cell_decode (bool) – Whether to use cell decode. Default: True.

  • eval_bsize (int) – Size of batched predict. Default: None.

gen_feature(x)[source]

Generate feature.

Parameters

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

Returns

Forward results.

Return type

Tensor

class mmagic.models.editors.liif.MLPRefiner(in_dim, out_dim, hidden_list)[source]

Bases: mmengine.model.BaseModule

Multilayer perceptrons (MLPs), refiner used in LIIF.

Parameters
  • in_dim (int) – Input dimension.

  • out_dim (int) – Output dimension.

  • hidden_list (list[int]) – List of hidden dimensions.

forward(x)[source]

Forward function.

Parameters

x (Tensor) – The input of MLP.

Returns

The output of MLP.

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.