Breeding Paintings With Machine Learning

This week at the Ars Electronica festival for art and technology in Linz, Austria, Artnome friend and artist Alexander Reben will be debuting a photo booth that mixes faces together in latent space. Reben calls the project Latent Face, and according to him, “It looks into the stylegan flicker model for the latent vector closest to the input (which is two or more images of faces), then the vectors are operated on to find the midpoint vector and produce the output.” That’s a fancy way of saying it creates something of an average from the two or more faces provided as inputs to produce a convincing-looking digital offspring.

Grant Wood, American Gothic - 1930

Grant Wood, American Gothic - 1930

As an art history nerd, I of course had to ask Alex if it was possible to cross-breed painted portraits. He obliged, and his results are pretty great.

First up, Grant Wood’s American Gothic, maybe the most iconic double portrait of all time. What many people may not know about American Gothic is that the woman in the painting is the artist’s sister, and the man was actually not Wood’s brother-in-law, but his dentist. So this iconic couple were never actually a couple at all, but that did not stop us from wondering what it would look like if they had a child that grew into an adult. You can see the results below and the animation at the top of this post.

Grant Wood, detail from American Gothic - 1930

Grant Wood, detail from American Gothic - 1930

Grant Wood, detail from American Gothic - 1930

Grant Wood, detail from American Gothic - 1930

Alex Reben, American Gothic Hybrid

Alex Reben, American Gothic Hybrid

One of my favorite real-life artist couples is Frida Kahlo and Diego Rivera. It is well-documented in her work and her journals that Frida had always wanted to have a child with her husband Diego. Tragically, Kahlo suffered horrific injuries in a bus accident when she was just 18 that made that difficult.

I asked Alex if we could find the latent vector between the striking self-portraits of Kahlo and Rivera below.

Left: Frida Kahlo, Self-Portrait with Monkey - 1938; Right; Diego Rivera, Self-Portrait - 1949

Left: Frida Kahlo, Self-Portrait with Monkey - 1938; Right; Diego Rivera, Self-Portrait - 1949

Alexander Reben, Midpoint between Kahlo and Rivera self-portraits

Alexander Reben, Midpoint between Kahlo and Rivera self-portraits

You can see the animation moving through latent space between the two self-portraits below.

Regular Artnome readers may recall that we averaged every painting by Van Gogh into a single image. For that image, Artnome data scientist Kyle Waters set the aspect ratio for all the portraits to the same dimensions and averaged out the color for each pixel location. It produced the ghostly-looking portrait below.

Kyle Waters, Average van Gogh Portrait

Kyle Waters, Average van Gogh Portrait

Unlike Water’s pixel average portrait, Reben’s averages (or more precisely, midpoint images) from StyleGAN are creating entirely new facial structures, not just averages of pixel color values. In this way, it feels more like breeding paintings than creating a visual average. Reben pointed out that, “You can often see this in the hair and facial hair, which many times is a different style than either of the two input images.”

Vincent van Gogh,

Vincent van Gogh,

Vincent van Gogh,

Vincent van Gogh,

Alexander Reben,

Alexander Reben,

So how does this all work? Okay - let’s start here. Right now you have a digital twin for every photograph ever taken of you in the past, or that will ever be taken of you in the future. These twins exists in a near-infinite matrix of possible faces (called latent space) produced by a deep-learning algorithm developed by Nvidia called StyleGAN.

Like all GANs (generative adversarial networks), StyleGAN is comprised of two neural networks: a generator and a discriminator. In this case, Nvidia trained the generator on 70,000 high-quality images of human faces at 1024×1024 resolution taken from Flickr until it was able to fool the discriminator into believing the images it produced were real human faces. You have probably already seen projects that use this model like This Person Does Not Exist, which became very popular earlier this year.

Reben’s project is interesting to me for two reasons. First, it focuses more on the ability to perform mathematical functions on the faces, and second, it personalizes this technology by finding and cross-breeding images that look like the participants in his photo booth. 

