how to convert tensoflow/lite pretrained model to 8 bit quantized model used in ACL?
As in the title, how to convert tensoflow/lite pretrained model to 8 bit quantized model used in ACL?
I try searching in the web, but not much information attained. Are there a example conversion script like tensorflow_data_extractor.py to do this?
Thanks.
Hello @liwei46,
No, at the moment we don't have a conversion script like the tensorflow_data_extractor.py.
Process should be straight forward like the tensorflow extractor, you should save your weights into separate files and re-create the TFLite model using ACL, either through the graph API or directly using ACL primitives. Feel free to contribute if you manage to create such a script.
Or you can use ARMNN which provides a TFLite parser.
Hello @GeorgeARM,
Thanks for the reply. I have more questions below:
- Is the operation of ACL qasymm8 same as tensorflow lite?
- Is so, we only need to dump the parameters for each layer similar as the normal tensorflow model?
- and there are min/max/scale values in float point format, and zero_point in integer in tensorflow lite models, does ACL use these min/max/scale values?
- what is the format of ACL qasymm8 parameter file look like? are there a document describing this?
Regards, liwei
Hi @liwei46,
- Yes, QASYMM8 datatype is a uint8_t with scale and offset defined somewhere, like tensorflow.
- Once you have the parameters, if they are float you have to define a scale and offset and quantitize them so that they can have a value between 0 and 255.
- Please find here the definition of Quantization Info
- You can just define a tensor with datatype QASYMM8 and the QuantizationInfo you want. The send the tensor in the layer you want. Obviously the layer has to support it, in the comments in the header files you can check if a layer support QASYMM8 or not
Thanks, Manuel
Closing for inactivity, feel free to reopen otherwise