这几天看官方提供基于iPython notebook的学习手册,提供了一些基于Python代码的调用实例.
这一篇是关于学习特征可视化的.地址如下:
http://nbviewer.ipython.org/github/BVLC/caffe/blob/master/examples/filter_visualization.ipynb
其中有几个地方代码操作有点烦人.,原文描述如下
The second layer filters, conv2
There are 256 filters, each of which has dimension 5 x 5 x 48. We show only the first 48 filters, with each channel shown separately, so that each filter is a row.
In [10]:
filters = net.params['conv2'][0].data
vis_square(filters[:48].reshape(48**2, 5, 5))
只显示了48个卷积核的参数信息.怎么才能显示全部的呢, 调用 filters.size.得到307200这么一个数值,这个是256*48*5*5的值,就是 有256个卷积核,每个是5*5大小,有48组,刚好对应要求. 于是这么改一下就能看到全部:
vis_square(filters[:256].reshape(48*256, 5, 5))
:))