# Imagimob Commandline Tool for IAR Embedded Workbench Sample Project

# Overview

Before doing the steps in this guide make sure that you have installed Imagimob Studio.

This guide will show you how to setup Imagimob Commandline Tool inside IAR Embedded Workbench which can automaticly compile TensorFlow .h5 files into .c and .h files. This is done by first installing the Imagimob Commandline Tool and then use the Custom Build options inside IAR Embedded Workbench. Read more about compatibility here.

# Example Project

Here is a pre-configured example project that can be loaded in IAR Embedded Workbench.

Click to download example project (opens new window)

# Setup Imagimob Commandline Tool for IAR Embedded Workbench Project

To setup the Imagimob Commandline Tool for new or existing projects follow this guide.

  1. Go to Project → Options → Custom Build
  2. Add this under Filename extensions: .h5
  3. Add this line under Command Line: imc $FILE_PATH$ -oc $FILE_BNAME$.c -oh $FILE_BNAME$.h
  4. Add these lines under Output Files: $FILE_BNAME$.c $FILE_BNAME$.h

  1. Add the .h5 file that you want to convert to the project.
  2. Make project (make sure that the project contains a file named main.c)
  3. The generated .c and .h files can now be found in the Files window under model.h5 → Output.

# Requirements

The Imagimob Commandline Tool is compatible with Tensorflow/Keras .h5 models generated with a Tensorflow backend of version 2.x. Models containing unsupported layers will fail to convert. See supported layers and activation functions below.

# Supported TensorFlow layers

  • Max pooling 1D (TensorFlow Class MaxPooling1D)
  • Convolution 1D (TensorFlow Class Conv1D)
  • Long Short-Term Memory (TensorFlow Class LSTM)
  • Dense (TensorFlow Class Dense)
  • Batch Normalization (TensorFlow Class BatchNormalization)
  • Time Distributed (TensorFlow Class TimeDistributed)
  • Global average pooling 1D (TensorFlow Class GlobalAveragePooling1D)
  • Gated Recurrent Unit (TensorFlow Class GRU)
  • Flatten (TensorFlow Class Flatten)
  • Dropout (TensorFlow Class Dropout)
  • Reshape (TensorFlow Class Reshape)
  • Activation (TensorFlow Class Activation)

# Supported TensorFlow activation functions

  • LeakyReLU (TensorFlow Class LeakyReLU)
  • ReLU (TensorFlow Class ReLU)
  • Sigmoid
  • Hard Sigmoid
  • Tanh
  • Softmax

# Supported Imagimob layers and functions

  • Assert Array
  • Clear
  • Copy
  • Discrete Cosine Transform
  • Addition
  • Argmax
  • Division
  • Dot product transpose
  • Hann smoothing
  • Multiplication
  • Frobenius norm
  • Product
  • Real Discrete Fourier Transform
  • Average Subtract
  • Sum
  • Power to Decibel
  • Average
  • Subtraction
  • Add an extra dimension of size 1
  • Complex Discrete Fourier Transform
  • Max
  • FFT Shift
  • Subtraction Immediate Reverse (A-x)
  • Logarithm
  • Mel Filterbank
  • Power
  • Sliding Window

# Support

If you have problems converting a Tensorflow/Keras .h5 model generated with a TensorFlow 2.x backend, or have requests for improvements or additional support, please contact us at support@imagimob.com.