Visualizing Neural Network Layer Activation (Tensorflow Tutorial)

Arthur Juliani
Apr 6, 2016 · 1 min read
Image for post
Image for post

I am back with another deep learning tutorial. Last time I showed how to visualize the representation a network learns of a dataset in a 2D or 3D space using t-SNE. In this tutorial I show how to easily visualize activation of each convolutional network layer in a 2D grid. The intuition behind this is simple: once you have trained a neural network, and it performs well on the task, you as the data scientist want to understand what exactly the network is doing when given any specific input. Or, in the case of visual tasks, what the network is seeing in each image allows it to perform the task so well. This technique can be used to determine what kinds of features a convolutional network learns at each layer of the network. The technique I describe here is taken from this paper by Yosinski and colleagues, but is adapted to Tensorflow.

Like my other tutorials, all code is written in Python, and we use Tensorflow to build and visualize the model. Hopefully it is helpful!

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store