Surya Sharma

Machine Learning Applications | Computer Vision | This website may be my recipe book.

Using a KERAS MODEL FOR INFERENCE IN C

For my research we have a family of programs implemented in plain C (Win32 API) that help us visualize and analyze our datasets. Something we’d like to be able to do is be able to use pre-trained Keras / Tensorflow models in these C programs to make predictions.

The video below shows a screen capture of the C program. The program shows sensor data (Y axis) vs time (X axis). The custom software is capable of playing through data like using VCR controls, and switch between data of various types.

In this program, blue vertical lines indicate ground truth labels of eating activities, while blue blocks under the signal denote periods detected as eating by the classifiers.

While porting all the code to Python is an option, these tools have years of effort and design put in them (see video above), and re-writing to python is an enormous effort.

This series of posts will show you how to:

  1. Freeze a Keras Model to a Tensorflow graph (python)
  2. Use the Tensorflow graph to make predictions in python
  3. Setup Tensorflow (libtensorflow) dll’s to work in a Visual Studio project on Windows.
  4. Use the Tensorflow graph to make predictions in (plain) C using Visual Studio.

Next Post

Previous Post

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2024 Surya Sharma

Theme by Anders Norén