# Tensorflow Edge Optimization

# Background

We have a model in a HDF5 format (.h5) used by deep learning frameworks such as Keras and Tensorflow and it's now time to turn this model into optimized C-code that can be deployed on an Edge device such as a small PCB (Printed Circuit Board) with a Microcontroller (MCU) and an accelerometer sensor.

# New Edge Project

Open the .h5 file that has already been trained using tensorflow and go to the Edge tab.

In the Architecture field we can chose to optimize our Edge model (C-code) for different target architectures.

The two fields Output Directory and C Prefix control the output directory and the generated C API for the generated Edge model. Let's leave both these fields as shown above.

# Timestamps API

This API allows us to track the time of when the input data for a prediction/classification was input to the model.

# Generate Tests

We will leave the box for 'Generate Data Compare Test' as it is. Because we are using a tensorflow model we are not able to use this test.

# Build Edge

Now we are ready to Build the Edge model.

Click on "Build Edge" at bottom.

In a matter of seconds the Edge model has been generated and a report is generated for us. Here we can see how much memory this model will use when deployed on a device.

Let's click "OK".

Now we have finished converting our tensorflow model into a Edge model that consumes a fraction of the memory/processing power during runtime and can run on any embedded platform!

Back to the start page