load Net
caffe.set_mode_cpu()
model_def = 'deploy.prototxt'
model_weights ='bvlc.caffemodel'
net = caffe.Net(model_def, # defines the structure of the model
model_weights, # contains the trained weights
caffe.TEST) # use test mode
net.blobs
Each layer
for layer_name,blob in net.blobs.items():
print(layer_name+"\t"+str(blob.data.shape))
data (5, 3, 227, 227)
conv1 (5, 96, 55, 55)
pool1 (5, 96, 27, 27)
norm1 (5, 96, 27, 27)
conv2 (5, 256, 27, 27)
pool2 (5, 256, 13, 13)
norm2 (5, 256, 13, 13)
conv3 (5, 384, 13, 13)
conv4 (5, 384, 13, 13)
conv5 (5, 256, 13, 13)
pool5 (5, 256, 6, 6)
fc6 (5, 4096)
fc7 (5, 4096)
fc8 (5, 1000)
prob (5, 1000)
net.params
for layer_name,param in net.params.items():
print(layer_name,'\t',param[0].data.shape,param[1].data.shape)
conv1 (96, 3, 11, 11) (96,)
conv2 (256, 48, 5, 5) (256,)
conv3 (384, 256, 3, 3) (384,)
conv4 (384, 192, 3, 3) (384,)
conv5 (256, 192, 3, 3) (256,)
fc6 (4096, 9216) (4096,)
fc7 (4096, 4096) (4096,)
fc8 (1000, 4096) (1000,)