tensorflow - Serving the inception model v3 in Java using SavedModelBundle -
using org.tensorflow:tensorflow:1.3.0-rc0.
i have generated inception model checkpoints per tutorial https://tensorflow.github.io/serving/serving_inception:
inception_saved_model --checkpoint_dir=/root/xmod/inception-v3
this went ok , generated saved_model.pb , variables/ subdirectory data , moved content /tmp/inception-model directory. i'm trying use model converting https://github.com/tensorflow/tensorflow/blob/master/tensorflow/java/src/main/java/org/tensorflow/examples/labelimage.java loading model no errors:
savedmodelbundle modelbundle = savedmodelbundle.load("/tmp/inception-model", "serve");
now trying formulate query (similar https://github.com/tensorflow/tensorflow/blob/master/tensorflow/java/src/main/java/org/tensorflow/examples/labelimage.java#l112) i'm stuck trying figure out how use feed , fetch methods:
private static float[] executeinceptiongraph(savedmodelbundle modelbundle, tensor image) throws exception { tensor result = modelbundle.session().runner().feed(???).fetch(???).run().get(0);
any how write query appreciated.
you need feed input (here tensor image) associated name of node in graph, link posted seems tutorial uses "images" (see here https://github.com/tensorflow/serving/blob/master/tensorflow_serving/example/inception_client.py#l49, code python query server built in tutorial https://tensorflow.github.io/serving/serving_inception). fetch output node name too, looking @ sample of server response here https://tensorflow.github.io/serving/serving_inception can "classes" or "scores" depending 1 you'd have.
so 1 of 2 command should work:
tensor result = modelbundle.session().runner().feed("images", image).fetch("classes").run().get(0);
or
tensor result = modelbundle.session().runner().feed("images", image).fetch("scores").run().get(0);
Comments
Post a Comment