python神经网络可视化,python中的神经网络感受野可视化

这是我想出的解决方案。谢谢@mprat的帮助。在

我发现spectralcolormap最适合这种任务,而且

我还添加了您可以指定的边框。在from matplotlib import pyplot

import numpy as np

border = 2

images_amount = 300

row_amount = 10

col_amount = 30

image_height = 28

image_width = 28

all_filter_image = np.zeros((row_amount*image_height + border*row_amount,

col_amount*image_width + border*col_amount))

for filter_num in range(images_amount):

start_row = image_height*(filter_num / col_amount) +\

(filter_num / col_amount + 1)*border

end_row = start_row + image_height

start_col = image_width*(filter_num % col_amount) +\

(filter_num % col_amount + 1)*border

end_col = start_col + image_width

all_filter_image[start_row:end_row, start_col:end_col] = \

all_filters[filter_num]

print start_row, end_row, start_col, end_col

pyplot.imshow(all_filter_image)

pyplot.axis('off')

pyplot.set_cmap('spectral')

pyplot.colorbar()

pyplot.savefig('repflds1.png')

以下是一些用法示例:

不太训练有素的网络:

b89ead1d454ffeb61667d03a934e7d89.png

训练有素的网络:

2bc59633c25798f60e83007290f0b0c5.png

正如你所看到的,边界使得区分一个过滤器(权重)和另一个过滤器变得非常容易。在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值