Prague travel pictures and deep dreaming

Last updated on May 13th, 2016


Here is a combined short summary on my travels to the city of Prague in the Czech Republic along with corresponding images created using Google’s DeepDreams.

What is this DeepDreams you speak of?

Basically, DeepDream is a deep neural network that was trained to recognize objects from millions of images. A deep neural network is composed of a stack of layers. Basically, these layers learn image filters that when applied to an image classify the image (e.g., is this an image of a cat or a dog?).

You give DeepDream an image and specify a layer in the neural network. The original image is then slightly perturbed to create a modified image that causes the specified layer in the neural network to be more activated.

Early layers in the neural network are sensitive to low level concepts like the edges and textures in the image. So if you specify an early layer, your image will be modified to have edges and textures that most activate the early selected layer.

Example CNN. Image goes as input. Early layers (purple) are sensitive to things like edges and textures. Later layers (red) are sensitive to higher level concepts like faces.
Example CNN. Image goes as input. Early layers (purple) are sensitive to things like edges and textures. Later layers (red) are sensitive to higher level concepts like faces.

Later (or deeper) layers in the neural network are activated when they see higher level concepts such as faces. So any areas in the original image that slightly look like a face, will be modified to look more like a face.

Okay, but now you might ask, but what about Prague? How was your trip? Did you like the city?

Yeah it was nice! Thanks for asking. Did you want to see some pictures? Here’s one of an old building.

Original image of some building in Prague... can't remember what/if the significance of this picture was.
Original image of some building in Prague… can’t remember what the significance of this picture was.

Let’s try some deep dreaming on this. We’ll use the neural network known as VGG16 (it’s a famous neural network that performs very well on competitions). We’ll start by telling VGG16 (the neural network) to modify this image so that one of it’s middle layers becomes more activated. Specifically, we will activate layer conv3_1 from VGG16 (if you don’t know what conv3_1 means, that’s okay – it’s just a technical detail specifying what layer to use). This gives us this:

Same Prague building but using DeepDreams with VGG16 conv3_1
Same Prague building but using DeepDreams with VGG16 conv3_1

Now if we activate a deeper layer, conv5_2, we get this crazy looking image,

prauge_architecture_conv5-2_oct-6_n-32

Note how the above image actually starts creating a new scene. It changed an ally on the right side to be another door. The windows are all of a different architecture. It started adding plants at the top floor of the main building. The top of the building looks more like a ship now. It’s starting to hallucinate new buildings on the skyline. And the sky! What is happening in the sky?!

Okay enough of this picture. Do you want to see one of the famous Prague clock?

This is the original image of a famous clock in Prague.
This is the original image of a famous clock in Prague.

Our tour guide was very excited to show us this clock.

Selecting layer conv4_2, we see that this layer responds well to circular things…

The famous Prague clock using DeepDreams VGG16 conv4_2
The famous Prague clock using DeepDreams VGG16 conv4_2

While going into the deeper layers conv5_1, we capture some disturbing looking animals,

Prague clock using VGG16 conv5_1. Seems to respond well to animal faces... ugh! What's that hideous white dog thing?
Prague clock using VGG16 conv5_1. Seems to respond well to animal faces… Ugh! What’s that hideous white dog thing?

We can create some crazy looking images again using conv5_2,

prague_clock_conv5-2_niter-32_oct-6
Prague clock using DeepDreams VGG16 conv5_2

How about the inside of a cathedral? You ever seen one before? I hadn’t.

inside_prague_cathedral_454
Interior of a cathedral in Prague

Deep dreaming it…

inside_prauge_cathedral_vgg16-conv3_2
Interior of a cathedral in Prague with VGG16 conv3_2

Strangely, an omnipotent looking reptilian eye comes out of the cathedral’s ceiling using layer conv5_2,

inside_prague_cathedra_vgg16-conv5-2
Interior of a cathedral in Prague with VGG16 conv5_2

Do you have any pictures of you in front of Prague castle? You bet I do!

The original of me in front of Prague Castle
The original of me in front of Prague Castle

Not sure how to describe what this layer is activated by…

me_prague_castle_conv4-1
In front of Prague Castle with VGG16 conv4_1

Finally, here’s something you might see if you looked in a mirror while you are dreaming,

The nightmare of me in front of Prague Castle. VGG16 conv5_2
The nightmare of me in front of Prague Castle. VGG16 conv5_2

I’m struck that the rest of the image is not very distorted. The distortion here is focused mainly on my face.

That’s enough travel pictures and dreaming for me today. Oh! And if you were wondering why I was in Prague, you can read about that here.