参考:

http://blog.csdn.net/cham_3/article/details/52682479

以caffe工程自带的mnist数据集,lenet网络为例:

将lenet_train_test.prototxt文件进行一些修改即可得到lenet.prototxt文件

头部:

去除训练用的输入数据层,

layer {
name: "mnist"
type: "Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
mean_file: "mean.binaryproto"
scale: 0.00390625
}
data_param {
source: "examples/mnist/mnist_train_lmdb"
batch_size: 64
backend: LMDB
}
}
layer {
name: "mnist"
type: "Data"
top: "data"
top: "label"
include {
phase: TEST
}
transform_param {
mean_file: "mean.binaryproto"
scale: 0.00390625
}
data_param {
source: "examples/mnist/mnist_test_lmdb"
batch_size: 100
backend: LMDB
}
}

添加数据,

layer {
name: "data"
type: "Input"
top: "data"
input_param { shape: { dim: 64 dim: 1 dim: 28 dim: 28 } }
}

中间的部分:
conv1-pool1-conv2-pool2-ip1-relu1-ip2中间的这些层是相同的

尾部:

lenet_train_test.prototxt去除,

layer {
name: "accuracy"
type: "Accuracy"
bottom: "ip2"
bottom: "label"
top: "accuracy"
include {
phase: TEST
}
}
layer {
name: "loss"
type: "SoftmaxWithLoss"
bottom: "ip2"
bottom: "label"
top: "loss"
}

添加,

layer {
name: "prob"
type: "Softmax"
bottom: "ip2"
top: "prob"
}

即可得到lenet.prototxt文件

以siftflow-fcn32s为例,说明:

打开trainval.prototxt文件,删除,

layer {
name: "data"
type: "Python"
top: "data"
top: "sem"
top: "geo"
python_param {
module: "siftflow_layers"
layer: "SIFTFlowSegDataLayer"
param_str: "{\'siftflow_dir\': \'../data/sift-flow\', \'seed\': 1337, \'split\': \'trainval\'}"
}
}

添加,

layer {
name: "input"
type: "Input"
top: "data"
input_param {
# These dimensions are purely for sake of example;
# see infer.py for how to reshape the net to the given input size.
shape { dim: 1 dim: 3 dim: 256 dim: 256 }
}
}

中间的网络层都是相同的,

尾部,删除两个网络的loss层,

layer {
name: "loss"
type: "SoftmaxWithLoss"
bottom: "score_sem"
bottom: "sem"
top: "loss"
loss_param {
ignore_label: 255
normalize: false
}
}
layer {
name: "loss_geo"
type: "SoftmaxWithLoss"
bottom: "score_geo"
bottom: "geo"
top: "loss_geo"
loss_param {
ignore_label: 255
normalize: false
}
}

即可得到deploy.prototxt文件  

  

  

