Hyeonjin Jang
Hyeonjin Jang

Reputation: 257

How can visualize tensorflow convolution filters?

Example

In many documents, there are images about each filter like "Example". I want to visual my convolution filters like "Example" image, but I don't know how can visualize it.

How can I visualize my convolution filters?

Upvotes: 17

Views: 20058

Answers (3)

khaled Fouda
khaled Fouda

Reputation: 359

No those aren't the filters. You can read this paper which describes the procedures from converting the layer L's filters into these images. In short words what it does is taking some filter, and uses a technique similar but not the same as back-propagation to convert the filter into an image.

Upvotes: 5

Salvador Dali
Salvador Dali

Reputation: 222511

The result of the 2d convolution is a tensor [batch, in_height, in_width, in_channels]. The image can be represented as a matrix [in_height, in_width, in_channels]. So all you need to do is to grab a few images from your batch, and add them to your summary with tf.summary.image().

For a tutorial how to do this, take a look at this answer.

Upvotes: 1

Sergii Gryshkevych
Sergii Gryshkevych

Reputation: 4159

Think about each convolutional filter as x by x matrix, where x is the size of the filter. So your task is to put those matrices on a plot grid. I have made an example how to plot convolutional filters and output of convolutional layers using MNIST dataset, see conviz repository on github. Hope it helps you.

Upvotes: 7

Related Questions