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?
A convolution is the simple application of a filter to an input that results in an activation. Repeated application of the same filter to an input results in a map of activations called a feature map, indicating the locations and strength of a detected feature in an input, such as an image.
In a CNN, the values for the various filters in each convolutional layer is obtained by training on a particular training set. At the end of the training, you would have a unique set of filter values that are used for detecting specific features in the dataset.
Learning filter kernels At each position of our sliding window, a mathematical operation is performed, the so called convolution. During convolution, each pixel value in our window is multiplied with the value at the respective position in the filter matrix and the sum of all multiplications is calculated.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With