In other words, seeing hyper-realistic faces of people that don’t really exist is cool, but discovering I have infinite digital twins that can breed to make offspring with everyone else’s digital twins… well, that is much cooler in my book! 

As an example, here is one of my digital twins:

Jason_Bailey_Latent_Space.png

The image on the left is a photo I took with my phone and sent to Alex; the image on the right existed in latent space long before I ever took the photo of myself (in the same way my date of birth existed as a series of numbers before I was born).

To help describe how the process works a bit more, Alex and I took one for the team and made our own handsome man-baby together (whom we call “Jalex”).

Let’s walk through the steps behind the creation of our little bundle of joy.

Step One: Take Two Photographic Portraits

xYrPLxSA.jpeg
0mEupeag.jpeg

Step Two: Find Our Twins In Latent Space

Reben is using code called StyleGAN Encoder that that identifies and locates the latent vector (the digital twin) within latent space that most resembles the input image. You can actually see it honing in on the right image in latent space in the gifs below.

Step Three: Find the Midpoint

Once Alex located the location of our digital twins in latent space, he could then travel to the arithmetic midpoint between the two and find our “average,” or genetic offspring. I have to say, we produce a pretty handsome looking man-baby.

What Other Math Can We Do?

Again, because our digital twins are described numerically, there are several other mathematical operations that can be performed. If you subtract Alexander’s face from mine, you get this happy little creeper.

unnamed.png

And likewise, if you subtract me from Alexander, you get this teen heartthrob.

a-j.png

Kind of weird, right? Whatever features of ours that have been subtracted from the other were apparently pretty important to us looking like our handsome selves.

Reben finds that people respond more to images of people that they know, like the interpolation gif between our two most recent presidents. I find it funny that latent space has no real answer for Trump’s hair.

However, even more engaging than combing pictures of famous people is having your own image combined with someone else. Reben is aware of this, and it is the core idea driving his photo booth at Ars Electronica. For example, I had Reben create a digital offspring for me and my wife. The results were kind of astonishing and bizarre-feeling in a way that you could only feel if it was your image.

Screen Shot 2019-09-01 at 8.47.55 AM.png
0mEupeag.jpeg
fredcarf4excw (Small) (1).png

I’m sure Reben’s photo booth will be a hit at Ars Electronica. If you happen to be there, be sure to swing by and say hello to Alex!





The Generative Portraiture of Espen Kluge

“The force of art lies in its immediate influence on human psychology and in its active contagiousness.” - Naum Gabo

Espen Kluge, ash when he arrives, every time - 2019

Espen Kluge, ash when he arrives, every time - 2019

I have a deep and well-documented love for generative art. I’ve gone as far as saying that generative art is the most important art of our generation, as it best reflects the digital transformation that so deeply separates us from all that came before us.

However, the nature of generating art with code typically leads to results that are highly geometric, abstract, and non-representational. And my first true love in art will always be portraiture.

So when I discovered the arresting generative portraiture of Norwegian artist Espen Kluge several weeks ago, I was immediately taken in.

Espen Kluge, makes great choices while angry - 2019

Espen Kluge, makes great choices while angry - 2019

I love portraiture because evolution has trained us to read the nuance of human facial expression with a higher degree of sensitivity than any other visual input. From finding a mate to sensing a foe, our ability to read the subtle expressions of others is critical to navigating many of the most important and meaningful aspects of life.

Our supercharged sensitivity to these facial signals creates a playground for portrait artists who can combine, bend, exaggerate, and break the signals to manipulate us and make us feel with heightened intensity.

Kluge does this masterfully in his new series of portraits titled Alternatives which source and alter photographic portraits to tell stories alternative to their origins.

Espen Kluge, superclear when I say it’s risky business - 2019

Espen Kluge, superclear when I say it’s risky business - 2019

