caffe compilation troubleshooting

2019-12-24 16:28:34 浏览数 (1)

Issue 1

When I compile caffe toolkit(actually, a caffe fork: lisa-caffe-public), I always encounter some errors like:

代码语言:javascript复制
Tab found; better use space
Line should be <= 80 characters
Missing space before ( in if(

At the beginning, I thought these warnings were caused by gcc/g , so I googled but found few result about this question. Then I read the manual of gcc. In the manual, I found some useful information:

  1. Adding -Wall parameter after gcc will display all warning information.
  2. Adding -w parameter will turn off all warning information.
  3. Adding -Wstring will display warning information about string. For example, if -Wfloat-equal is set, then it will warn if floating-point values are used in equality comparisons.
  4. Adding -Wno-string will not display warning information about string. For example, if -Wno-div-by-zero, then it will not warn if integer division by zero.

So I try to review Makefile of caffe and comment some lines, but the warning information remain. The knowledge is useful, but can’t solve my problem. After searching and searching, I finally found that it’s cpplint that caused errors. Cpplint is automated checker to make sure a C file follows Google’s C style guide. So I checked the Makefile, and find a line like this:

代码语言:javascript复制
EVERYTHING_TARGETS := all py$(PROJECT) test warn lint

Explain: EVERYTHING_TARGETS is target of command make everything. When compile caffe, we can just type make everything then gcc will do everything for us, including make all, make test, make warn, make lint. So finally I got the simplest solution: just remove lint from this line and recompiled it. This time everything went well.

Issue 2

When I train network using lisa-caffe-public, I encounter error:

代码语言:javascript复制
Unknown layer type: Python

I searched about this question and found the answer here: uncomment WITH__PYTHON_LAYER: =1 in Makefile.config and recompile it. lisa-caffe-public is a fork of fast-rcnn, which is a fork of original caffe of BVLC. The developer of fast-rcnn use Python layer in his implementation and lisa’s caffe fork inherits it. In order to run the network correctly, we must use the flag when compiling the source code.

Issue 3

Error message like this:

代码语言:javascript复制
fatal error: caffe/proto/caffe.pb.h: No such file or directory

caffe.pb.h is a header file generated by Google Protocol Buffer. Here is a tutorial about it. We must first generate it use commands below:

代码语言:javascript复制
$ protoc src/caffe/proto/caffe.proto --cpp_out=.
$ mkdir include/caffe/proto
$ mv src/caffe/proto/caffe.pb.h include/caffe/proto

Then compile again and we have the question solved. Reference from here

Issue 4

Error message like this:

代码语言:javascript复制
Check failed: proto.SerializeToOstream(&output)

This error happens when write snapshot to disk. There are three reasons that cause this error:

  1. The writing directory doesn’t exist
  2. You have to permission to write in the directory
  3. The target disk is full

You can check these 3 aspects. Reference: https://github.com/BVLC/caffe/issues/1394

Issue 5

When use fast R-CNN, got error like this:

代码语言:javascript复制
Floating point exception(core dumped).

It’s like something about box size. the solution is add filter_roidb function in lib/fast_rcnn/train.py file, like here. Reference: https://github.com/rbgirshick/py-faster-rcnn/issues/159

Issue 6

0 人点赞