Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Caffe: what's the difference between train_test.prototxt and deploy.prototxt?

Tags:

caffe

pycaffe

In pertained models like GoogleNet https://github.com/BVLC/caffe/tree/master/models/bvlc_googlenet

we can see two .prototxt file describing the network, what's the differences between them?

deploy.txt and train_test.prototxt

My key question is , in python interface, why can I only use the former one? That is to say:

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)

this code runs correct while:

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)

this does not. and it gives out error information:

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: ***

Why? what's the differences?

like image 366
Long Avatar asked Feb 06 '23 10:02

Long


1 Answers

train_val.prototxt is used in training whereas deploy.prototxt is used in inference.

train_val.prototxt has the information of where the training data is located. In your case, it contains the path for an lmdb file which contains the training data.

deploy.prototxt contains the information regarding the input size but it does not contain any information regarding the input itself. So you can pass any image with that size as input to it and do inference.

When you load train_val.prototxt it looks for the training data file mentioned in it. You are getting an error because it is unable to find it.

Tip: When doing inference, it is better to use deploy.prototxt.

like image 139
malreddysid Avatar answered Apr 09 '23 15:04

malreddysid