Skip to main content
Ilkay1
Visitor II
July 12, 2020
Question

Unable to load asc_keras_mod_93_int8.tflite from FP-AI-SENSING-1 using various tensorflow versions in python. Error message: ValueError: quantized_dimension must be in range [0, 1). Was 3.

  • July 12, 2020
  • 1 reply
  • 740 views

Hello,

I am currently working with the acoustic scene classification (ASC) of the FP-AI-SENSING1 project.

I tried to load the tflite model, which is provided at: STM32CubeFunctionPack_SENSING1_V4.0.2\Utilities\AI_Ressources\models\asc_keras_mod_93_int8.tflite

Unfortunately, I always end up with this error: ValueError: quantized_dimension must be in range [0, 1). Was 3.

I always end up with this error no matter which tensorflow version I use.

Can anybody help me with this issue?

Thanks in advance,

Ilkay

    This topic has been closed for replies.

    1 reply

    Laurent
    ST Employee
    July 13, 2020

    ​Hello Ilkay

    The FP pack at the time used the following requirement tensorflow==1.14.0

    I tried to load the tflite model in this way:

    Python 3.7.3 (default, Mar 27 2019, 22:11:17)
    [GCC 7.3.0] :: Anaconda, Inc. on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import tensorflow as tf
    >>> interpreter = tf.lite.Interpreter(model_path="asc_keras_mod_93_int8.tflite")
    INFO: Initialized TensorFlow Lite runtime.
    >>> interpreter.allocate_tensors()
    >>> input_details = interpreter.get_input_details()
    >>> output_details = interpreter.get_output_details()
    >>> print (input_details)
    [{'name': 'conv2d_11_input', 'index': 3, 'shape': array([ 1, 30, 32, 1], dtype=int32), 'dtype': <class 'numpy.int8'>, 'quantization': (0.050990983843803406, 42)}]
    >>> print (output_details)
    [{'name': 'dense_12/Softmax', 'index': 12, 'shape': array([1, 3], dtype=int32), 'dtype': <class 'numpy.int8'>, 'quantization': (0.00390625, -128)}]
    >>>

    In this way I have no issue , you may want to use the same set up than I .

    good luck

    L.