How can I run my keras model on android devices?
I've created a model for classification task and want to know how to run it on mobile devices. I need a real time or fast model for mobiles.
I've created a model for classification task and want to know how to run it on mobile devices. I need a real time or fast model for mobiles.
Or you can use tensorflow lite, which is made just for mobile devices.
It has a lot of optimization tools, and many other functions for android and iphone mobiles.
You gonna need to convert your keras h5 model to tensorflow pb anyway, cause tensorflow lite comes from tensorflow graph or tensorflow pb file. After converting into tensorflow graph, you just need to call
tflite_convert \
--output_file=/tmp/foo.tflite \
--graph_def_file=/tmp/frozen_graph.pb \
--input_arrays=input \
--output_arrays=output
Command to convert it to tflite.
There are couple of discussions about tensorflow lite here.
You have to do it with tensorflow. You can convert your keras h5 model to tensorflow pb and run it on android or iphone devices.
First you need to freeze your keras model, which is actualy a tensorflow graph, then convert it to pb file.
Here is a discussion on how to convert keras h5 model into tensorflow pb.