Image
Toshiyuki Syo
Toshiyuki Syo
Principal Application Engineer
Published: June 12, 2023

What is e-AI Translator?

A tool that converts learned AI algorithms created using an open-source AI framework into C source code dedicated to inference. The latest version of this e-AI Translator V3.0.0 was released on May 10, 2023.

In this blog, I will introduce the 3D shape function and RNN function that are newly supported in V3.0.0. In addition, since the operating environment of the e-AI Translator has been changed, I will also introduce the accompanying notes. This content can be used in the RA Family and RX Family.

3D shape function support

The previous e-AI Translator did not support 3D shape functions, so we recommended using 4D shape functions instead.

  • Build a model with 3D shape (N,C,D) as 4D shape (N,C,D,1)

This release supports 3D shape functions that are often used in Keras/TensorFlow(tf-keras)/PyTorch.
TFLite is not supported in this release due to its limited support for 3D shapes. When using a TFLite model, continue to use 4D shape for the Keras/TensorFlow model, which is the source of TFLite conversion.

Major support functions other than the Convolution function (Pooling function and Shape conversion function) also support 3D shapes.

The PyTorch model is converted to ONNX format inside the e-AI Translator. Therefore, there are some restrictions on the shape conversion function.

  • Convert to 2D Shape: use Flatten or View function (do not use Reshape function).
  • Conversion to 3D, 4D shape: use Reshape or View function (do not use Flatten function).

Table 1. New support function (3D shape)

Image
New support function (3D shape)

RNN function support

In response to requests for use with MCU systems, this version supports it.

  • Supports Keras/TensorFlow(tf-keras)/PyTorch RNN functions.
  • TFLite is not supported.

In addition, models with multiple inputs and outputs are often used in RNN models, but they are not currently supported.

Table 2. Newly supported RNN functions

Image
Newly supported RNN functions

Corresponding version of the AI framework

Up to e-AI Translator V2.3.0, it only supported the conversion of models created with the same AI framework version as the e-AI Translator execution environment. In this release version, it is possible to convert models created with the same AI framework version as the execution environment of V2.3.0. Models created in previous versions can be reused without retraining. Please see the table below for details.

Table 3. AI Framework Versions of Translatable Models

Image
AI Framework Versions of Translatable Models

(For TFLite, it corresponds to the model quantized by the above Keras/TensorFlow Converter API)

However, there are the following restrictions.

  • Models that use Lambda functions in Keras/tf-keras cannot be converted.
    Keras V2.4 was able to load models built using Lambda functions without the user having to specify the function name. On the other hand, in Keras V2.9, the model cannot be loaded unless the user specifies the Lambda function name.
    Since e-AI Translator V3.0.0 cannot specify the Lambda function by the user, the model cannot be loaded, and an error occurs. (eAI-310: Unable to load the model file. This may be due to the Python version mismatch or the model contains a User-defined layer.)
    If you need to convert, please contact us. We offer e-AI Translator V2.3.0.
  • The inference results in the e-AI Translator V2.3.0 environment, and the inference results in the MCU of the model converted in the e-AI Translator V3.0.0 environment may differ.
    Since the Python version has been updated, the Python standard library has also been updated.

For example, Pillow, which is a standard library for Python images, has a different default algorithm for image scaling. When comparing the inference results of the PC and the inference results of the MCU, perform inference on the PC in the e-AI Translator V3.0.0 environment and compare the results.

Tool download link

Previous blogs

e-AI webpage

Share this news on