SaikiranKannaiah436 / keras-to-tensorflow

A tutorial on running Keras models in Tensorflow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keras to Tensorflow Tutorial

So you’ve built an awesome machine learning model in Keras and now you want to run it natively thru Tensorflow. This tutorial will show you how.

Keras is a wonderful high level framework for building machine learning models. It is able to utilize multiple backends such as Tensorflow or Theano to do so. When a keras model is saved via the .save method, the canonical save method serializes to an HDF5 format. Tensorflow works with Protocol Buffers, and therefore loads and saves .pb files. This tutorial demonstrates how to:

  • build a SIMPLE Convolutional Neural Network in Keras for image classification
  • save the Keras model as an HDF5 model
  • verify the Keras model
  • convert the HDF5 model to a Protocol Buffer
  • build a Tensorflow C++ shared library
  • utilize the .pb in a pure Tensorflow app
    • We will utilize Tensorflow's own example code for this

Assumptions

  • You are familiar with Python (and C++ if you're interested in the C++ portion of this tutorial)
  • You are familiar with Keras and Tensorflow and already have your dev environment setup
  • Example code is utilizing Python 3.5, if you are using 2.7 you may have to make modifications

The full tutorial can be read here: http://www.bitbionic.com/2017/08/18/run-your-keras-models-in-c-tensorflow/

About

A tutorial on running Keras models in Tensorflow

License:MIT License


Languages

Language:Python 55.3%Language:C++ 42.7%Language:QMake 1.0%Language:Shell 1.0%