Skip to content

Compile AI Models with Vela

Before model compilation, a quantized TensorFlow Lite model (.tflite) must be prepared or sourced.

Note

Arm provides pre-trained TensorFlow Lite models on their ML Zoo GitHub repository.

  1. Navigate to the rz-ethos-u project on the Linux Host PC.

    cd ~/rz-ethos-u
    
  2. Compile the model with Vela.

    ./scripts/vela/generate-model-data-host.sh -d model_deployment_dir -m mobilenet_v2_1.0_224_INT8.tflite
    

    Note

    1. Run this in the shell where the Python virtual environment is activated (source ~/rz-ethos-u/scripts/vela/.venv/bin/activate).
    2. Remember to replace mobilenet_v2_1.0_224_INT8.tflite with the correct filepath of the model.
    3. Feel free to use a different output directory name instead of model_deployment_dir.
    4. Expected output files are generated by default. These are used to verify the model output when run on the board.
  3. Upon completion, the compilation log will be displayed on the console and the model data is saved in the defined output directory.

2026-10-20 14:17:14,752 INFO -  ------------------------------------------------------------
2026-10-20 14:17:14,752 INFO -  Model being compiled with VELA: mobilenet_v2_1.0_224_INT8 (mobilenet_v2_1.0_224_INT8.tflite)

Network summary for mobilenet_v2_1.0_224_INT8
Accelerator configuration               Ethos_U55_256
System configuration               RZG3E_DIRECT_DRIVE
Memory mode                            Dedicated_Sram
Accelerator clock                                1000 MHz
Design peak SRAM bandwidth                       7.45 GB/s
Design peak DRAM bandwidth                       7.45 GB/s

Total SRAM used                                238.88 KiB
Total DRAM used                               4842.33 KiB

CPU operators = 0 (0.0%)
NPU operators = 92 (100.0%)

Average SRAM bandwidth                           2.96 GB/s
Input   SRAM bandwidth                           6.32 MB/batch
Weight  SRAM bandwidth                           0.00 MB/batch
Output  SRAM bandwidth                           2.89 MB/batch
Total   SRAM bandwidth                           9.21 MB/batch
Total   SRAM bandwidth            per input      9.21 MB/inference (batch size 1)

Average DRAM bandwidth                           5.25 GB/s
Input   DRAM bandwidth                           6.18 MB/batch
Weight  DRAM bandwidth                           5.60 MB/batch
Output  DRAM bandwidth                           3.78 MB/batch
Total   DRAM bandwidth                          16.33 MB/batch
Total   DRAM bandwidth            per input     16.33 MB/inference (batch size 1)

Neural network macs                         300840274 MACs/batch

2026-10-20 14:17:16,197 INFO -  Input data for all tensors has been saved to: model_deployment_dir/mobilenet_v2_1.0_224_INT8/all-inputs.bin
2026-10-20 14:17:16,738 INFO -  Expected output data for all tensors has been saved to: model_deployment_dir/mobilenet_v2_1.0_224_INT8/expected-outputs.bin
2026-10-20 14:17:16,738 INFO -  ------------------------------------------------------------
2026-10-20 14:17:16,739 INFO -  The configuration YAML has been saved to: model_deployment_dir/config.yaml
2026-10-20 14:17:16,739 INFO -  Please copy the model_deployment_dir directory to the board!
  1. Copy the model files to the Linux Host PC.

  2. Navigate to the rz-ethos-u project on the Linux Host PC.

    cd ~/rz-ethos-u
    
  3. Compile the models with Vela.

    ./scripts/vela/generate-model-data-host.sh -d model_deployment_dir -m ad_large_int8.tflite kws_micronet_l.tflite tiny_wav2letter_int8.tflite
    

    Note

    The models used in the example can be downloaded from:

    • ad_large_int8.tflite
    • kws_micronet_l.tflite
    • tiny_wav2letter_int8.tflite

    • Run this in the shell where the Python virtual environment is activated (source ~/rz-ethos-u/scripts/vela/.venv/bin/activate).

    • Remember to replace the models with the correct filepaths.
    • Feel free to use a different output directory name instead of model_deployment_dir.
    • Expected output files are generated by default. These are used to verify the model output when run on the board.
  4. Upon completion, the compilation log will be displayed on the console and the model data is saved in the defined output directory.

2026-10-20 14:19:31,969 INFO -  ------------------------------------------------------------
2026-10-20 14:19:31,970 INFO -  Model being compiled with VELA: ad_large_int8 (ad_large_int8.tflite)

