【问题标题】:Caffe: what's the difference between train_test.prototxt and deploy.prototxt?Caffe:train_test.prototxt 和 deploy.prototxt 有什么区别?
【发布时间】:2016-12-11 07:56:19
【问题描述】:

在 GoogleNet 等相关模型中 https://github.com/BVLC/caffe/tree/master/models/bvlc_googlenet

我们可以看到两个描述网络的 .prototxt 文件,它们之间的区别是什么?

deploy.txt 和 train_test.prototxt

我的关键问题是,在python界面中,为什么我只能使用前一个?也就是说:

model_def = caffe_root + 'models/bvlc_googlenet/deploy.prototxt'

model_weights = caffe_root + 'models/bvlc_googlenet/bvlc_googlenet.caffemodel'

net = caffe.Net(model_def,model_weights,caffe.TEST)

这段代码运行正确,而:

model_def = caffe_root + 'models/bvlc_googlenet/train_val.prototxt'

model_weights = caffe_root + 'models/bvlc_googlenet/bvlc_googlenet.caffemodel'

net = caffe.Net(model_def,model_weights,caffe.TEST)

这不是。并给出错误信息:

layer {
  name: "inception_4e/relu_5x5_reduce"
  type: "ReLU"
  bottom: "inception_4e/5x5_reduce"
  top: "inception_4e/5x5_reduce"
}
layer {
I0805 10:15:13.698256 30930 layer_factory.hpp:77] Creating layer data
I0805 10:15:13.698444 30930 net.cpp:100] Creating Layer data
I0805 10:15:13.698465 30930 net.cpp:408] data -> data
I0805 10:15:13.698514 30930 net.cpp:408] data -> label
F0805 10:15:13.699956   671 db_lmdb.hpp:15] Check failed: mdb_status == 0 (2 vs. 0) No such file or directory
*** Check failure stack trace: ***

为什么?有什么区别?

【问题讨论】:

    标签: caffe pycaffe


    【解决方案1】:

    train_val.prototxt 用于训练,deploy.prototxt 用于推理。

    train_val.prototxt 有训练数据所在位置的信息。在您的情况下,它包含包含训练数据的 lmdb 文件的路径。

    deploy.prototxt 包含有关输入大小的信息,但不包含有关输入本身的任何信息。因此,您可以将具有该大小的任何图像作为输入传递给它并进行推理。

    当您加载train_val.prototxt 时,它会查找其中提到的训练数据文件。您收到错误是因为无法找到它。

    提示:在进行推理时,最好使用deploy.prototxt。

    【讨论】:

      猜你喜欢
      • 2010-10-02
      • 2011-12-12
      • 2010-09-16
      • 2012-03-14
      • 2012-02-06
      • 2011-02-25
      • 2011-11-22
      • 2015-03-26
      • 2013-08-19
      相关资源
      最近更新 更多