caffe deploy


原文链接: caffe deploy

1)将原网络文件去掉(以下部分)

layer {
name: "data"
type: "Data"
top: "data"
top: "label"
include {

phase: TRAIN

}
transform_param {

crop_size: 227
mean_value: 104
mean_value: 117
mean_value: 123

}
data_param {

source: "D:/Master/master_graduate/dataset/test/squeezt-test1/train_LEVELDB"
batch_size: 32
backend: LEVELDB

}
}
layer {
name: "data"
type: "Data"
top: "data"
top: "label"
include {

phase: TEST

}
transform_param {

crop_size: 227
mean_value: 104
mean_value: 117
mean_value: 123

}
data_param {

source: "D:/Master/master_graduate/dataset/test/squeezt-test1/test_LEVELDB"
batch_size: 25 
backend: LEVELDB

}
}
(2)将最后的accuracy和loss层去掉,如下部分

layer {
name: "loss"
type: "SoftmaxWithLoss"
bottom: "pool10"
bottom: "label"
top: "loss"
include {

phase: TRAIN

}
}
layer {
name: "accuracy"
type: "Accuracy"
bottom: "pool10"
bottom: "label"
top: "accuracy"
include {

phase: TEST

}
}
layer {
name: "accuracy_top5"
type: "Accuracy"
bottom: "pool10"
bottom: "label"
top: "accuracy_top5"
include {

phase: TEST

}
accuracy_param {

top_k: 5

}
}
(3)在最前面加如下部分:

name:"SqueezeNet"
input:"data"
input_shape{
dim:1
dim:1
dim:28
dim:28
}
(4)在最下面加如下部分:

layer {
  name: "prob"
  type: "SoftmaxWithLoss"
  bottom: "pool10"
  top: "prob"
  }
  • layer {
  • name: "softmax"
  • type: "Softmax"
  • bottom: "output"
  • top: "softmax"
  • include { stage: "deploy" }
    +}


其中,bottom是上一层的输出,top为“prob”。

OK,至此修改完毕。
————————————————
版权声明:本文为CSDN博主「kele_imon」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/kele_imon/article/details/93873377

`