FaceApp: Know Your Viral Fever ! How does it work ? Privacy Concern resolved ?

Social Media's Latest Obsession!

After stulish, sarahah, kiki etc. FaceApp is the latest to sweep through the news feeds of milions of social media users. The app is not a new one. It has been around since 2017. But, their latest improved "Old Age filter" seems to have taken over the internet. Along with it comes a spectrum of popular reactions. Some people are finding it extremely funny and may be curious to know how their old self might look like. Some people are really annoyed ! People who are more aware of happenings are concerned about the user data the app collects and above all Geeks like us wonder how the app actually achieves this fun(?) old age tranformation ! Let's try to know the magic behind the filter without getting too deep into technics and mathematics !

How does it Work ?

Let's first understand the problem at hand. Given a person's image the app first has to detect the face and then detect every feature of the face which corresponds to "young age" and transform those sections of the images to features corresponding to "old age". Examples include: turning brown hairs to white, smooth skin streches to wrinkly. These are not by any means simple and easy to do accurately by a machine. So, some deep structure learning comes into play while you are having fun with your app. If you are interested to get some basic idea of what's happening, read on...

Before going into trying to figure out exactly what FaceApp is doing, let's look into what a "Neural Network" is. A neural network in Machine Learning language is an interconnected structure of layers of small mathematical units of computation. These mathematical units are very similar to neurons in the brain and hence the network is "neural". So, you can think of a neural network as a very low complexity brain.
Comparison of a biological neuron and a neural network node

Now, these mathematical nodes can be arranged in interconnected layers. That is: the outputs of one layer of nodes can becomes inputs to another layer of neurons. Which makes it look like something like this:

Which means you can have one input layer , one output layer and any number of hidden layers and each connecting edge has some weight with which to way the inputs as you can see in first picture. 

Now, What does all this have to do with the FaceApp ? Well, it has everything to do with it. As it happens, computer scientists have devised an exciting algorithm ("Backpropagation", search google if you are curious!) with which given a set (read, "training set") of correct input-output pair one can tune those edge weights such that the network gives the correct output given those inputs. And with optimal tuning of the  weights (geeks read model paramters) the network can become able to produce correct inputs (read "test set") for even new inputs with unknown outputs. That means in simple terms "The network learns a model of the data" so that it can predict the outcome of unknown input data with high accuracy!

Anybody who uses Facebook knows it has a very strong face recognition system. ("The want to tag noobmaster69 ? " question on noobmaster69's face on a photo you have uploaded with noobmaster69). Facebook achieves this with the help of something called "Convolutional Neural Network".

People who study mathematical sciences know what a convolution is. Let's not get into that. We shall just give the idea here. Consider you have a greyscale image and want to give it's pixel values as input to a neural network. If you think, you will realise pixels which are far away in the image might not have much of a relation between them while pixels which are adjacent have much more relation between them to discover.   Therefore, considering only nearby pixels together at a time makes more sense and reduces a lot of computation. (yes, Neural Networks are computation heavy, more on that later on some other post.). A convolutional layer does exactly that and believe it or not the retinal ganglion cells in your eyes are a layer of convolutional neurons too. (You can think convolutionn is approved by evolution for vision tasks!)

So, Facebook trains a CNN (convolutional neural network) to recognise faces of individuals and given a new face (In our example noobmaster69's face) FB's CNN predicts to which facebook user this face belongs to.

So, What does FaceApp do ?

Given a face, telling whose face it is, is different from given a face transforming it to generate a new face. In the former face recognition case the output of the neural network can just be a number but in the second the output has to be a sequential array of pixel values constructing the old age image. A conventional CNN won't be able to do this. However, a "Convolutional Generative Adversary Network" can ! As the name suggests a GAN is a generative network i.e. it generates ouputs which are from "the input space" (some linear algebra lingo you might or might not get).  The model looks like the following:
source: https://gluon.mxnet.io/

Simply speaking, you can connect two CNNs forward and backword and train an interplay between them resulting in the first one learning some deep structures from input and the second one generating a transformed image using those deep structures. That is exactly what the old age transformation wants to achieve.

However, it is unknown exactly which neural network model the developer team of the app uses. But many modern networks like a "CycleGAN" could be trained to do the job. The exact details of the model is a matter of "engineering art" that belongs to the developers only. And we give a big applause to the developers who perfected the filter to such an astonishingly great  extent.

Privacy Concerns

If you are quick minded you will realise training the FaceApp to do what it does requires a set of labeled data (training set of young and old age images of many persons). As the app has gone viral it also gives the app developera huge opporunity to mine the required data because people everywhere is using the app to generate and upload their images. Now, if you are the doubting kind of person you will go look at their privacy policy to see exactly what they are doing with the data of these millions if people and more so since the app is built by a developer team in Russia (given all sorts of conspiracy stories :v)

Now, some people did exactly that and found out the following:
  • FaceApp’s terms and services ask for ‘perpetual’ ‘irrevocable’ royalty-free and worldwide license to use content, i.e. the company can use any uploaded  for promotional purposes without acknowledging the person at all.
    Since FaceApp do not require users to log and most do not, there is no way to identifiy owners of the photos. So this is largely as anonymised data used for training machine learning algorithms, but of very limited use otherwise. 
  • More worrying point: The app uploads the data to google and AWS clouds. Although they claim they remove the images after 48 hours from their servers it is unclear whether they are removed from clouds also.

FaceApp's Response Today !

Faceapp today came out to officially respond against the privacy concerns saying the following main points:
  • It does not uploads all photos from a user’s phone gallery to its servers. It added that only photo selected for editing is uploaded.
  • They denied sharing user data with any third-parties or with Russia.
  • FaceApp also confirmed that the photos are stored in the cloud for editing and "most" are deleted within 48 hours.
  • Users can request FaceApp to delete all their data, the company has confirmed. It recommends sending deletion requests via ‘Report a bug’ feature in Settings for faster processing.(That is a bad design choice though)
So, that is all for today, we wanted to keep this article an insightful one without using too many mathemetical jargon. Let us know your thoughts  in the comments  below. Do you think the app is safe to use ? How did you like the basic idea of the technology behind it ?

Bye for now ! See you all in the next post :-)