I have this network loaded into net net = caffe.Net('mobilenet_v2_deploy.prototxt', caffe.TEST)
. Then, to save the weights of this layer I can do net.save('mymodel.caffemodel')
But, how could I save only a particular layer's weights? I know that to visualize conv1
layer's weights I can do (1) net.params['conv1'][0].data
but, this just outputs on the command line some text, it does not save a caffemodel-like file.
(1) Outputs something such as: (does not save a file)
array([[[[-0.1010774 ]],
[[-0.03301976]],
[[ 0.19851202]],
...,}
Example of the prototxt file
"name: "MOBILENET_V2"
# transform_param {
# scale: 0.017
# mirror: false
# crop_size: 224
# mean_value: [103.94,116.78,123.68]
# }
input: "data"
input_dim: 1
input_dim: 3
input_dim: 224
input_dim: 224
layer {
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
param {
lr_mult: 1
decay_mult: 1
}
convolution_param {
num_output: 32
bias_term: false
pad: 1
kernel_size: 3
stride: 2
weight_filler {
type: "msra"
}
}
}