facebookarchive / caffe2

Caffe2 is a lightweight, modular, and scalable deep learning framework.
https://caffe2.ai
Apache License 2.0
8.42k stars 1.95k forks source link

Manual design of protobuf files #395

Open crohkohl opened 7 years ago

crohkohl commented 7 years ago

Hi,

I try to avoid python wherever possible as we have end-to-end C++ pipelines. Caffe1 was great and easy to use without ever touching python.

Is it still possible to create the network-definitions "by hand in clear text" and not using python? In the model zoo for caffe2 there are no clear-text network definitions available anymore.

Or asked differently: what is the best way to use caffe2 without python?

Thanks for the great framework, Christopher

haikuoyao commented 7 years ago

I have the same question. Is it possible to use prototxt files in Caffe2 like Caffe1 ?

hgaiser commented 7 years ago

I would assume it is in theory possible. The networks you define in caffe2 (python) get serialized to protobuf syntax (similar as prototxt in caffe). Whether you really want to write directly in protobuf syntax is another question.

caffe was designed such that networks are defined in prototxt files, caffe2 was designed to define networks in python (and deploy to prototxt-like files for C++). I can imagine that this design difference makes "caffe2's prototxts" unpleasant to work with directly and also hardly documented.

May I ask why it is an issue to use python to generate a prototxt file and deploy that in C++? Personally I think it is a big step forward to have python generate prototxt files ... try writing a ResNet siamese network prototxt and you'll find out ;)

crohkohl commented 7 years ago

@hgaiser You are right, maybe my question was a bit short-sighted. Python comes in handy when specifying a network. For me python just always is a hurdle with the many distributions, packages and incompatibilities, especially under windows which is my main dev platform. I think a simple and usable network definition is also possible in modern C++, like e.g. the approach taken by dlib: http://dlib.net/dnn_introduction_ex.cpp.html which looks elegant to me.

My biggest issue with the current design choice is the major focus on python for all aspects. E.g. it seems that the possibility to run a training from C++ seems to have been removed (as far as I can see). With caffe1 I could easily integrate all the steps from training, testing, refinement with a little bit of C++. But maybe I have just not dig "deep" enough yet ....

Maybe I will try to kick off a dlib-inspired interface for caffe2.