Xilinx / Vitis-AI

Vitis AI is Xilinx’s development stack for AI inference on Xilinx hardware platforms, including both edge devices and Alveo cards.
https://www.xilinx.com/ai
Apache License 2.0
1.49k stars 630 forks source link

How to get the int8 param? #1152

Open JF-Lee opened 1 year ago

JF-Lee commented 1 year ago

I want to use this quantization platform to quantify Pointpillars and export the quantized parameters(int8 weights&bias). What should I do?

I downloaded the corresponding file from files:

However, .xmodel only has model topology and does not contain int8 parameters or quantization coefficients similar to DQD structure. I think qat_ converted.pth is the parameter obtained after QAT, and then the quantization coefficient is required to obtain the corresponding int8 parameter.

niuxjxlnx commented 1 year ago

@JF-Lee ,

After quantization, the parameters stored everywhere are all float values equivalent to (quantization scale * int8). So you can get int8 values by (float value / quantization scale).

JF-Lee commented 1 year ago

@JF-Lee ,

After quantization, the parameters stored everywhere are all float values equivalent to (quantization scale * int8). So you can get int8 values by (float value / quantization scale).

Thanks for you reply! quant_info.json contain bitwidth, fp which to convert float param to int8 param.

I download the .xmodel from

but I have some questions: If the denotation means the fp(scale=2^fp)? If so, why the first conv layer has the different fp between quant_info.json and this .xmodel which has been complied. 1

torukskywalker commented 8 months ago

@niuxjxlnx then How to get the value "quantization scale" in python(Tensorflow) code after quantization ?