mmagic.models.editors.liif.liif_net
¶
Module Contents¶
Classes¶
LIIF net for single image super-resolution, CVPR, 2021. |
|
LIIF net based on EDSR. |
|
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)
- 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.
- 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.