Generate caffe.pb.cc and caffe.pb.h files

In this article, in the process of adding a new layer to windows-caffe, the extract-proto batch command needs to be used to generate caffe.pb.cc and caffe.pb.h files. There is no extract_proto.bat file in .\src\caffe\proto\ .
I have taken some detours before and found some methods on the Internet, but they are not completely applicable to my problem. Maybe the solution I have here is only applicable to some colleagues. If my method cannot be solved, try several online solutions. always one option fit for you.
If you are adding your own new layer under caffe, I believe you have modified the caffe.proto file. Let's go straight to the topic
step1: write a batch file (the suffix is ​​.bat), write it on the text, and save it with the suffix .bat. Text content:

protoc caffe.proto --cpp_out=./
protoc caffe.proto --python_out=./
md ..\..\..\python\caffe\proto\
copy /y .\caffe_pb2.py ..\..\..\python\caffe\proto\
copy nul ..\..\..\python\caffe\proto\__init__.py
pause

You can choose the name of the file by yourself. Recommended: extract_proto.bat

When you double-click the batch command, it may prompt that protoc is not an internal command.

step2: You should download a protoc.exe file and put it in the C:\Windows\System32 directory.
I found a method online before, saying that I put it in the caffe-master\windows\scripts directory. I didn't succeed, but I saw some successes. Maybe this method is not suitable for me. Similarly, maybe my method Not suitable for some people, but another method will work. One principle: try more and you will come out.
protoc.exe file download link, click here

step3: After protoc.exe is placed in the specified path, double-click extract_proto.bat to regenerate caffe.pb.cc and caffe.pb.h under .\src\caffe\proto.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325561921&siteId=291194637