Model Conversion

Steps required to perform the conversion between multiple models formats

Tensorflow to ONNX

  • install tf2onnx:
pip3 install -U tf2onnx
  • convert Tensorflow savedmodel to ONNX:
    change the current working directory to the one that contains the saved_model.pb file, for example:
cd /home/user/saved_model_tensorflow

perform the conversion:

python3 -m tf2onnx.convert --inputs-as-nchw sequential_1_input:0 --saved-model ./ --output ./converted_model.onnx

Note: Our inference engine expects the input data in NCHW format (N: batch_size, C: channel, H: height, W: width), so its required change the default input format of Tensorflow (NHWC) to this using the --inputs-as-nchw argument followed by the input layer name, which on the above example is sequential_1_input:0.

A file named converted_model.onnx will be created on the same folder, that's the one you should upload as weights file to update your model in Lumeo console.

In the page AI Models we share the steps required to add your model to the Lumeo platform.

Did this page help you?