caffe生成deploy.prototxt文件的更多相关文章

  1. 根据 train_test.prototxt文件生成 deploy.prototxt文件

    本文参考博文 (1)介绍 *_train_test.prototxt文件与 *_deploy.prototxt文件的不同:http://blog.csdn.net/sunshine_in_moon/a ...

  2. 浅谈caffe中train_val.prototxt和deploy.prototxt文件的区别

    本文以CaffeNet为例: 1. train_val.prototxt  首先,train_val.prototxt文件是网络配置文件.该文件是在训练的时候用的. 2.deploy.prototxt ...

  3. train_val.prototxt文件和deploy.prototxt文件开头的区别

    1.开头不同 对train_val.prototxt文件来说,开头部分定义训练和测试的网络及参数 对deploy.prototxt文件来说,开头部分定义实际运用场景的配置文件,其参数不定义数据来源,仅 ...

  4. Caffe中deploy.prototxt 和 train_val.prototxt 区别

    之前用deploy.prototxt 还原train_val.prototxt过程中,遇到了坑,所以打算总结一下 本人以熟悉的LeNet网络结构为例子 不同点主要在一前一后,相同点都在中间 train ...

  5. caffe中根据 *_train_test.prototxt文件生成 *_deploy.prototxt文件 (转载)

    见博客:http://blog.csdn.net/u010417185/article/details/52137825

  6. caffe之solver.prototxt文件参数设置

    caffe solver参数意义与设置 batchsize:每迭代一次,网络训练图片的数量,例如:如果你的batchsize=256,则你的网络每迭代一次,训练256张图片:则,如果你的总图片张数为1 ...

  7. caffe中通过prototxt文件查看神经网络模型结构的方法

    在修改propotxt之前我们可以对之前的网络结构进行一个直观的认识: 可以使用http://ethereon.github.io/netscope/#/editor 这个网址. 将propotxt文 ...

  8. 4'.deploy.prototxt

    1: 神经网络中,我们通过最小化神经网络来训练网络,所以在训练时最后一层是损失函数层(LOSS), 在测试时我们通过准确率来评价该网络的优劣,因此最后一层是准确率层(ACCURACY). 但是当我们真 ...

  9. caffe的python接口学习(5):生成deploy文件

    如果要把训练好的模型拿来测试新的图片,那必须得要一个deploy.prototxt文件,这个文件实际上和test.prototxt文件差不多,只是头尾不相同而也.deploy文件没有第一层数据输入层, ...

随机推荐

  1. Codeforces 483 - A/B/C/D/E - (Done)

    题目链接:http://codeforces.com/contest/483 A - Counterexample - [简单构造题] Your friend has recently learned ...

  2. [Day14]Eclipse高级、类与接口作为参数返回值

    l  不同修饰符的使用   类,最常使用public修饰   成员变量,最常使用private修饰   成员方法,最常使用public修饰 l  自定义数据类型的使用   类作为方法参数时,说明要向方 ...

  3. 从光盘安装ubuntu系统

    参考博客: https://www.jianshu.com/p/7929e4911206

  4. Oracle不连续的值,如何实现查找上一条、下一条

    1.  遇到的问题 已知一个题库,希望实现当前页切换上一题,下一题的需求. 查看得知,数据库中用于查询的字段(主键)是不连续的.如上图所示:stxh为主键number类型. 2.  实现方式lead ...

  5. [js]函数的上级作用域,他的上级作用域就是谁,跟函数在哪执行的没什么关系.

    函数的上级作用域,他的上级作用域就是谁,跟函数在哪执行的没什么关系. <script> //如何查找上级作用域? //看函数在哪个作用域下定义的,他的上级作用域就是谁. 跟函数在哪执行的没 ...

  6. POI大数据Excel生成

    package com.hd.erpreport.controller; import java.io.File; import java.io.FileOutputStream; import ja ...

  7. #WEB安全基础 : HTTP协议 | 0x0 TCP/IP四层结构

    学完HTML/CSS了? 做了这么多网页,但是你知道它们是怎么工作的吗? 作为你的朋友,我也对这些东西感兴趣,在写博客的同时也在和你一起学. 废话少说,进入正题 网络中的通信包括两个端分别为:客户端( ...

  8. #WEB安全基础 : HTTP协议 | 0x8 HTTP的Cookie技术

    说道Cookie,你喜欢吃饼干吗? 这里的Cookie不是饼干=_= HTTP不对请求和响应的通信状态进行保存,所以被称为无状态协议,为了保持状态和协议功能引入了Cookie技术 Cookie技术在请 ...

  9. JavaScript 原型链学习(二)原型的动态性

    由于在原型中查找值的过程是一次搜索,因此我们对原型对象所做的任何修改都能够立即从实例上反映出来,即使是先创建了实例后修改原型也照样如此.如下示例: var friend = new Person(); ...

  10. SQL Server通过BCP进行大批量数据导入导出

    预置条件: 使用sa帐号登录SQL Server Management Studio,右键点击安全性-登录名-数据库用户名属性,设置服务器角色为sysadmin. 删除已存在的存储过程 String ...