In this video, you'll learn about identity loss in CycleGAN. First, you'll learn about how Identity loss works, and then you'll see how this impacts outputs. Identity loss is an extra loss term. Yes, you're going to have even more terms, but it is an optional loss term that was proposed in CycleGAN, mainly to help with color preservation in the outputs and you'll see how that plays out shortly. In addition to adversarial loss in the cycle consistency loss term, there's another pixel difference loss term that you could use. This one again is optional called identity loss. Identity loss helps preserve color in images and have your mapping essentially make more sense. What that means is that it ensures that putting an image like this horse into this opposite generator is what I'm calling it, which is the generator that goes from zebra to horse. When you put this real input into this zebra to horse generator, it should ideally output the exact same image because it's already a horse style, it's not a zebra, right? You expect here is a zebra to horse generator will apply an identity mapping or essentially no change in input to the output. What you can do for your loss term is that you can get the pixel distance between the real input, and whatever the generator produces, and the output, and add that to your loss function. In this case where the pixel distance is zero, the identity loss has a loss of zero, and so that's the idea. This is exactly what you want your generator to be doing. It's already a horse. You don't want your generator to transform it into any other thing, so you want to encourage this behavior. The converse is, if the generator then maps this horse image to something weird, it changes the image in some way. Perhaps it changes the color, for example, which is not uncommon because the generator is mapping between maybe black and whitish color to a brown, and so maybe it found some other way of doing that, and it will try to make the general tone of the input image into something else. Here you want to take the pixel distance between this input and this output here, and discourage this mapping from being anything but identity. In the context of cycle again, and it's entire loss function for the generators, in addition to your adversarial loss and your cycle consistency loss, you now have this extra identity loss for both the zebra to horse generator where you put in the horse, as well as the horse to zebra generator where you put in the zebra. Together, these make up the identity loss or this, and you again want to add a lambda term. I'm going to say this is lambda one, lambda two, different weightings for the cycle consistency loss term and the identity loss term. Here's an example of how identity loss can help guide your CycleGAN. Let's say as input, you have these images and these images are going into, again, that is trying to map it, let's say, to a different type of scenery. With identity loss, you really want to encourage this identity mapping. Let's assume we're expecting an identity mapping. However, without identity mapping, you sometimes can get these types of colored distortions where I can imagine that these are trying to map between perhaps summer and winter scenes, and it's trying to make a bluer tone for winter, and that's what happens without this identity loss term when we actually do want that identity mapping. In summary, identity loss takes a real image in one of those piles and inputs it into the opposite generator. What you expect is actually an identity mapping, because that input image that you're putting into your generator, already has the styles that the generator is trying to map it to. Pixel distance is used to determine this, and ideally there's no difference between input and output. The identity loss is zero. Identity loss is overall and optional loss term that has been shown to help with colored preservation, in some tasks. The main reason why it's optional is that, it's been shown in many cases, to be very helpful, but in other cases not to make much of a difference.