Quantized models throw error in Cube AI
Hi everyone,
I am trying to implement an image recognition application on an STM32L475. I succeded implementing a Keras model with Cube AI and wanted to reduce the memory footprint with a quantization model. I used the following code to quantize the keras model according to a question I found on this forum.
# Model_s is a trained model in the same python script
converter = tf.lite.TFLiteConverter.from_keras_model(model_s)
converter.target_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8]
converter.inference_input_type = tf.int8
converter.inference_output_type = tf.int8
quant_model = converter.convert()
# Saving the model
open("Models/converted_model.tflite", "wb").write(quant_model)When I try to analyze the model Cube AI reports the following error:
Analyzing model
Neural Network Tools for STM32 v1.2.0 (AI tools v5.0.0)
-- Importing model
INTERNAL ERROR:
Creating report file C:\Users\<user_name>\STM32Cube\Repository\Packs\STMicroelectronics\X-CUBE-AI\5.0.0\Utilities\windows\stm32ai_output\network_analyze_report.txt
INTERNAL ERROR: And on the report file:
Neural Network Tools for STM32 v1.2.0 (AI tools v5.0.0)
Created date : 2020-05-12 23:00:07
Exec/report summary (analyze err=-1)
------------------------------------------------------------------------------------------------------------------------
error : INTERNAL ERROR:
model file : C:\...\Models\converted_model.tflite
type : tflite (tflite)
c_name : network
compression : None
quantize : None
L2r error : NOT EVALUATED
workspace dir : C:\Users\<user_name>\AppData\Local\Temp\mxAI_workspace1060342814162004810839823904558311
output dir : C:\Users\<user_name>\STM32Cube\Repository\Packs\STMicroelectronics\X-CUBE-AI\5.0.0\Utilities\windows\stm32ai_output
INTERNAL ERROR:
Evaluation report (summary)
--------------------------------------------------
NOT EVALUATEDI can provide more python-side code if needed. Is this a known error?
Thanks
