All right, it's time to put your CycleGAN altogether, so this consists of two different GANs with cycle consistency loss that puts a cycle in CycleGAN. The least squares adversarial loss, which is your main loss term, and then the optional identity loss term. So first I'll show the process with an example going from a real zebra to a fake horse here, but it's also the same the other way around, just the opposite way. And so to start, you first input your zebra image and you get a fake horse using your generator that maps from zebra to horse. Your horse discriminator then looks at this fake image as well as real images. It doesn't know which one's which, and outputs a classification matrix of how real or how fake it thinks those patches of those images are. And what's used here is least squares loss, and specifically for reals, this classification matrix is full of ones. And for fakes it's full of zeros, and that's how you compute the least squares adversarial loss. And that's for the discriminator and for the generator, this classification matrix is actually all ones. So in addition to this least squares adversarial loss, you also want to take your fake horse and feed it through the other generator that's going from horses to zeros to generate this fake zebra such that you can then compute the cycle consistency loss in this direction. And you do that by taking the pixel difference between the real input and this fake generated zebra because they really should look the same as you're only supposed to be transferring styles between these two generators. And again, the same is done in the opposite direction as well, and so this is going from horses and zebras. Then back to horses for the cycle consistency loss and then of course their zebra discriminator here will also apply. If you do choose to use identity loss for your task, you also want to put your zebra through the opposite generator from horses and zebras. To get a zebra you take the pixel difference here and you save that as the identity loss and again you should do the same with horses going through the zebra to horse generator. And voila, the beauty of adding terms to the loss function. [LAUGH] It's so simple yet so effective. There are so many [LAUGH] losses in CycleGAN, six total. So you have your least squares adversarial loss for both of your GANs there. Also your cycle consistency losses going in both directions. And finally you have your identity loss for each of your generators there. And that makes up the entire [LAUGH] generator loss function, which is for both of your generators. So two generators. Meanwhile, each of the discriminators will focus on one of these, so this one is for the horse discriminator, and this is for the zebra discriminator. And so in summary CycleGAN is made up of two GANs, then make a cycle and they rely on each other to try to compute all different types of loss terms. In fact, the generators have six loss terms in total, the least squares adversarial main loss term. The cycle consistency loss, the optional identity loss for each of the generators. And the discriminators are a bit simpler with just least squares adversarial loss using a PatchGAN that you learn from pix2pix.