正如caffe的
examples
所提,CNN model并不是一个黑盒,caffe提供了工具来查看cnn各层的所有输出
1.查看CNN各层的activations值的结构(即每一层的输出)
代码如下:
# 显示每一层
for layer_name, blob in net.blobs.iteritems():
print layer_name + '\t' + str(blob.data.shape)
第i次循环体内部
- layer_name提取的是net的第i层的名称
- blob提取的是net的第i层的输出数据(4d)
结果为:
data
(50, 3, 227, 227) 网络的输入,batch_number = 50,图像为227*227*3的RGB图像
conv1
(50, 96, 55, 55) 第一个conv层的输出图像大小为55*55,feature maps个数为96
pool1
(50, 96, 27, 27) 第一个pool层的图像尺寸为27*27,feature map个数为96
norm1
(50, 96, 27, 27) 第一个norm层的图像尺寸为27*27,feature map个数为96
conv2
(50, 256, 27, 27) 第二个conv层的图像尺寸为27*27,feature map个数为256
pool2
(50, 256, 13, 13) 第二个pool层的图像尺寸为13*13,feature map个数为256
norm2
(50, 256, 13, 13) 第二个norm层的图像尺寸为13*13,feature map个数为256
conv3
(50, 384, 13, 13) 第三个conv层的图像尺寸为13*13,feature map个数为384
conv4
(50, 384, 13, 13) 第四个conv层的图像尺寸为13*13,feature map个数为384
conv5
(50, 256, 13, 13) 第五个conv层的图像尺寸为13*13,feature map个数为256
pool5
(50, 256, 6, 6) 第五个pool层的图像尺寸为13*13,feature map个数为256
fc6
(50, 4096)
第六个fc层的图像尺寸为4096
fc7
(50, 4096)
第七个fc层的图像尺寸为4096
fc8
(50, 1000)
第八个fc层的图像尺寸为1000
prob
(50, 1000)
probablies层的尺寸为1000