mmagic.models.editors.liif
¶
Package Contents¶
Classes¶
LIIF model for single image super-resolution. |
|
LIIF net based on EDSR. |
|
LIIF net based on RDN. |
|
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)[源代码]¶
Bases:
mmagic.models.base_models.BaseEditModel
LIIF model for single image super-resolution.
- Paper: Learning Continuous Image Representation with
Local Implicit Image Function
- 参数
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)¶
Forward tensor. Returns result of simple forward.
- 参数
inputs (torch.Tensor) – batch input tensor collated by
data_preprocessor
.data_samples (List[BaseDataElement], optional) – data samples collated by
data_preprocessor
.
- 返回
result of simple forward.
- 返回类型
Tensor
- forward_inference(inputs, data_samples=None, **kwargs)¶
Forward inference. Returns predictions of validation, testing, and simple inference.
- 参数
inputs (torch.Tensor) – batch input tensor collated by
data_preprocessor
.data_samples (BaseDataElement, optional) – data samples collated by
data_preprocessor
.
- 返回
predictions.
- 返回类型
List[DataSample]
- class mmagic.models.editors.liif.LIIFEDSRNet(encoder, imnet, local_ensemble=True, feat_unfold=True, cell_decode=True, eval_bsize=None)[源代码]¶
Bases:
LIIFNet
LIIF net based on EDSR.
- Paper: Learning Continuous Image Representation with
Local Implicit Image Function
- 参数
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)¶
Generate feature.
- 参数
x (Tensor) – Input tensor with shape (n, c, h, w).
- 返回
Forward results.
- 返回类型
Tensor
- class mmagic.models.editors.liif.LIIFRDNNet(encoder, imnet, local_ensemble=True, feat_unfold=True, cell_decode=True, eval_bsize=None)[源代码]¶
Bases:
LIIFNet
LIIF net based on RDN.
- Paper: Learning Continuous Image Representation with
Local Implicit Image Function
- 参数
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)¶
Generate feature.
- 参数
x (Tensor) – Input tensor with shape (n, c, h, w).
- 返回
Forward results.
- 返回类型
Tensor
- class mmagic.models.editors.liif.MLPRefiner(in_dim, out_dim, hidden_list)[源代码]¶
Bases:
mmengine.model.BaseModule
Multilayer perceptrons (MLPs), refiner used in LIIF.
- 参数
in_dim (int) – Input dimension.
out_dim (int) – Output dimension.
hidden_list (list[int]) – List of hidden dimensions.
- forward(x)¶
Forward function.
- 参数
x (Tensor) – The input of MLP.
- 返回
The output of MLP.
- 返回类型
Tensor