mmagic.models.editors.dic.feedback_hour_glass
¶
Module Contents¶
Classes¶
Feedback Hourglass model for face landmark. |
|
ResBlock for Hourglass. |
|
Hourglass model for face landmark. |
Functions¶
|
Reduce facial landmark heatmaps to 5 heatmaps. |
- class mmagic.models.editors.dic.feedback_hour_glass.FeedbackHourglass(mid_channels, num_keypoints)[源代码]¶
Bases:
mmengine.model.BaseModule
Feedback Hourglass model for face landmark.
It has a style of:
-- preprocessing ----- Hourglass -----> ^ | |_______________|
- 参数
mid_channels (int) – Number of channels in the intermediate features.
num_keypoints (int) – Number of keypoints.
- forward(x, last_hidden=None)[源代码]¶
Forward function.
- 参数
x (Tensor) – Input tensor with shape (n, c, h, w).
last_hidden (Tensor | None) – The feedback of FeedbackHourglass. In first step, last_hidden=None. Otherwise, last_hidden is the past output of FeedbackHourglass. Default: None.
- 返回
Heatmap of facial landmark. feedback (Tensor): Feedback Tensor.
- 返回类型
heatmap (Tensor)
- class mmagic.models.editors.dic.feedback_hour_glass.ResBlock(in_channels, out_channels)[源代码]¶
Bases:
torch.nn.Module
ResBlock for Hourglass.
It has a style of:
---Conv-ReLU-Conv-Conv-+- |_________Conv________| or ---Conv-ReLU-Conv-Conv-+- |_____________________|
- 参数
in_channels (int) – Number of channels in the input features.
out_channels (int) – Number of channels in the output features.
- class mmagic.models.editors.dic.feedback_hour_glass.Hourglass(depth, mid_channels)[源代码]¶
Bases:
torch.nn.Module
Hourglass model for face landmark.
It is a recursive model.
- 参数
depth (int) – Depth of Hourglass, the number of recursions.
mid_channels (int) – Number of channels in the intermediate features.
- mmagic.models.editors.dic.feedback_hour_glass.reduce_to_five_heatmaps(ori_heatmap, detach)[源代码]¶
Reduce facial landmark heatmaps to 5 heatmaps.
DIC realizes facial SR with the help of key points of the face. The number of key points in datasets are different from each other. This function reduces the input heatmaps into 5 heatmaps:
left eye right eye nose mouse face silhouette
- 参数
ori_heatmap (Tensor) – Input heatmap tensor. (B, N, 32, 32).
detach (bool) – Detached from the current tensor or not.
- 返回
New heatmap tensor. (B, 5, 32, 32).
- 返回类型
Tensor