How to create and use int8 calibrator?


I want to generate a int8 calibrator for my own ai algorithm. According to sampleINT8


  1. Apply the patch. The patch can be applied by going to the root directory of the Caffe source tree and applying the patch with the command:
    patch -p1 < int8_caffe.patch

then, I run the following commands:

make clean
make -j12

there come up an error:

CXX src/caffe/layers/multinomial_logistic_loss_layer.cpp
src/caffe/layers/data_layer.cpp: In member function ‘virtual void caffe::DataLayer::load_batch(caffe::Batch*)’:
src/caffe/layers/data_layer.cpp:140:18: error: ‘top_shape’ was not declared in this scope
int s[4] = { top_shape[0], top_shape[1], top_shape[2], top_shape[3] };
src/caffe/layers/data_layer.cpp:142:12: error: ‘top_data’ was not declared in this scope
fwrite(top_data, sizeof(float), top_shape[0]*top_shape[1]*top_shape[2]*top_shape[3], file);
src/caffe/layers/data_layer.cpp:143:13: error: ‘top_label’ was not declared in this scope
fwrite(&top_label[0], sizeof(int), top_shape[0], file);
Makefile:585: recipe for target ‘.build_release/src/caffe/layers/data_layer.o’ failed
make: *** [.build_release/src/caffe/layers/data_layer.o] Error 1
make: *** Waiting for unfinished jobs…

How to solve this problom?