Suddenly, a flash of light…

One of my favorite things on the Internet is a subreddit called Accidental Renaissance. There, one can find all sorts of photo imagery depicting scenes you would find on a Renaissance or Baroque painting. The aesthetics are quite astonishing including matching colors and composition. Which got me thinking: What if I could recreate these images in the style of a classical painter? Wouldn’t that be quite nice to look at? So, there I was, thinking about something I heard once about arbitrary neural artistic stylization networks and how they can recreate images in any style. Next up: My findings of a day full of artistic wonder and rants about data types.

The Creation of Adam

Let’s start with the basics. In 2017, Ghiasi et al. published a paper on how deep neural networks (i.e. CNNs) can recreate artistic styles over every image by splitting every image into a content and a style component. The inner workings are quite complex and would make this post too long. The main point of the network is not only the capability to split an image into these components, but also to combine content from one image and artistic style from another. There are many blog posts about this if you want to catch up on this topic. Here, we want to focus on the results for a particular type of image (found on r/AccidentalRenaissance) and its classical counterparts.

The Anatomy Lesson of Dr. Nicolaes Tulp

First things first: AccidentalRenaissance does not limit itself to the Renaissance but also includes images in the style of the Baroque era or the like. I will go through some of the images and present their intellectual ancestors. To give you an example, here is a photo of world leaders at the 2018 G7 summit.

G7

And isn’t it a beauty? All the compositional aspects are exactly right: the forward-leaning of Angela Merkel, the defensive childish pose of Donald Trump, and the disappointed stares of the surrounding people. The image color palette is mainly pastel blue and strong black/blue.

The first thing to find is a matching image from the old classics. In the end, I went with The Anatomy Lesson of Dr. Nicolaes Tulp by Rembrandt (van Rijn).

Anatomy

Note how different aspects of the photo are also present in the painting. This is one of the key aspects to get at least passable results from the neural network, especially if the art style is very clean.

Now the only thing left to do is to put everything into the code example provided by the authors of the paper where the photo delivers the content and the painting the style. And Voilà (Of course, only if you have checked that your image data types are correct and you don’t compare 0-255 RGB to 0-1 RGB values).

Leaders

Two things. First, the resolution of the result is around 256 x 256 px because the original neural network was trained on images with this size. Secondly, the network still has problems with details like faces. Apart from that, the look and feel of the 100%(!) generated image is quite convincing.

The Night Watch

I know what you are thinking: Show us more! So, I hear ya. Here are all the images containing the piece of art, the photo, and the merged result.

The Milkmaid

Doesn’t look accidentally like Renaissance paintings anymore, doesn’t it? I had fun toying around with numerous images and art styles. I hope, you enjoyed it as well. And therefore back to Bob Ross, Painter of mistakes.

Other sources and libraries include pillow and numpy.