python中的神经网络接收场可视化 - python

我有一个包含300个要可视化的隐藏层的神经网络(全部)。

在python中做的最好方法是什么?

我已经使用subplot进行了尝试,但是接受域彼此之间距离太远,我几乎看不到它们。

编辑:

所以在输出上我只有28 * 28
我想可视化的权重(图像)。

这是我当前的代码:

# Plot receptive fields
f, axarr = pyplot.subplots(30, 10)


for weight_numb in xrange(300):
    currnt_sub_handler = axarr[weight_numb / 10, weight_numb % 10]
    weight = main.model_params[:, weight_numb].reshape(28, 28)
    currnt_sub_handler.axis('off')
    currnt_sub_handler.imshow(weight)

pyplot.show()

因此,改写这个问题:

如何使图像彼此尽可能靠近?
我必须使用什么颜色图?

python大神给出的解决方案

为什么不制作一个大图像(矩阵),即(10x28)x(30x28),然后将每个28x28滤镜放入该矩阵的一部分,然后立即绘制整个图像。有点像这样:

# assuming your filters are stored in a list called all_filters
all_filter_image = zeros(10*28, 30*28)
for filter_num in range(300):
    # calculate start_x and start_y based on the size of your "large filter" 
    # and the filter index
    all_filter_image[start_x:start_x + 28, start_y: start_y + 28] = all_filters[filter_num]

这样,您不必处理子图。