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)[source]

Bases: mmengine.model.BaseModule

Feedback Hourglass model for face landmark.

It has a style of:

-- preprocessing ----- Hourglass ----->
                   ^               |
                   |_______________|
Parameters
  • mid_channels (int) – Number of channels in the intermediate features.

  • num_keypoints (int) – Number of keypoints.

forward(x, last_hidden=None)[source]

Forward function.

Parameters
  • 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.

Returns

Heatmap of facial landmark. feedback (Tensor): Feedback Tensor.

Return type

heatmap (Tensor)

class mmedit.models.editors.dic.feedback_hour_glass.ResBlock(in_channels, out_channels)[source]

Bases: torch.nn.Module

ResBlock for Hourglass.

It has a style of:

---Conv-ReLU-Conv-Conv-+-
 |_________Conv________|

or

---Conv-ReLU-Conv-Conv-+-
 |_____________________|
Parameters
  • in_channels (int) – Number of channels in the input features.

  • out_channels (int) – Number of channels in the output features.

forward(x)[source]

Forward function.

Parameters

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

Returns

Forward results.

Return type

Tensor

class mmedit.models.editors.dic.feedback_hour_glass.Hourglass(depth, mid_channels)[source]

Bases: torch.nn.Module

Hourglass model for face landmark.

It is a recursive model.

Parameters
  • depth (int) – Depth of Hourglass, the number of recursions.

  • mid_channels (int) – Number of channels in the intermediate features.

forward(x)[source]

Forward function.

Parameters

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

Returns

Forward results.

Return type

Tensor

mmedit.models.editors.dic.feedback_hour_glass.reduce_to_five_heatmaps(ori_heatmap, detach)[source]

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

Parameters
  • ori_heatmap (Tensor) – Input heatmap tensor. (B, N, 32, 32).

  • detach (bool) – Detached from the current tensor or not.

Returns

New heatmap tensor. (B, 5, 32, 32).

Return type

Tensor

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

Free document hosting provided by Read the Docs.