Dye Your Hair — Or Look Older — Using AI

Well, neither has anyone else ????.

All these faces are computer generated by a GAN.

Think of GANs like this.

A forger (Generator) is attempting to forge art from a gallery, but with no knowledge of what that art actually looks like.

Think of him as a blind forger.

The detective (discriminator) is a world-class counterfeit art detective and his role is to simply learn as much as he can about the art in the gallery so that he can do his job of determining whether the artwork is forged or real.

—At the beginning of the game, the detective is always right.

The blind forger’s only input is whether his forged art is getting better or not.

Eventually, the forger starts making artwork that’s indistinguishable to the detective from the galleries real artwork.

Every time either the forger or detective get anything wrong, they learn from it and get smarter.

This means, that even though the networks are in a game against each other because they learn to get better at doing their own job the other network is forced to also get better at its own job.

—Here’s something that’s not surprising.

Every year, new AI techniques/concepts are released that completely dwarf past attempts at the model's task.

Now here comes the good part…—Introducing StarGANYeah, generating realistic completely new faces of people that have never lived before is pretty cool — and eerie — but GANs can do much more than just that.

StarGAN uses GAN’s in a really clever manner to create the best image-to-image translator out there (so far).

You’ve seen the results of StarGAN:StarGAN translates target domains for a handful of celebrity photos.

Here’s how it worksRemember how GANs work?The discriminator is trained:The first step of the StarGAN process is to train the discriminator and the generator to start producing realistic remapped images.

The discriminator has two outputs on this model;Determining if the image is real or fake and,Labeling the image’s domain correctly (brown hair, female, etc)2.

Original Image is Translated To Target DomainThis Is How StarGAN works.

Alright, now that the discriminator is trained it’s time to create the actual fake image.

The generator is fed the original image, it’s intended target domain and generates a fake image.

So again, in this step, the generator actually constructs the image.


“Fake” Image Is Reconstructed Back To Original (What????)This step seems a bit counter-intuitive.

In it, the generator takes the fake image and reconstructs it back to its original domain.

It tries to reconstruct the original image.

Then, that reconstructed image is passed through the last step again, to make a fake.

This is repeated multiple times to make the photo really good.

Why?It’s a simple reason.

When translating the images domain (producing the fake image) it’s not very hard for the image to not preserve the contents from the original image.

It strays wayyy too far from the original face, even if it does the job of translating domains.

To solve this, researchers use something called cycle consistency loss, used in CycleGAN.

This method loops through a process of generating a fake image and reconstructing the original input through the generator.


Time To Trick The Discriminator (Again)This is the real fun part.

After finishing a fake/translated image.

The image is run through the discriminator, which decides whether the image is fake or not and selects its label.

If the image is good enough, the discriminator would label it correctly and think that its a real image.

If not, well… time to work harder generator.

Is That How StarGANs work?Yes, essentially.

But, there is a ton of more information on the actual research paper behind StarGAN (go check it out!).

—Let’s go over some of it again.

TakeawaysImage-to-Image translation is the technology behind the stuff that can change your hair colour (virtually), or the season of your favorite nature photo.

It changes the domain (an aspect of an image) using GANs.

Generative Adversarial Networks are networks made up of a generator and discriminator, at a constant game against each other.

This race is what gives GANs the ability to get better and improve from itself.

StarGAN is a framework which performs image-to-image translation a pretty big scale.

In it, generated images are actually reconstructed back to the original image, before a fake being generated multiple times to keep its originality.

Before You GoClap ????.this post to show some support.

Make sure to check out my other articles!Sign up for my monthly newsletterCheck out my newly made websiteAdd me on Linkedin to stay updated!s.. More details

Leave a Reply