Though they are composed of two-dimensional vectors, Kluge’s portraits feel structural, almost architectural. They immediately reminded me of a blend of the dynamic sculptures of Russian constructivist Naum Gabo mixed with a hint of mid-century modern symmography (aka ‘70s string art).

Linear Construction No 2 Naum Gabo, 1950

Linear Construction No 2 Naum Gabo, 1950

1970s symmography string art

1970s symmography string art

With twenty years’ experience working in digital media, if I see something beautiful and I can’t figure out how it was made, I feel deeply compelled to reach out to the artist.

I set up a call to speak with Espen Kluge about his work and caught him during a visit to Sweden to help his fiancee prepare her apartment for sale.

I was honestly a bit surprised to hear Kluge speak perfect English because I had assumed his deadpan titles like “makes great choices while angry“ and “cruise ships and police cars“ were in part a function of English not being his first language. He explained that he gets his titles by pulling snippets from the text associated with the source images he uses to create his portraits. He was a bit apologetic about this, and wondered aloud if he should spend more time on the titles. I assured him the titles added just the right amount of mystery and fun while avoiding the trap of becoming overly pretentious and serious.

Kluge shared that he grew up in Norway, where he still lives and works today. He earned a bachelor’s degree in fine arts but then pivoted and studied composition in music for TV and film for his master’s degree.

Kluge’s music, like his portraits, is psychologically nuanced and exploratory. You can hear his soundtrack for the 2018 television show Who Killed Birgitte? on Spotify. I listened to it while writing this post and highly recommend it. It’s my new go-to music for writing.

3933a0eb9c63e975.jpeg

I wanted to know how someone who went to school for visual art and then film scoring got into programming and code-based art.

Kluge explained that while studying for his master’s degree, he had developed an obsession for an idea that he could not shake:

What if there was a keyboard that had keys that lit up not based on anything that was pre-composed, but in real time, based on your own improvisation?

Kluge became so obsessed with this idea that he taught himself how to code from scratch at the age of 27 so he could start his own company and build his invention.

Drawing from the patent awarded to Kluge for his improvisational keyboard

Drawing from the patent awarded to Kluge for his improvisational keyboard

Though his improvisational keyboard was programmed in Objective C, Kluge often took breaks to create more visual projects in Processing and eventually JavaScript. One such project was based on the idea of making an interactive logo for his website. The logo was a portrait, and Kluge wanted it to take on the colors of the pages it appeared on and to “do something interactive,” as he described it.

Though he failed at his initial objective, Kluge ended up creating a really cool piece of code that took in photographs as input and then output what would become the initial foundations for his colorful vector-based portraiture series.

Original logo project image that spawned Espen Kluge’s current portrait series

Original logo project image that spawned Espen Kluge’s current portrait series

At the time, busy getting his master’s degree and building his company, Kluge decided to put the logo project on the back burner, where it remained for many years. It was only this past January that he rediscovered the project and began refining the code again.

I asked Kluge how his code works. He explained that the code loops through all the pixels in a raster image and chooses some at semi-random, then engages those pixels by putting lines between them. He added that he is able to adjust five or six variables to do things like focusing in on one color more than another.

Espen Kluge, cruise ships and police cars - 2019

Espen Kluge, cruise ships and police cars - 2019

Kluge admits the code is not super clean, but through his manipulations, he has built his own tool for making art. The results speak for themselves.

Kluge would like to get to a spot with the project where he can do less and less work on the images so that it becomes more generative. But for now they require a lot of creative intervention to yield the results he is happiest with.

Espen Kluge, they don't have this for humans - 2019

Espen Kluge, they don't have this for humans - 2019

For now, each image can take Kluge from ten minutes to an hour to create. The process requires that he source several input images, as some just come out “flat and boring” and he is not always sure why. But over time, his intuition has improved as to what makes for better input images. For example, photos with distinct facial expressions, open mouths, good lighting, rich skin tones, etc., seem to work best. He really likes photos of dancers with makeup, as they tend to have strong or exaggerated features.

