# 准备量化数据集,官方建议至少大于5000张图像# 提取文件夹中图片的名字,写入txtfind images/ -type f > imagelist.txt
# 生成用于int8量化的量化表# 量化表的作用,存储所有需量化层的scale信息,在ncnn2int8.cpp中,代码读取量化表,读取模型文件,然后按照量化表中的scale将模型中的参数量化,然后将INT8存下来
./ncnn2table model_original-opt.param model_original-opt.bin imagelist.txt model_original.table mean=[0,0,0]norm=[0.0039216,0.0039216,0.0039216]shape=[640,640,3]pixel=RGB thread=8method=kl
# 参数说明:# mean 和 norm: 输入数据减均值,除方差的参数# shape: 输入模型的图像尺度,[w,h] 或者 [w,h,c]# >
* if w and h both are given, image will be resized to exactly size.
* if w and h both are zero or negative, image will not be resized.
* if only h is zero or negative, image's width will scaled resize to w, keeping aspect ratio.
* if only w is zero or negative, image's height will scaled resize to h
# pixel: 输入图像的格式,BGR/RGB/GRAY(输入模型的图像格式)# thread: 用于量化推理的并行线程数# method: 量化方法,kl and aciq are currently supported