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:

Source: https://arxiv.org/pdf/1511.06434.pdf

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: whichfaceisreal.com 

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.

AI_generated_images_mistakes

AI_generated_images_mistakes

  • 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.

AI_generated_images_mistakes

AI_generated_images_mistakes

  • 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.

AI_generated_images_mistakes

AI_generated_images_mistakes

  • 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.

AI_generated_images_mistakes

AI_generated_images_mistakes

  • 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.

AI_generated_images_mistakes

AI_generated_images_mistakes

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 : 671  
 
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

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,…

Hashmap: hashing, collisions and first functions

Today we are going to study some concepts closely related to hashmaps. The concepts we are going to see are hashing and collisions. Hashing The idea of hashing with chaining is to…

How are businesses using artificial intelligence?

The term Artificial Intelligence (AI), "the intelligence of the machines", unifies two words that, a priori, could not be associated, since the term intelligence is attributed to the faculty of…

What is the origin of the word SPAM?

It is 40 years since the first spam e-mail was sent. Surely most of the readers of this blog had not yet been born, as well as annoying mail with which we are bombarded in…

Is JavaScript good for machine learning?

One of the things you always hear when you are talking to someone related to the M.L. world is that, one must learn Python because the vast majority of the…

What is Machine Learning ?

Artificial Intelligence or AI is a trend in technology and has been the main topic of many philosophical debates as to where this field will lead us as humanity. This time…

Online Marketing Strategies for your Ecommerce

The impetus and desire we have to launch our online store can be counterproductive if we have not defined a pre-launch strategy. If we are determined to launch our ecommerce…

How to Improve Your Website to Attract Local Customers

If you run a small business, make no mistake: local search is imperative for your success. You might have lofty dreams of attracting the world to your website, but it’s…

Future of Artificial Intelligence for Startups

With how far-reaching the scope of Artificial Intelligence (AI) is, it is bound to make an enormous impact in the lives of people — the realm of startups is no…

How to Pique Customer Interest

If your target audience aren’t interested in your brand, your marketing campaigns, or the service that you provide, why would they feel compelled to bring you their business? If you’re…

How to Build Your eCommerce's Email List Using Instagram

Instagram is quickly becoming a favorite social media channel among eCommerce business owners because of its high engagement rate. But when it comes to getting the highest return on your investment,…

Java: introduction to Design Patterns and Singleton Pattern

Anyone with even a minimum experience of programming, should have realized that the majority of the problems have common elements. In fact we often find problems with the same pattern…

We use our own and third-party cookies to improve our services, compile statistical information and analyze your browsing habits. This allows us to personalize the content we offer and to show you advertisements related to your preferences. By clicking "Accept all" you agree to the storage of cookies on your device to improve website navigation, analyse traffic and assist our marketing activities. You can also select "System Cookies Only" to accept only the cookies required for the website to function, or you can select the cookies you wish to activate by clicking on "settings".

Accept All Only sistem cookies Configuration