还是上面的网络,我们输出各个层的权值看看
len(model.layers[0].weights)=2,
weights[0],
<tf.Variable 'conv2d/kernel:0' shape=(3, 3, 1, 32) dtype=float32
weights[1]
<tf.Variable 'conv2d/bias:0' shape=(32,) dtype=float32,
要输出第一个卷积的值:
model.layers[0].weights[0][:,:,:,0]
model.layers[0].weights[0][:,:,:,0].shape=TensorShape([3, 3, 1])
输出第一个层的32个卷积图

我们来计算一下这个网络的参数
参数个数和输入图像的大小直接关系。和卷积数,channel数有关。
input shape=28*28*1
Model: "sequential" _________________________________________________________________ Layer (type) Output Shape Param # ================================================================= conv2d (Conv2D) (None, 26, 26, 32) 320 _________________________________________________________________ max_pooling2d (MaxPooling2D) (None, 13, 13, 32) 0 ____

本文探讨了一种网络结构,分析了其卷积层的权重分布,展示了如何输出各层权重并理解参数数量。通过实例,解释了输入图像经过卷积后的变化,以及如何可视化这些特征。此外,还讨论了网络参数与图像大小、卷积核数量的关系,并通过代码展示了如何提取和显示卷积特征。
最低0.47元/天 解锁文章
4万+

被折叠的 条评论
为什么被折叠?



