How to quickly benchmark a model

ST Model Zoo lets you measure the memory footprint and inference time of any model on STM32 and STM32MP targets, either via the ST Edge AI Model Bench or locally with STEdgeAI Core.


Operation modes

Choose the mode that matches your starting point:

Your model

Operation mode

Already quantized ( .tflite, QDQ .onnx)

benchmarking

Float model ( .keras, .h5, .onnx)

chain_qb — quantizes then benchmarks in one pass

Note: Not all use cases support both modes. chain_qb requires a quantization step, which is only available for use cases that include it. The following use cases only support benchmarking (no quantization service):

  • Human Activity Recognition and Hand Posture Recognition — models are small enough to run efficiently as float, quantization is not needed.

  • Depth Estimation, Instance Segmentation, and Neural Style Transfer — quantization is not part of the supported workflow.

The diagram below illustrates the chain_qb flow:

chain_qb flow


Available target boards

STM32N6570-DK, STM32H747I-DISCO, STM32H7B3I-DK, STM32H573I-DK, NUCLEO-H743ZI2, STM32F769I-DISCO, STM32H735G-DK, STM32H7S78-DK, STM32F469I-DISCO, STM32F746G-DISCO, B-U585I-IOT02A, STM32L4R9I-DISCO, NUCLEO-F401RE, NUCLEO-G474RE, STM32MP257F-EV1, STM32MP135F-DK, STM32MP157F-DK2


Example 1 — Benchmark a quantized model ( benchmarking mode)

Edit user_config.yaml in your use-case folder:

model:
  model_path: path/to/your_model_int8.tflite   # .tflite or QDQ .onnx

operation_mode: benchmarking

tools:
  stedgeai:
    optimization: balanced
    on_cloud: True
    path_to_stedgeai: C:/ST/STEdgeAI/<x.y>/Utilities/windows/stedgeai.exe
  path_to_cubeIDE: C:/ST/STM32CubeIDE_<x.y.z>/STM32CubeIDE/stm32cubeide.exe

benchmarking:
  board: STM32H747I-DISCO   # replace with your target board

mlflow:
  uri: ./experiments_outputs/mlruns

hydra:
  run:
    dir: ./experiments_outputs/${now:%Y_%m_%d_%H_%M_%S}

Example 2 — Quantize then benchmark in one pass ( chain_qb mode)

Use this when you only have a float model and want a quick performance estimate without providing a calibration dataset (quantization will use random data — sufficient for benchmarking, not for accuracy evaluation).

model:
  model_path: path/to/your_model.keras   # .keras, .h5, or .onnx

operation_mode: chain_qb

quantization:
  quantizer: TFlite_converter
  quantization_type: PTQ
  quantization_input_type: uint8
  quantization_output_type: float
  granularity: per_channel
  export_dir: quantized_models

tools:
  stedgeai:
    optimization: balanced
    on_cloud: True
    path_to_stedgeai: C:/ST/STEdgeAI/<x.y>/Utilities/windows/stedgeai.exe
  path_to_cubeIDE: C:/ST/STM32CubeIDE_<x.y.z>/STM32CubeIDE/stm32cubeide.exe

benchmarking:
  board: STM32H747I-DISCO

mlflow:
  uri: ./experiments_outputs/mlruns

hydra:
  run:
    dir: ./experiments_outputs/${now:%Y_%m_%d_%H_%M_%S}

Note: For a final deployment-ready model, always quantize with real calibration data. Random-data quantization is only suitable for performance estimation.


Run the benchmark

From the root of your use-case folder:

python stm32ai_main.py

To use a custom config file:

python stm32ai_main.py --config-path=<path_to_yaml_folder> --config-name=<yaml_filename>

Local benchmarking (without the cloud)

To run the benchmark locally instead of using ST Edge AI Model Bench, set on_cloud: False and provide the path to your local STEdgeAI installation:

tools:
  stedgeai:
    optimization: balanced
    on_cloud: False
    path_to_stedgeai: C:/ST/STEdgeAI/<x.y>/Utilities/windows/stedgeai.exe
  path_to_cubeIDE: C:/ST/STM32CubeIDE_<x.y.z>/STM32CubeIDE/stm32cubeide.exe

Download the required tools: