basicsr.archs.dfdnet_arch

class basicsr.archs.dfdnet_arch.DFDNet(num_feat, dict_path)[source]

Bases: Module

DFDNet: Deep Face Dictionary Network.

It only processes faces with 512x512 size.

Parameters:
  • num_feat (int) – Number of feature channels.

  • dict_path (str) – Path to the facial component dictionary.

forward(x, part_locations)[source]

Now only support testing with batch size = 0.

Parameters:
  • x (Tensor) – Input faces with shape (b, c, 512, 512).

  • part_locations (list[Tensor]) – Part locations.

put_dict_to_device(x)[source]
swap_feat(vgg_feat, updated_feat, dict_feat, location, part_name, f_size)[source]

swap the features from the dictionary.

training: bool
class basicsr.archs.dfdnet_arch.SFTUpBlock(in_channel, out_channel, kernel_size=3, padding=1)[source]

Bases: Module

Spatial feature transform (SFT) with upsampling block.

Parameters:
  • in_channel (int) – Number of input channels.

  • out_channel (int) – Number of output channels.

  • kernel_size (int) – Kernel size in convolutions. Default: 3.

  • padding (int) – Padding in convolutions. Default: 1.

forward(x, updated_feat)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool