Search code examples
buildcaffe

An error when building the code from the 'Explain-to-Fix' paper


I try to rebuild the code for the E2X paper.
I prepared the repository with the manual to reproduce the error.

I've successfully built and ran tests for the clean caffe/ssd branch.
When building the same branch with the merged E2X code, I get the following error from make:

detection_evaluate_layer.cpp: In member function ‘virtual void caffe::DetectionEvaluateLayer<Dtype>::Forward_cpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&)’:
detection_evaluate_layer.cpp:170:58: error: ‘const value_type’ {aka ‘const class caffe::NormalizedBBox’} has no member named ‘idx’
  170 |           top_data[num_det * EVAL_SHAPE + 9] = bboxes[i].idx();
      |                                                          ^~~
detection_evaluate_layer.cpp:196:60: error: ‘__gnu_cxx::__alloc_traits<std::allocator<caffe::NormalizedBBox>, caffe::NormalizedBBox>::value_type’ {aka ‘class caffe::NormalizedBBox’} has no member named ‘idx’
  196 |             top_data[num_det * EVAL_SHAPE + 9] = bboxes[i].idx();
      |                                                            ^~~
detection_evaluate_layer.cpp:221:60: error: ‘__gnu_cxx::__alloc_traits<std::allocator<caffe::NormalizedBBox>, caffe::NormalizedBBox>::value_type’ {aka ‘class caffe::NormalizedBBox’} has no member named ‘idx’
  221 |             top_data[num_det * EVAL_SHAPE + 9] = bboxes[i].idx();

When looking at the caffe/ssd branch, I noticed that it used idx, but never idx().
The error appears in the code introduced by E2X.

Does anyone have an idea how to fix it?


Solution

  • The solution was to add a field in the src/caffe/proto/caffe.proto file:

        optional int32 idx = 9;
    

    Here's the link for the fix.