【发布时间】:2019-12-22 07:51:48
【问题描述】:
我已将此网络加载到网络 net = caffe.Net('mobilenet_v2_deploy.prototxt', caffe.TEST)。然后,为了保存这一层的权重,我可以这样做net.save('mymodel.caffemodel') 但是,我怎么能保存只特定层的权重 ?我知道要可视化 conv1 层的权重,我可以做 (1) net.params['conv1'][0].data 但是,这只是在命令行上输出一些文本,它不会保存类似 caffemodel 的文件。
(1) 输出诸如:(不保存文件)
array([[[[-0.1010774 ]],
[[-0.03301976]],
[[ 0.19851202]],
...,}
prototxt 文件示例
"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"
}
}
}
【问题讨论】:
标签: caffe