On-target ISPU validation flow
for ISPU target, based on ST Edge AI Core Technology 2.2.0
r1.2
Host board firmware
Validation on target with ST Edge AI Core requires flashing a specific firmware on the host board, which acts as a bridge between the user’s PC and the ISPU. The firmware for the user’s specific hardware setup can be found in the host_firmware/nucleo_ispu_stedgeai_validate folder of ST’s GitHub repository for ISPU (https://github.com/STMicroelectronics/st-mems-ispu).
For information on the supported hardware and how to set it up, refer to the readme file of the firmware.
Note that the firmware may be flashed only once (instead of every time a validation on target needs to be performed), as it automatically adapts to the model under validation.
Validation template (Optional)
The template for validating on target (that is, on the ISPU) the code generated by ST Edge AI Core can be obtained from ST’s GitHub repository for ISPU: https://github.com/STMicroelectronics/st-mems-ispu.
The ispu folder of the template may be copied by itself (no dependencies other than the CLI toolchain or IDE environment that must be installed) and used to build the application running the model on the ISPU to perform the validation.
For how to setup the development environment for ISPU, refer to the GitHub repository linked above.
Model implementation generation and build (Optional)
The validation template project is structured so that ST Edge AI Core can automatically populate it with the necessary files in the right places. In order to achieve that, run the following command:
stedgeai generate --target ispu --no-workspace --no-report -m <nn_model_file> --output <ispu_folder>
where nn_model_file
is the file containing the model
of the neural network to convert and ispu_folder
is a
copy of the ispu folder of the template. Of course,
additional options can be added to the generate
command
above as needed.
Alternatively, MEMS
Studio’s ISPU Model Converter can be used to generate the
network code, specifying ispu_folder
as the output
directory. ST
Edge AI Developer Cloud can also be used to generate and
download the converted code.
The validation application can then be built just like any other ISPU project using the Makefile or the Eclipse project. Note that no modification to the project source files is required.
Validation run
The validation on target can be performed by running the following command:
stedgeai validate --target ispu -m <nn_model_file> --mode target
where nn_model_file
is the file containing the model
of the neural network to validate. Of course, additional options can
be added to the validate
command above as needed.
Running the validation on target as shown above does not require the validation template or the steps of model implementation generation and build of the validation application, as they are all performed automatically by ST Edge AI Core. However, the ISPU toolchain must be installed for the command line as described in the README on the GitHub repository.
If the ISPU toolchain is not available for ST Edge AI Core to use automatically, follow the instructions included in this document to build the validation application starting from the validation template. Once it has been built, in order to perform the validation on target, run the following command:
stedgeai validate --target ispu -m <nn_model_file> --mode target --ispu-conf <path_to_ispu_conf>
where path_to_ispu_conf
is the path to the ISPU
configuration file just generated with the build of the validation
application. If additional options to modify the converted model
were specified in the generate
command, they should be
specified again here.
Note 1: By default, the ISPU configuration file is generated as ispu/make/bin/ispu.json if using the Makefile and as ispu/eclipse/release/ispu.json if using the Eclipse project.
Note 2: By default, the validation is performed with the ISPU clock configured at 5 MHz. To validate with the ISPU clock at 10 MHz, it is sufficient to modify the clock configuration in ispu/conf.txt.
Note 3: Instead of the ISPU configuration file in JSON format,
the equivalent UCF file can be used with the --ucf
option (deprecated).
In alternative to the command line approach, MEMS Studio’s ISPU Model Converter can be used to perform the validation on target, specifying the path to the ISPU configuration file. MEMS Studio can also be used to generate the ISPU configuration file if the ISPU toolchain is installed and is set as an external tool in MEMS Studio’s settings. ST Edge AI Developer Cloud can instead be used to perform the validation on target without requiring any board connected to the user’s PC or the installation of any tool.