Kluge often takes the base photo into Photoshop and changes the colors and gradients as a middle stage based on what he knows will work well with the algorithm. You can see from the before and after images below that the output image often bears very little resemblance to the source image he starts with.

starting point (thinking outside the ocasahedron)

starting point (thinking outside the ocasahedron)

thinking outside the icosahedron

thinking outside the icosahedron

Kluge has built an assembly line of code variations he likes into the software tool CodePen so that he can rapidly try out different configurations on his source images. He claims to have “about 100 saved combinations.” He will typically try an image across 20 or so of his CodePen variations, searching for the best possible output and making further changes to the code when necessary.

I love Kluge’s description of his organic coding process for creating art. It flies in the face of the popular misconception that programming art is somehow a linear process, when in actuality, it is almost always circuitous.

When I asked Kluge if he is still surprised by the outputs he is getting, he replied:

Oh, yeah, I wouldn’t have the motivation to do this at all if I wasn’t surprised every time. It’s a pleasure every time I get close to something I like. I don’t have a good drawing hand. This is something I use to be my drawing hand. Sometimes the lines and shapes can be really beautiful, and I don’t think I could calculate that. It’s impossible for me to have these things in my head before I start. I would like to think this is true for all generative artists. It is a very playful process.

Espen Kludge, any individual - 2019

Espen Kludge, any individual - 2019

Because Kluge’s portraits feel so three dimensional to me, I asked him if he had played with adding a Z dimension to the pixels. He shared that he had considered importing them into Houdini (a 3D software package), but wanted to keep them as pure code since that is how they were born. He added that he may explore doing some work with them in 3D using Python.

I was also curious if he had explored making them interactive, animated, or motion based. Kluge explained that he fears that adding animation to the portraits would demystify them for him and could make it something he feels it shouldn’t be.

Espen Kluge, ladyfriend - 2019

Espen Kluge, ladyfriend - 2019

The look of the portraits varies broadly across the series based largely on the quantity and density of the lines. Some of the more dense portraits look almost like photographs while other more sparse portraits look more geometric and abstract.

Not that it drives his decisions or his process, but Kluge did share that the ones that get the most likes on social media tend to be somewhere in the middle.

Espen Kluge, more extroverted than you - 2019

Espen Kluge, more extroverted than you - 2019

Personally I think Kluge’s choice to share works that range in line density is itself important. The sparse ones help me appreciate the dense ones more and vice versa. It is an exercise in contrast, and the work benefits from the display of the full spectrum.

In fact, I think the shift toward and away from abstraction through variation in line density is a big part of what makes Kluge’s portraits feel so fresh and emotive, especially when compared to traditional generative art which can often feel cold, geometric, and repetitive.

Espen Kluge, 100 atoms in my favor - 2019

Espen Kluge, 100 atoms in my favor - 2019

An artist’s artist, Kluge is candid and open about his process, one which is beautifully honest and imperfect. When I asked him about the similarities between programming with Java and film scoring, he shared:

Both are programming languages, Java script and musical notation. But I have never been very good or very intuitive with code or notation - I have always been very chaotic with both programming and notation. I took longer than most students to get there with music notation. But sometimes you take the longer road and you get your own very unique experience with things, which I think results in something very cool and creative.

As someone who also spent their life breaking things and doing things the “wrong” way, I couldn’t agree with Kluge more. I also agree that the uniqueness of his work is likely a direct result of his struggles and unique journey.

Kluge, his music, and his art are truly fantastic treasures. It is artists like Espen Kluge who keep me excited about discovering new work and sharing it through my writing on Artnome. Additionally, in my new capacity as senior curator for Kate Vass Galerie, I have the added pleasure of making introductions for artists like Kluge to help further raise his profile and identify a network of collectors and appreciators for his work. Thanks to Espen and Kate, the work I have curated for this article is also now available to Artnome readers and collectors of digital art. You can find both digital and printed works at the Kate Vass website.