FaceApp: How Neural Networks can do Wonders

Harsh Aryan
5 min readJul 18, 2019

--

“Who sees the human face correctly: the photographer, the mirror, or the painter?” — Pablo Picasso

Well seems like apps today not only correctly see the face, but can transform them too.

The viral Russian app, FaceApp which automatically generates highly realistic transformations of your face is the new trend right now. But what goes behind making such an app. Let’s find out.

If you’ve been using the internet recently, you must, must have gone through these photos of people, selfies which look many years older than their real selves. Or a different version, the same person in a different gender or having facial hair, or the classic Walter White look from the TV show Breaking Bad. And they look quite realistic, right?

Even the celebs are trying this out and posting on Social media. The likes of Drake, Jonas Brothers, Charlie Puth, David Guetta, Sam Smith, Billie Eilish, Rahul Subramanian and sooo many more have stormed Instagram with their FaceApp renditions.

This might feel strange how faceApp manages to do so, but its just a classic implementation of Neural Nets and Generative Models. Well if you don't know these terms, no need to fret, this article will try to simplify the concept for you. Who knows, maybe you’ll end up learning ML out of it 😂.

So what does happen when we apply a filter on FaceApp?

Simply saying, FaceApp is taking features from one face and applying to another. So it has a database where it has a huuuge amount of pictures of faces and it extracts features from your face, and applies some changes which render your face to look different, yet the distinctive features remain which make you identify yourself. So now you can change the gender of the photograph, age yourself decades and do what not with striking realism.

Now, where does the Machine Learning comes in? What does it do? What is it?

Simply stating, a computer learning things on its own without being explicitly programmed to, just by seeing data and its labels is called Machine Learning. You give a large dataset, label all of it and feed it to an ML Application, now it learns itself how to identify and segregate data. For example, if you feed one thousands of pictures labelled cats and dogs, the app will learn to segregate them on its own, it will learn to recognise features that differentiate a cat from a dog on its own. You don't need to tell it that cats have whiskers and dogs don't, so classify them as such.

Enough of Cats and Dogs, back to FaceApp.

FaceApp uses Neural Nets or rather Generative Adversarial Network (GAN) to do what it does. And to get into specifics the neural net is one called “deep generative convolutional neural network”. Now, what are Neural Nets to begin with?

Neural networks are a set of algorithms, modelled loosely after the human brain, that are designed to recognize patterns. That's it. Some nodes or say neurons connected to each other which pass information like the ones in the brain do. Here each neuron processes the info and passes on to the next one.

Initially, like a child’s brain, the neural net is random, it hasn’t learnt anything and as we feed data to it, it starts learning. As a child slowly learns features one by one, with increasing complexity, so does a neural network.

Neural Network demonstration for Digit classifier

The different nodes in layers have features. Features can be understood as functions of the data input to it. The data is processed as a function and the output sent to the next neuron with increasing complexity until in the last node we can determine what kind of output the data is( which is our prediction), so we start finding patterns and features.

So what FaceApp does is uses AI open-source libraries like TensorFlow to find features from your face and then apply the filter or say add features which make you look old or whatever you choose.

Using the app on a single image consecutively

If you consecutively run a filter on a single image, you will see the raw features generally associated with Hidden Layers of a Neural Net. The features the hidden layers store can be clearly seen in the image:

Now concluding, let us know what GANs are.

Basically these are Neural Net technology which can be used to create new, fake data which looks like any real data.

For example, it can create new faces, new paintings which will look like any other but which actually does not even exist but are made by your machine. See, the machine is actually learning.

The image clearly looks like the one we would expect to find in the last hidden layers of a neural network ; The work of a neural network at play is evident here.

As the definition, Generative adversarial networks (GANs) are deep neural net architectures comprised of two nets, pitting one against the other (thus the “adversarial”).

Some artworks created by GANs ; Photo via Art and Artificial Intelligence Laboratory, Rutgers University

So now you know how ML can even create new faces, so it may be easier to contemplate taking features from one face and applying to another or say taking features from your face and applying on it features which make you look older.

Memes on FaceApp are the trend right now

📝 Read this story later in Journal.

👩‍💻 Wake up every Sunday morning to the week’s most noteworthy stories in Tech waiting in your inbox. Read the Noteworthy in Tech newsletter.

--

--

Harsh Aryan

Gold Microsoft Student Ambassador, Undergrad at IIIT Allahabad; Google AI’s Explore ML Facilitator, Avid Reader, Extrovert;