relationship between .proto and .prototxt

2,039 views
Skip to first unread message

lei Wang

unread,
Feb 11, 2015, 11:40:11 AM2/11/15
to caffe...@googlegroups.com
I am trying to understand how caffe parse the .prototxt files to generate objects. My understanding is that .proto is defining the structure of the classes and .prototxt is used to generate objects of the classes. While there are tutorials about .proto, but I cannot find tutorials about how to change or design .prototxt according to different .protos. Are the two different types of files can both be parsed by google protocol buffer?  Thanks so much for your help.

Chan Kim

unread,
Apr 17, 2016, 11:35:36 AM4/17/16
to Caffe Users
I'm really a newcomer in caffe but according to what I read today, I have an impression that .proto is for storing parameters(any data) to a file using google protocol buffer tool and .prototxt is for generating objects of the classes as you said. Hope someone well versed in this topic could correct me if I'm wrong. I'm not sure .proto is only for write to/read from files or can be used between layers (like using temporary file?).

Jan

unread,
Apr 18, 2016, 9:59:38 AM4/18/16
to Caffe Users
The protobuf library is all about serialization of structured data, i.e. converting it to a bytestream or text and back. The .proto file describes the structure (the 'protocol') of the data to be serialized (it is not really a class, since it is only data, no methods, no behaviour; but your intention is right I guess). The protobuf compiler can turn this description into python/or C++/or Java code to serialize and deserialize data with that structure.

The actual data ("object" as you call it) can then be given in files with the extension .prototxt (actually the extension does not matter at all, it is just a text file), which can be read in using the protobuf compiler generated code to have the data in the specified structure in memory.

In protobuf there are two different formats for serialized data: textual or bytestream. The text format is human-readable and modifiable (and the corresponding files usually have the extension .prototxt), but it takes up a lot more space than the binary format.

In caffe, the network and solver definitions are nothing else but serialized-to-text data with the structure given in the caffe.proto. So if you ever have questions about a parameter, this is where you should look first.

Jan
Reply all
Reply to author
Forward
0 new messages