jgoenetxea
5/31/2018 - 8:05 AM

From tensorflow frozen model to tensorflow lite

This script uses TOCO to transform a frozen tensorflow model to tensorflow-lite compilant model. The example is used to transform a model with the next features:

  • name: frozen_model
  • input: input_image
  • outputs: landmarks, gender, smile, glasses, head_pose
  • Image size: 1x100x100x3 floating point (in 0-1 value range)
  • output elements: ** landmarks: 136 float ** gender: 2 float ** smile: 2 float ** glasses: 2 float ** head_pose: 5 float
toco \
  --input_file=frozen_model.pb \
  --output_file=frozen_model.lite \
  --input_format=TENSORFLOW_GRAPHDEF \
  --output_format=TFLITE \
  --input_shape=1,100,100,3 \
  --input_array=input_image \
  --output_arrays=landmarks,gender,smile,glasses,head_pose \
  --inference_type=FLOAT \
  --input_data_type=FLOAT