mmagic.models.editors.dic.dic_net
¶
Module Contents¶
Classes¶
DIC network structure for face super-resolution. |
|
Feedback Block of DIC. |
|
Custom feedback block, will be used as the first feedback block. |
|
ResBlock with Group Conv. |
|
Fusing Feature and Heatmap. |
|
Feedback block with HeatmapAttention. |
- class mmagic.models.editors.dic.dic_net.DICNet(in_channels, out_channels, mid_channels, num_blocks=6, hg_mid_channels=256, hg_num_keypoints=68, num_steps=4, upscale_factor=8, detach_attention=False, prelu_init=0.2, num_heatmaps=5, num_fusion_blocks=7, init_cfg=None)[source]¶
Bases:
mmengine.model.BaseModule
DIC network structure for face super-resolution.
- Paper: Deep Face Super-Resolution with Iterative Collaboration between
Attentive Recovery and Landmark Estimation
- Parameters
in_channels (int) – Number of channels in the input image
out_channels (int) – Number of channels in the output image
mid_channels (int) – Channel number of intermediate features. Default: 64
num_blocks (tuple[int]) – Block numbers in the trunk network. Default: 6
hg_mid_channels (int) – Channel number of intermediate features of HourGlass. Default: 256
hg_num_keypoints (int) – Keypoint number of HourGlass. Default: 68
num_steps (int) – Number of iterative steps. Default: 4
upscale_factor (int) – Upsampling factor. Default: 8
detach_attention (bool) – Detached from the current tensor for heatmap or not.
prelu_init (float) – init of PReLU. Default: 0.2
num_heatmaps (int) – Number of heatmaps. Default: 5
num_fusion_blocks (int) – Number of fusion blocks. Default: 7
init_cfg (dict, optional) – Initialization config dict. Default: None.
- class mmagic.models.editors.dic.dic_net.FeedbackBlock(mid_channels, num_blocks, upscale_factor, padding=2, prelu_init=0.2)[source]¶
Bases:
torch.nn.Module
Feedback Block of DIC.
It has a style of:
----- Module -----> ^ | |____________|
- Parameters
mid_channels (int) – Number of channels in the intermediate features.
num_blocks (int) – Number of blocks.
upscale_factor (int) – upscale factor.
padding (int) – Padding size. Default: 2.
prelu_init (float) – init of PReLU. Default: 0.2
- class mmagic.models.editors.dic.dic_net.FeedbackBlockCustom(in_channels, mid_channels, num_blocks, upscale_factor)[source]¶
Bases:
FeedbackBlock
Custom feedback block, will be used as the first feedback block.
- Parameters
in_channels (int) – Number of channels in the input features.
mid_channels (int) – Number of channels in the intermediate features.
num_blocks (int) – Number of blocks.
upscale_factor (int) – upscale factor.
- class mmagic.models.editors.dic.dic_net.GroupResBlock(in_channels, out_channels, mid_channels, groups, res_scale=1.0)[source]¶
Bases:
torch.nn.Module
ResBlock with Group Conv.
- Parameters
in_channels (int) – Channel number of input features.
out_channels (int) – Channel number of output features.
mid_channels (int) – Channel number of intermediate features.
groups (int) – Number of blocked connections from input to output.
res_scale (float) – Used to scale the residual before addition. Default: 1.0.
- class mmagic.models.editors.dic.dic_net.FeatureHeatmapFusingBlock(in_channels, num_heatmaps, num_blocks, mid_channels=None)[source]¶
Bases:
torch.nn.Module
Fusing Feature and Heatmap.
- Parameters
in_channels (int) – Number of channels in the input features.
num_heatmaps (int) – Number of heatmap.
num_blocks (int) – Number of blocks.
mid_channels (int | None) – Number of channels in the intermediate features. Default: None
- class mmagic.models.editors.dic.dic_net.FeedbackBlockHeatmapAttention(mid_channels, num_blocks, upscale_factor, num_heatmaps, num_fusion_blocks, padding=2, prelu_init=0.2)[source]¶
Bases:
FeedbackBlock
Feedback block with HeatmapAttention.
- Parameters
in_channels (int) – Number of channels in the input features.
mid_channels (int) – Number of channels in the intermediate features.
num_blocks (int) – Number of blocks.
upscale_factor (int) – upscale factor.
padding (int) – Padding size. Default: 2.
prelu_init (float) – init of PReLU. Default: 0.2