Visualizing individual channels

Patterns, patterns and patterns

If you want to follow along on google colab, check out this notebookarrow-up-right

This section of torch_dreams was highly inspired by Feature visualization by Olah, et al.arrow-up-right We basically optimize the input image to maximize activations of a certain channel of a layer in the neural network.

First, let's import the good stuff and initiate the torch_dreams.dreamer

The next step now would be to define a custom_func that would enable use to selectively optimize a single channel. We could've made a simpler function, but this would be useful when we'll be running the optimizations on a lot of channels.

Now in order to optimize the 7th channel of the first layer mentioned in layers_to_use we define the custom loss as:

Let us now see how it worked out:

Now let us scale this up to visualize a lot more channels:

Let's make a figure out of all the images we generated now. If things went well, you'll end up with the banner seen on top of this page.

Last updated