cancel
Showing results for 
Search instead for 
Did you mean: 

ST Edge AI Dev Cloud Quantization not working

BM11
Visitor

Hi,

I've been using ST Edge AI Dev Cloud to benchmark my human activity recognition models on some ST platforms and I would like to do the same for the STM32N6570-DK but it only accepts quantized models and the quantization option throws and error:

Executing with: {'model': '/tmp/quantization-service/0f29903b-6961-4c97-bde9-83219e06f56f/gmp_wl_24_human_activity_recognition_WISDM.h5', 'data': None, 'input_type': tf.float32, 'output_type': tf.int8, 'optimization': <Optimize.DEFAULT: 'DEFAULT'>, 'output': '/tmp/quantization-service/0f29903b-6961-4c97-bde9-83219e06f56f', 'disable_per_channel': False}
Invalid value for argument `reduction`. Expected one of {'mean', None, 'sum', 'none', 'sum_over_batch_size', 'mean_with_sample_weight'}. Received: reduction=auto

2025-07-31 09:19:58.238638: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2025-07-31 09:19:58.272098: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
/usr/local/lib/python3.9/site-packages/keras/src/optimizers/base_optimizer.py:86: UserWarning: Argument `decay` is no longer supported and will be ignored.
warnings.warn(

I have tried both with my custom models and the ones built by ST, but none seem to work.

Important note is that quantization was working about 2 months ago, but then suddenly stopped.

Is there a fix for this?

Thanks in advance,

Best regards.

 
 
2 REPLIES 2
hamitiya
ST Employee

Hello @BM11 

ST Edge AI Developer Cloud quantization version uses tensorflow-cpu 2.18.0 (previously, it was 2.15.0) in order to be aligned with the latest version embedded in ST Edge AI Core.

It seems that some regressions are occuring based on tensorflow version.

I am investigating the issue.

 

It is possible that we have to add a new argument in order to use legacy. (see: What's new in TensorFlow 2.16 — The TensorFlow Blog) and https://github.com/tensorflow/tensorflow/issues/72388

 

 

Best regards,

Yanis


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hello @BM11 

I've deployed an update in ST Edge AI Developer Cloud in order to use either the latest version of Tensorflow or use legacy, as described in the link I've shared with you.

By ticking the "Use Keras Legacy" checkbox you should be able to quantize your model as you've done before. If you use a newer version of Keras when you export your model, you can try again without.

Feel free to confirm if it works now on your end

 

Best regards,

Yanis


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.