Shortcuts

mmagic.models.editors.liif.liif_net

Module Contents

Classes

LIIFNet

LIIF net for single image super-resolution, CVPR, 2021.

LIIFEDSRNet

LIIF net based on EDSR.

LIIFRDNNet

LIIF net based on RDN.

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

Bases: mmengine.model.BaseModule

LIIF net for single image super-resolution, CVPR, 2021.

Paper: Learning Continuous Image Representation with

Local Implicit Image Function

The subclasses should define generator with encoder and imnet,

and overwrite the function gen_feature.

If encoder does not contain mid_channels, __init__ should be

overwrite.

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.

forward(x, coord, cell, test_mode=False)[source]

Forward function.

Parameters
  • x – input tensor.

  • coord (Tensor) – coordinates tensor.

  • cell (Tensor) – cell tensor.

  • test_mode (bool) – Whether in test mode or not. Default: False.

Returns

output of model.

Return type

pred (Tensor)

query_rgb(feature, coord, cell=None)[source]

Query RGB value of GT.

Adapted from ‘https://github.com/yinboc/liif.git’ ‘liif/models/liif.py’ Copyright (c) 2020, Yinbo Chen, under BSD 3-Clause License.

Parameters
  • feature (Tensor) – encoded feature.

  • coord (Tensor) – coord tensor, shape (BHW, 2).

  • cell (Tensor | None) – cell tensor. Default: None.

Returns

(part of) output.

Return type

result (Tensor)

batched_predict(x, coord, cell)[source]

Batched predict.

Parameters
  • x (Tensor) – Input tensor.

  • coord (Tensor) – coord tensor.

  • cell (Tensor) – cell tensor.

Returns

output of model.

Return type

pred (Tensor)

abstract 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.liif_net.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.liif_net.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

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.