Implementation of pix2pixHD

Understand pix2pixHD with multiscale discriminators, feature matching loss, and instance edges for high-definition image synthesis.

As the name suggests, pix2pixHD is a high-definition improvement on the pix2pix baseline. Let’s take a look at some of the improvements on pix2pix. It was developed by Ting-Chun Wang et al. and published in the paper “High-Resolution Image Synthesis and Semantic Manipulation with Conditional GANs.” In this subsection, we will gain an understanding of and implement some of the improvements to pix2pix that were proposed in the pix2pixHD paper.

Improvements to pix2pix

The following are the improvements made in pix2pixHD compared with pix2pix:

  • Coarse-to-fine generator: Multiple generators are used, and each produces an image that is subsumed by the next generator, which produces an image at a higher resolution. Practically speaking, though, pix2pixHD only uses two generators.

  • Multiscale discriminators: Multiple discriminators are used, and each of them operates on a subsampled version of the image. With such a setup, in which the discriminator operating on the lower resolution has a global view of the full image but less information about fine details, the discriminator operating on the higher resolution has more attention to fine details but less information about the global characteristics of the image.

  • Feature matching loss: Feature matching loss minimizes the mean absolute distance between the outputs from different layers of the discriminator computed on real and fake data. The feature matching loss is calculated as follows:

Get hands-on with 1400+ tech skills courses.