Tensorflow lite model is giving wrong output

岁酱吖の 提交于 2019-12-06 14:32:09

Finally i found a solution by converting keras model to frozen graph with this code snippet. I copied this python file tensorflow Scripts folder. And copy keras model file to same folder. And create a folder called "frozen". Then run this command

py cerasconvert.py keras_model.h5 frozen/ freeze_graph

I converted newly created .pb file to tflite format

import tensorflow as tf
import numpy as np

graph_def_file = "frozen/frozen.pb"
input_arrays = ["dense_1_input_1"]
output_arrays = ["dense_3_1/BiasAdd"]

converter = tf.contrib.lite.TocoConverter.from_frozen_graph(
graph_def_file, input_arrays, output_arrays)
tflite_model = converter.convert()
open("frozen/converted.tflite", "wb").write(tflite_model)

now my tflite model prediction accuracy is very high.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!