GAN Generated Images

Discovering the Fascinating Possibilities of AI

by Iveta Karailievova Date: 28-10-2020 AI GAN styleGAN computer generated images machine learning deepfakes

Let’s play a game - can you guess what these portraits have in common? 

GAN generated portraits

They all depict non-existent people. All these images were created by artificial intelligence. We could say, that AI “dreamed” those people up. 

How can a machine make up people’s faces?

The genius idea came from Ian Goodfellow, who was a PhD student back then in 2014, when he and his colleagues published a paper on this topic. He suggested a concept known as GAN – generative adversary networks. Generative because they generate -> create results (images) and adversary because the two networks act as opponents – they are “playing a game” against each other. One of the networks wants to generate an image which looks realistic, and the other network has the task of telling if the image is generated by the network or if it is in fact an original image from the data set of real photos. 

To better explain this concept we can use the popular forger and critic metaphor, which I personally find very useful. Imagine the following: one of the “players” (the deep learning network) wants to forge paintings, trying to imitate artworks, while the other one acts as an art critic, who he wants to be able to distinguish which painting is an original and which one is a forgery. So the forger begins his job by randomly creating images, and the critic assesses if the image is an original or forged. In our case, original would mean that the image comes from the original data set with portraits of real people. After each turn, both of the players become better at their job, ideally resulting in a situation when the forger creates images so good, that the critic has no way of telling if the painting is real or fake and thus will guess with a success rate of 50%, being right equally often as being wrong.

Want to get more specific?

The first network has the role of a generator – it uses input in the form of randomly sampled noise vector from a normal distribution and creates an output in the form of images, which is then fed to the other network. This one’s role is called discriminator because it tries to tell apart a fake input from a real one. The generator is continuously learning through the feedback of the discriminator, and vice-versa.

Building on this idea, a few years later, NVIDIA, the company you might know for designing and manufacturing graphics processing units, developed the styleGAN algorithm. Also, they made their code open-source in 2019. But to train a GAN, you need very large data sets so that the networks can learn from them. In the case of styleGAN, portraits of celebrities as well as creative commons license photographs from Flickr were used. NVIDIA were so nice and made available also the already trained model so that those interested could skip the time-consuming process of training the networks and jump to generating images right away.

At first, the images created by the styleGAN model resembled something straight out of Lovecraft’s Necronomicon, but be the judge yourself:


But as always, progress cannot be stopped and the new styleGAN2 model improved the results significantly, producing the images we fooled you with in the introduction to this article. 

If you would like to try and guess which person exists in the real world and which maybe only in Matrix, go and try at this aptly named page: 

After you gave it a go, here are some tips on how we can tell them apart (for now) only by looking for visual clues, the so called artifacts. 

How to tell them apart

  • Background  

Be on the lookout for weird looking background. Since the whole training of the networks is focused on depicting realistic faces of people, the background generated has a tendency to be suspiciously distorted, blurred, at times it might contain the occasional monster.



  • Hair

This has been always a big problem, depicting such an extraordinarily detail-heavy body part like hair is tricky and many times, the image contains detached strains of hair seemingly growing out of uncommon parts of the face or hair looking as if it was painted with a thick brush, not having the appropriate pattern.



  • Symmetry

It seems that styleGAN has a hard time with generating pieces that go in pairs, like earrings. So if you see non-matching earrings, eyes looking in different directions, or glasses having mismatching frame shapes it could be a sign of AI doing its business.



  • Water droplets

A dead giveaway that you re not looking on a real persons photo is seeing blobs  that look like drops of water. These appear most commonly on parts of the image where the background borders the face.



  • Teeth

The styleGAN model has problem when shifting the angle with which a person is facing the image. So at times, the teeth do not shift accordingly, remaining in the same position as if the person was facing the camera directly.



And what if the algorithms get even better?

In 2018 the new styleGAN made improvements, leading to some of those artifacts not happening anymore. Does this mean in the near future we wont be able to tell them apart by simply observing them with naked eye? Probably yes. But worry not, in order for AI to claim its reign and declare us their overlord will still have to fool mathematicians. 

In a simple mathematical analysis of the pixels, images generated by the AI reveal themselves through suspicious patterns. When you convert images created by deep neural network algorithms into a frequency representation, you can easily recognize the because of their grid-resembling pattern. This discovery was made by Joel Frank and his team at the Ruhr-Universität Bochum.

In the discrete cosine transformation, the image is expressed as the sum of many different cosine functions, the researchers explain. While natural images consist mainly of low-frequency functions, artificially generated images show different types of artifacts in the high-frequency range.

It seems to be a structural problem of all deep learning algorithms, explains Frank. "We assume that the artifacts described in our study will always show whether the image is a deep-fake image created with machine learning".

So, you heard the man. There is no need to worry… for now.

Image by Gerd Altmann from Pixabay.

by Iveta Karailievova Date: 28-10-2020 AI GAN styleGAN computer generated images machine learning deepfakes hits : 4525  
Iveta Karailievova

Iveta Karailievova

Originally coming from a marketing background, decided to turn her life around and immerse herself into the wonderful exciting and most importantly – never boring world of technology and web development. Proud employee at MA-NO . Easily loses track of time when enjoying working on code. Big fan of Placebo, cats and pizza.


Related Posts

Teaching ChatGPT to mimic your writing style

InChatGPT is an impressive conversational AI tool that showcases remarkable capabilities in various tasks. However, it also has limitations, such as occasional inaccuracies and a somewhat robotic and generic writing…

Top best AI Image Generators: unlocking creativity with Artificial Intelligence

Artificial intelligence (AI) is revolutionizing not just business and healthcare, but also the creative industries by introducing a new era of AI-generated art. The accessibility of AI technologies and tools…

The Impact of automation and Robots on human jobs: exploring controversies and opportunities

Automation and technological advancements have raised concerns in some sectors about the possibility of robots taking away human jobs. While it is true that robots and artificial intelligence can perform…

Is AI sexist? A gender perspective in Robotics and Artificial Intelligence

In her article, Maria Antonia Huertas Sánchez of the UOC - Universitat Oberta de Catalunya, provides an explanation of why we should incorporate a gender vision in robotics and artificial…

Hidden Gmail codes to find a lost e-mail

If you have a lot of emails in Gmail, there are a few codes that will help you find what you need faster and more accurately than if you do…

How to download an email in PDF format in Gmail for Android

You will see how easy it is to save an email you have received or sent yourself from Gmail in PDF format, all with your Android smartphone. Here's how it's…

AI predicts crimes in the US like Minority Report

As in Spielberg's film based on Philip K. Dick's novel, an AI model was able to predict crimes in some American cities before they happened. However, it also revealed the…

How to Send Email from an HTML Contact Form

In today’s article we will write about how to make a working form that upon hitting that submit button will be functional and send the email (to you as a…

Deepfakes Detection – An Emerging Technological Challenge

It is highly probable that while browsing the Internet, everyone of us has at some point stumbled upon a deepfake video. Deepfakes usually depict well-known people doing really improbable things…

7 Astonishing New Uses of Machine Learning

Recently a strange video published on YouTube caused a controversy – it was a funny take on Queen Elizabeth’s traditional Christmas message created by Channel 4, a British public-service television broadcaster. They…

What is DNS Blockchain and how to use it

To be able to navigate the Internet, to enter a website and have it show us all the content we want and search for, certain functions and characteristics are necessary.…

3 awesome ways technology is helping us combat the COVID pandemic

Times are hard now, that humanity once more stumbled into a terrible pandemic. But in comparison to the poor folks back in 1918 when the Spanish flu was on wreaking havoc,…