ncnn int8
sunnymoon155 opened this issue · 3 comments
Hi, I successfully get ncnn int8 model of efficientnet_b0 followed by your code:
pytorch --> onnx --> ncnn --> ncnn int8
However, when I do it on tf_mobilenetv3_small_075 model, I got some error in the last step:
./ncnn2table --param tf_mobilenetv3_small_075-sim.param --bin tf_mobilenetv3_small_075-sim.bin --images imgs/ --output tf_mobilenetv3_small_075-sim.table --mean 127.5,127.5,127.5 --norm 0.0078125,0.0078125,0.0078125 --size 224,224 --thread 2 (which succeed in efficientnet_b0 model)
--- ncnn post training quantization tool --- 07:49:29 Nov 7 2019
param = 'tf_mobilenetv3_small_075-sim.param'
bin = 'tf_mobilenetv3_small_075-sim.bin'
images = '/nfs/project/lijian_i/onnx-simplifier-master/imgs/'
output = 'tf_mobilenetv3_small_075-sim.table'
mean = '127.5,127.5,127.5'
norm = '0.0078125,0.0078125,0.0078125'
size = '224,224'
thread = '2'
====> Quantize the parameters.
====> Quantize the activation.
====> step 1 : find the max value.
[1] 2429 segmentation fault (core dumped) /home/luban/ncnn-master/build/tools/quantize/ncnn2table --param --bin
I was wondering is that input sized changed in TF ported weight or other issues?
Thanks for advance!
I haven't tried that quantization tool, the fact that it seg faults makes me think the issue is in that tool. The TF porting of those weights was handled the same as others, the size isn't baked in until you onnx export it. Did you try validating the onnx model in FP32 with an Onnx runtime or via caffe before quantizing it? Sometimes the input node names change between models
Closing due to inactivity, if problem was figured out please update even if close so others can see. Thanks
@sunnymoon155
Hi,
I convert efficient_b0->onnx to ncnn by the commands:
python onnx_export.py --model=efficientnet_b0 --output=res.onnx --checkpoint=../efficientnet_b0_ra-3dd342df.pth
python onnx_optimize.py res.onnx --output=res_opt.onnx
./onnx2ncnn /home/user/Downloads/efficientnet/torch/gen-efficientnet-pytorch/res_opt.onnx efficientnet_b0.param efficientnet_b0.bin
when I inference by the .param and .bin, error..
ModelBin read index_array failed 1101
layer load_model 42 failed
find_blob_index_by_name data failed
Segmentation fault (core dumped)
do you know how to fix it?