cancel
Showing results for 
Search instead for 
Did you mean: 

Commandline tool for converting models with X-CUBE-AI

JNord
Associate II

Hi,

I made a small Python script that allows to convert models from the commandline. Wraps the same tools used by STM32CubeMX but can be integrated into build scripts and similar, without having to go through the GUI.

It also outputs the resources used (RAM,FLASH,CPU) . There are options for the compression settings, see `--help` for details.

Tested with Keras on Linux, but should work on other platforms too.

Example usage:

$ XCUBEAI_VERSION=3.4.0 python3 stm32convert.py mobilenet.hdf5 ./out/
 
Wrote model to ./out/
Model status: {"maccs_frame": 1639034, "flash_usage": 31150.0, "ram_usage_max": 216820.0, "ram_usage_min": 216820.0}
 
$ ls -a out/
. .. config.ai network.c network_data.c network_data.h network.h   network.hdf5 network.json network.png

Hope this can be useful to others as well.

Regards, Jon Nordby

Machine Learning Engineer & Consultant

0 REPLIES 0