Network summary for ad_large_int8
Accelerator configuration               Ethos_U55_256
System configuration               RZG3E_DIRECT_DRIVE
Memory mode                            Dedicated_Sram
Accelerator clock                                1000 MHz
...
2026-10-20 14:19:32,516 INFO -  Input data for all tensors has been saved to: model_deployment_dir/ad_large_int8/all-inputs.bin
2026-10-20 14:19:32,613 INFO -  Expected output data for all tensors has been saved to: model_deployment_dir/ad_large_int8/expected-outputs.bin
2026-10-20 14:19:32,613 INFO -  ------------------------------------------------------------
2026-10-20 14:19:32,613 INFO -  ------------------------------------------------------------
2026-10-20 14:19:32,613 INFO -  Model being compiled with VELA: kws_micronet_l (kws_micronet_l.tflite)

Network summary for kws_micronet_l
Accelerator configuration               Ethos_U55_256
System configuration               RZG3E_DIRECT_DRIVE
Memory mode                            Dedicated_Sram
Accelerator clock                                1000 MHz
...
2026-10-20 14:19:33,253 INFO -  Input data for all tensors has been saved to: model_deployment_dir/kws_micronet_l/all-inputs.bin
2026-10-20 14:19:33,361 INFO -  Expected output data for all tensors has been saved to: model_deployment_dir/kws_micronet_l/expected-outputs.bin
2026-10-20 14:19:33,361 INFO -  ------------------------------------------------------------
2026-10-20 14:19:33,361 INFO -  ------------------------------------------------------------
2026-10-20 14:19:33,361 INFO -  Model being compiled with VELA: tiny_wav2letter_int8 (tiny_wav2letter_int8.tflite)

Network summary for tiny_wav2letter_int8
Accelerator configuration               Ethos_U55_256
System configuration               RZG3E_DIRECT_DRIVE
Memory mode                            Dedicated_Sram
Accelerator clock                                1000 MHz
...
2026-10-20 14:19:34,449 INFO -  Input data for all tensors has been saved to: model_deployment_dir/tiny_wav2letter_int8/all-inputs.bin
2026-10-20 14:19:35,065 INFO -  Expected output data for all tensors has been saved to: model_deployment_dir/tiny_wav2letter_int8/expected-outputs.bin
2026-10-20 14:19:35,066 INFO -  ------------------------------------------------------------
2026-10-20 14:19:35,068 INFO -  The configuration YAML has been saved to: model_deployment_dir/config.yaml
2026-10-20 14:19:35,068 INFO -  Please copy the model_deployment_dir directory to the board!
  1. Make sure Linux has booted, then log in as root (no password).

    Poky (Yocto Project Reference Distro) 5.0.14 smarc-rzg3e ttySC3
    smarc-rzg3e login: root
    
  2. Copy the model to the board's rootfs, or download it directly over the internet.

  3. Compile the model with Vela.

    python3 /usr/bin/generate-model-data.py -d model_deployment_dir -m mobilenet_v2_1.0_224_INT8.tflite
    

    Note

    1. Remember to replace mobilenet_v2_1.0_224_INT8.tflite with the correct filepath of the model.
    2. Feel free to use a different output directory name instead of model_deployment_dir.
    3. By default, expected output files will not be generated when compiling on device. To generate the expected output, provide the -o flag in the compilation command.
  4. Upon completion, the compilation log will be displayed on the console and the model data is saved in the defined output directory.

2026-10-20 14:15:25,010 INFO -  ------------------------------------------------------------
2026-10-20 14:15:25,011 INFO -  Model being compiled with VELA: mobilenet_v2_1.0_224_INT8 (mobilenet_v2_1.0_224_INT8.tflite)

Network summary for mobilenet_v2_1.0_224_INT8
Accelerator configuration               Ethos_U55_256
System configuration               RZG3E_DIRECT_DRIVE
Memory mode                            Dedicated_Sram
Accelerator clock                                1000 MHz
Design peak SRAM bandwidth                       7.45 GB/s
Design peak DRAM bandwidth                       7.45 GB/s

Total SRAM used                                238.88 KiB
Total DRAM used                               4842.33 KiB

CPU operators = 0 (0.0%)
NPU operators = 92 (100.0%)

Average SRAM bandwidth                           2.96 GB/s
Input   SRAM bandwidth                           6.32 MB/batch
Weight  SRAM bandwidth                           0.00 MB/batch
Output  SRAM bandwidth                           2.89 MB/batch
Total   SRAM bandwidth                           9.21 MB/batch
Total   SRAM bandwidth            per input      9.21 MB/inference (batch size 1)

