Search code examples
pythontensorflowtensorflow-litequantization

What does 'quantization' mean in interpreter.get_input_details()?


Using tflite and getting properties of interpreter like :

print(interpreter.get_input_details())

[{'name': 'input_1_1', 'index': 47, 'shape': array([  1, 128, 128,   3], dtype=int32), 'dtype': <class 'numpy.uint8'>, 'quantization': (0.003921568859368563, 0)}]

What does 'quantization': (0.003921568859368563, 0) mean?


Solution

  • It means quantization parameters values: scale and zero_point of input tensor.

    This is necessary to convert a quantized uint8 number q to floating point number f using formula:

    f = (q - zero_point) * scale