Paper commentary
Understanding Neural Networks Through Deep Visualization
Two open tools reveal what each layer of a convnet computes
- Problem Convnet intermediate layers are hard to read, and gradient-based images of preferred inputs often look like adversarial artifacts, so their computations stay opaque to inspection.
- Method The authors build a live viewer that plots each layer's channels for a pre-trained convnet, and run regularized gradient ascent in image space.
- Results A random search over 300 hyperparameter combinations yielded four complementary regularization settings for the optimized visualizations.
Why visualizing convnet units is hard
Deep convolutional networks now approach or exceed human performance on several recognition tasks, yet the computations performed at their intermediate layers remain difficult to read. Even the AlexNet-style network used here has about 60 million trained parameters, so no reader can make sense of the model by inspecting its weights.
Gradient-based methods that search for inputs which strongly activate a unit need only the trained network, but the images they return tend to contain extreme pixel values, high frequency patterns and repeated motifs that lack global structure. Adversarial studies help explain this: small changes can flip a classifier's decision, unrecognizable images can be found without gradients, and the locally linear behaviour of networks accounts for many non-natural images with extreme activations.
The question is therefore whether a suitable regularization of the optimization can produce images that still reveal what a unit responds to. A second question concerns the layers themselves: whether watching all channels respond to a live input gives intuitions that static inspection does not.
Watching live activations layer by layer
The first tool runs a pre-trained convnet on a live webcam stream or on user-supplied images and plots the activations of each layer. Convolution keeps the spatial layout of the input, so each channel of a convolutional layer is itself a two-dimensional map, while the unit order of a fully connected layer carries no spatial meaning.
For conv5, the layer is 256×13×13, so the tool draws 256 separate 13×13 grayscale maps, placed in a 16×16 grid in row-major order. Each map keeps the spatial layout of the input, and the tool can show pooling and normalization layers as well, so every signal that flows through the network can be seen. Because the network has a single path from input to output, each layer is a bottleneck that all information must pass through, and each layer is small enough to fit on a screen.
Using the tool, the authors saw detectors for text, flowers, fruit and faces on conv4 and conv5, which suggests that representations on these layers are local rather than fully distributed. Single photos loaded from files were classified correctly with high softmax confidence, whereas webcam frames with no ImageNet class present produced a noisy probability vector that shifted with tiny input changes.
The fully connected layers fc6 and fc7 showed a similar sensitivity to small input changes, while the lower layers were more stable.
Gradient ascent with a regularization operator
Plain gradient ascent starts from an input, measures the activation a_i(x) of a unit i, and steps the input along the gradient of that activation to raise it. The authors state the regularized version as a maximization of a_i(x) minus a penalty R_θ(x), and then replace the penalty by an operator r_θ that maps the input to a more regularized version of itself, which they note is more expressive than a penalty of this kind.
In each step the input is moved along the gradient of a_i with step size η and then passed through the operator, giving \\( x \\leftarrow r_\\theta\\left(x + \\eta \\, \\partial a_i / \\partial x\\right) \\). Gradient steps and operator steps therefore alternate, so the operator can be any transformation that favors realistic images and need not be the gradient of a penalty term.
Inputs are color images of 227 by 227 pixels, and the network subtracts the per-pixel mean of ImageNet examples, so the input is zero-centered. Starting from different random initial images produces a set of optimized images whose spread indicates the invariances the unit has learned.
The four regularization operators
The authors note that such single-pixel extremes rarely occur in natural images and do not help the visualization.
The Gaussian blur operator applies GaussianBlur(x, θ_b width) to penalize high frequency content, which gradient ascent tends to produce. Blurring every θ_b every steps rather than every step cuts computation, and blurring several times with a small kernel is taken to be similar to one blur with a larger kernel. The authors relate this to total variation, a penalty with a similar effect that Mahendran and Vedaldi used when reconstructing images from layer codes.
Clipping by small norm computes the norm of each pixel over the red, green and blue channels and sets pixels below the θ_n pct percentile of all pixel norms to zero. This lets regions that the unit does not need stay exactly zero, so only the main object carries signal.
Clipping by small contribution estimates each pixel's contribution as the absolute value of the sum over the three channels of x times the gradient of a_i, which is a linear approximation of how much the activation changes when the pixel is removed. The operator sets pixels whose contribution falls below the θ_c pct percentile to zero.
Choosing a combination of regularizers
Each operator helps on its own, and the authors' single-operator sweeps show the effect of each hyperparameter, but combinations of operators were found to work better than any single operator. To pick a joint set, the authors ran a random hyperparameter search over 300 combinations and kept four that complement each other.
The four settings produce different styles: some favor high frequency detail and others low frequency, and some give dense pixels while others give sparse outlines. The Gorilla output unit was used to compare them, and the lower-left setting was judged the best single set, although using all four gives more insight. The third row of the hyperparameter table produced most visualizations for the other classes, and all of the layer visualizations in the main figure.
With the chosen settings, the optimized images for all 1000 ImageNet output classes are available online, and the visualizations for each layer were produced with four random gradient descent runs per channel. The images show edges, corners, wheels, eyes and faces at different scales, and their complexity and variety rise with layer number, with the largest jump between Layer 5 and Layer 6.
In nearly every case the authors could guess the class a neuron represented by viewing its set of optimized images.
Limitations
The regularized images are far from photo-realistic. Regularization that is too strong can break the optimization, as L2 decay does at high values, and strong small-norm or small-contribution clipping can make the images less interpretable.
The evaluation is qualitative: the class of a neuron is guessed by viewing its images, and the regularization settings were selected by visual judgement. The Figure 5 images were hand picked to show the variety of features, so they are not a random sample of channels.
All of the experiments use one pre-trained network, which is nearly identical to AlexNet but with local response normalization layers after pooling layers. The live webcam observations describe a single trained model and a fixed set of classes, and the training set's 1000 classes do not cover most household objects.
What the results suggest about priors and transfer
Earlier work took the failure to produce realistic images from a prior and a class posterior as evidence that this generative approach is hopeless. The authors suggest instead that the priors used before may have been too weak, but they do not test this possibility here.
The beetle images with structure spanning over 100 pixels suggest that the discriminative parameters carry generative structure, for example the spots of a jaguar together with its four legs. Dai et al. report results in the direction of transferring discriminatively trained parameters to generative models.
Because later layers are local, the authors suggest that transfer learning from conv4 or conv5 could benefit from a bias toward sparse connectivity, since only a few features from those layers may need to be combined. Whether the features are local to one channel or spread over several remains an open question, and the authors point to Zhou et al.
for work in that direction.
Paper info
- Authors
- Jason Yosinski, Jeff Clune, Anh Nguyen, Thomas Fuchs, Hod Lipson
- Venue
- arXiv · Preprint
- First published
- 2015-6-22
- Added
- 2026-11-12
- Updated
- 2015-6-22
- Version
- v1
- arXiv
- 1506.06579
- Category
- cs.CV · cs.LG · cs.NE
- Original paper terms
- Check in the original ↗
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Jason Yosinski, Jeff Clune, Anh Nguyen, Thomas Fuchs, Hod Lipson (2015). Understanding Neural Networks Through Deep Visualization. arXiv:1506.06579v1. https://arxiv.org/abs/1506.06579v1
BibTeX
@misc{yosinski2015understanding,
title = {{Understanding Neural Networks Through Deep Visualization}},
author = {Jason Yosinski and Jeff Clune and Anh Nguyen and Thomas Fuchs and Hod Lipson},
year = {2015},
eprint = {1506.06579},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1506.06579v1}
}