Shortcuts

mmagic.models.editors.plain

Package Contents

Classes

PlainDecoder

Simple decoder from Deep Image Matting.

PlainRefiner

Simple refiner from Deep Image Matting.

class mmagic.models.editors.plain.PlainDecoder(in_channels, init_cfg: Optional[dict] = None)[source]

Bases: mmengine.model.BaseModule

Simple decoder from Deep Image Matting.

Parameters
  • in_channels (int) – Channel num of input features.

  • init_cfg (dict, optional) – Initialization config dict. Default: None.

init_weights()[source]

Init weights for the module.

forward(inputs)[source]

Forward function of PlainDecoder.

Parameters

inputs (dict) –

Output dictionary of the VGG encoder containing:

  • out (Tensor): Output of the VGG encoder.

  • max_idx_1 (Tensor): Index of the first maxpooling layer in the VGG encoder.

  • max_idx_2 (Tensor): Index of the second maxpooling layer in the VGG encoder.

  • max_idx_3 (Tensor): Index of the third maxpooling layer in the VGG encoder.

  • max_idx_4 (Tensor): Index of the fourth maxpooling layer in the VGG encoder.

  • max_idx_5 (Tensor): Index of the fifth maxpooling layer in the VGG encoder.

Returns

Output tensor.

Return type

Tensor

class mmagic.models.editors.plain.PlainRefiner(conv_channels=64, init_cfg=None)[source]

Bases: mmengine.model.BaseModule

Simple refiner from Deep Image Matting.

Parameters
  • conv_channels (int) – Number of channels produced by the three main convolutional layer. Default: 64.

  • pretrained (str) – Name of pretrained model. Default: None.

init_weights()[source]

Init weights for the module.

forward(x, raw_alpha)[source]

Forward function.

Parameters
  • x (Tensor) – The input feature map of refiner.

  • raw_alpha (Tensor) – The raw predicted alpha matte.

Returns

The refined alpha matte.

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.