Cycle consistency loss penalizes changes that prevent an image from being reconstructed after translation to another domain and back. In CycleGAN, it preserves important content while generators change attributes such as hair color, without requiring paired examples. section 6.0 section 6.1
Adversarial loss makes a translated image resemble the target domain; cycle consistency loss checks whether the round trip returns to the original domain. CycleGAN minimizes both objectives. section 6.1.2
A CycleGAN applies the loss in two directions:
- Translate a real black-hair image into a fake blond-hair image, then translate it back into a fake black-hair image. section 6.1.2
- Measure the pixel-level mean absolute error between the reconstructed image and the original; call this Loss_Cycle_Black. section 6.1.2
- Repeat the process from blond hair to black hair and back, producing Loss_Cycle_Blond. section 6.1.2
- Add the two directional losses to obtain the total cycle consistency loss. section 6.1.2
Pixel-level implementation
For images shaped (3, 256, 256), L1 loss averages absolute differences across 3 × 256 × 256 = 196,608 corresponding pixel positions. A PyTorch implementation uses nn.L1Loss() for cycle consistency, while nn.MSELoss() measures adversarial loss. section 6.3.2
Figure 6.2 How CycleGAN minimizes cycle consistency losses between original black hair images and fake ones after round trips and cycle consistency losses between original blond hair images and fake ones after round trips
Use the round-trip diagram to follow how original black- and blond-hair images are compared with their reconstructed versions. section 6.1.2