Average DRAM bandwidth                           5.25 GB/s
Input   DRAM bandwidth                           6.18 MB/batch
Weight  DRAM bandwidth                           5.60 MB/batch
Output  DRAM bandwidth                           3.78 MB/batch
Total   DRAM bandwidth                          16.33 MB/batch
Total   DRAM bandwidth            per input     16.33 MB/inference (batch size 1)

Neural network macs                         300840274 MACs/batch

2026-10-20 14:15:30,095 INFO -  Input data for all tensors has been saved to: model_deployment_dir/mobilenet_v2_1.0_224_INT8/all-inputs.bin
2026-10-20 14:15:30,097 INFO -  ------------------------------------------------------------
2026-10-20 14:15:30,103 INFO -  The configuration YAML has been saved to: model_deployment_dir/config.yaml
2026-10-20 14:15:30,103 INFO -  To run these models, execute: /usr/bin/model-executor -e model_deployment_dir/config.yaml
  1. Make sure Linux has booted, then log in as root (no password).

    Poky (Yocto Project Reference Distro) 5.0.14 smarc-rzg3e ttySC3
    smarc-rzg3e login: root
    
  2. Copy the models to the board.

  3. Compile the models with Vela.

    python3 /usr/bin/generate-model-data.py -d model_deployment_dir -m ad_large_int8.tflite kws_micronet_l.tflite tiny_wav2letter_int8.tflite
    

    Note

    The models used in the example can be downloaded from:

    • ad_large_int8.tflite
    • kws_micronet_l.tflite
    • tiny_wav2letter_int8.tflite

    • Remember to replace the models with the correct filepaths.

    • Feel free to use a different output directory name instead of model_deployment_dir.
    • By default, expected output files will not be generated when compiling on device. To generate the expected output, provide the -o flag in the compilation command.
  4. Upon completion, the compilation log will be displayed on the console and the model data is saved in the defined output directory.

2026-10-20 14:21:18,363 INFO -  ------------------------------------------------------------
2026-10-20 14:21:18,364 INFO -  Model being compiled with VELA: ad_large_int8 (ad_large_int8.tflite)

Network summary for ad_large_int8
Accelerator configuration               Ethos_U55_256
System configuration               RZG3E_DIRECT_DRIVE
Memory mode                            Dedicated_Sram
Accelerator clock                                1000 MHz
...
2026-10-20 14:21:21,743 INFO -  Input data for all tensors has been saved to: model_deployment_dir/ad_large_int8/all-inputs.bin
2026-10-20 14:21:21,744 INFO -  ------------------------------------------------------------
2026-10-20 14:21:21,745 INFO -  ------------------------------------------------------------
2026-10-20 14:21:21,746 INFO -  Model being compiled with VELA: kws_micronet_l (kws_micronet_l.tflite)

Network summary for kws_micronet_l
Accelerator configuration               Ethos_U55_256
System configuration               RZG3E_DIRECT_DRIVE
Memory mode                            Dedicated_Sram
Accelerator clock                                1000 MHz
...
2026-10-20 14:21:24,764 INFO -  Input data for all tensors has been saved to: model_deployment_dir/kws_micronet_l/all-inputs.bin
2026-10-20 14:21:24,765 INFO -  ------------------------------------------------------------
2026-10-20 14:21:24,767 INFO -  ------------------------------------------------------------
2026-10-20 14:21:24,767 INFO -  Model being compiled with VELA: tiny_wav2letter_int8 (tiny_wav2letter_int8.tflite)

Network summary for tiny_wav2letter_int8
Accelerator configuration               Ethos_U55_256
System configuration               RZG3E_DIRECT_DRIVE
Memory mode                            Dedicated_Sram
Accelerator clock                                1000 MHz
...
2026-10-20 14:21:28,857 INFO -  Input data for all tensors has been saved to: model_deployment_dir/tiny_wav2letter_int8/all-inputs.bin
2026-10-20 14:21:28,858 INFO -  ------------------------------------------------------------
2026-10-20 14:21:28,866 INFO -  The configuration YAML has been saved to: model_deployment_dir/config.yaml
2026-10-20 14:21:28,867 INFO -  To run these models, execute: /usr/bin/model-executor -e model_deployment_dir/config.yaml

Note

The scripts support a --seed option that allows for a seed to be set for the random input data generation. This allows for reproducible random data generation.

By default, a seed value of 10 is used.