将train_val.prototxt 转换成deploy.prototxt

来源:互联网 发布:网络电视不清晰怎么办 编辑:程序博客网 时间:2024/05/16 18:38

1.删除输入数据(如:type:data...inckude{phase: TRAIN}),然后添加一个数据维度描述。

input: "data" input_dim: 1 input_dim: 3 input_dim: 224 input_dim: 224force_backward: true

2.移除最后的“loss” 和“accuracy” 层,加入“prob”层。

layers {  name: "prob"  type: SOFTMAX  bottom: "fc8"  top: "prob"}

如果train_val文件中还有其他的预处理层,就稍微复杂点。如下,在'data'层,在‘data’层和‘conv1’层(with bottom:”data” / top:”conv1″). 插入一个层来计算输入数据的均值。

layer {name: “mean”type: “Convolution”<strong>bottom: “data”top: “data”</strong>param {lr_mult: 0decay_mult: 0}…}

在deploy.prototxt文件中,“mean” 层必须保留,只是容器改变,相应的‘conv1’也要改变 ( bottom:”mean”/ top:”conv1″ )

layer {name: “mean”type: “Convolution”<strong>bottom: “data”top: “mean“</strong>param {lr_mult: 0decay_mult: 0}…}


1 1