Shortcuts

mmedit.models.editors.dic.feedback_hour_glass

Module Contents

Classes

FeedbackHourglass

Feedback Hourglass model for face landmark.

ResBlock

ResBlock for Hourglass.

Hourglass

Hourglass model for face landmark.

Functions

reduce_to_five_heatmaps(ori_heatmap, detach)

Reduce facial landmark heatmaps to 5 heatmaps.

class mmedit.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 mmedit.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.

forward(x)[源代码]

Forward function.

参数

x (Tensor) – Input tensor with shape (n, c, h, w).

返回

Forward results.

返回类型

Tensor

class mmedit.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.

forward(x)[源代码]

Forward function.

参数

x (Tensor) – Input tensor with shape (n, c, h, w).

返回

Forward results.

返回类型

Tensor

mmedit.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

Read the Docs v: latest
Versions
master
latest
stable
zyh-doc-notfound-extend
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.