Caffe学习特征可视化的一点代码问题.

这几天看官方提供基于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))

:))

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值