Serving: Export and run inference on modified InceptionV3 trained model

Created on 8 Feb 2017  Â·  4Comments  Â·  Source: tensorflow/serving

Gone thru https://tensorflow.github.io/serving/serving_basic and was able to run inference MNIST example using Tensorflow Serving server.

Now, I would like to use a trained modified InceptionV3 model (which has 2 files: .pb and .txt) to export and use it for inference.

Serving Basic tutorial use mnist_saved_model.py for training and exporting the model. Is this file to be modified for the trained modified InceptionV3 model? Also, what is the difference between mnist_saved_model.py and mnist_export.py?

Most helpful comment

SYNSET_FILE and METADATA_FILE are both used to generate labels for the selected classes, e.g., 1000 classes in inception example. SYNSET_FILE indicates which classes are selected and METADATA_FILE keeps all valid class names.

The result of labels will be put in a constant list as a dictionary, i.e., class_tensor = tf.constant(class_descriptions), to create the classes tensor which convert index to class name.
In other words, custom labels can be directly put into class_descriptions for exporting a revised inception model.

There is no "labels" for mnist example because it directly output all scores (0 to 9) without class names.

All 4 comments

On Wed, Feb 8, 2017 at 9:06 AM, sskgit notifications@github.com wrote:

Gone thru https://tensorflow.github.io/serving/serving_basic and was able
to run inference MNIST example using Tensorflow Serving server.

Now, I would like to use a trained modified InceptionV3 model (which has 2
files: .pb and .txt) to export and use it for inference.

Serving Basic tutorial use mnist_saved_model.py for training and exporting
the model. Is this file to be modified for the trained modified InceptionV3
model? Also, what is the difference between mnist_saved_model.py and
mnist_export.py?

mnist_export.py outputs the export in SessionBundle format (which will be
deprecated soon), and mnist_saved_model.py outputs the export in SavedModel
format (the new format). mnist_client.py only works with SavedModel.

You can follow mnist_saved_model.py to use saved model builder to create
the SavedModel export and use it for inference.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/tensorflow/serving/issues/313, or mute the thread
https://github.com/notifications/unsubscribe-auth/AVjoBUZRw09mRXCSgAzKgQaCHJU70wg3ks5rafYrgaJpZM4L7FzW
.

Hi @sskgit , in addition to @lilao's note, you can also check out https://tensorflow.github.io/serving/serving_inception related to serving the Inception model.

Thanks @lilao for the clarification.
@sukritiramesh - I already have a working inception inference based on the example in https://tensorflow.github.io/serving/serving_inception.

My question is related to using a modified InceptionV3 model for inference.

Looking at both, inception_saved_model.py and mnist_saved_model.py. Approaches are slightly different between the 2 as one is based on the checkpoint and other is not.

What is the purpose of the metadata_file (imagenet_metadata.txt) and synset_file (imagenet_lsvrc_2015_synsets.txt) in inception_saved_model.py? Which one is used for labels? And what is the equivalent of the label file in mnist_saved_model?

SYNSET_FILE and METADATA_FILE are both used to generate labels for the selected classes, e.g., 1000 classes in inception example. SYNSET_FILE indicates which classes are selected and METADATA_FILE keeps all valid class names.

The result of labels will be put in a constant list as a dictionary, i.e., class_tensor = tf.constant(class_descriptions), to create the classes tensor which convert index to class name.
In other words, custom labels can be directly put into class_descriptions for exporting a revised inception model.

There is no "labels" for mnist example because it directly output all scores (0 to 9) without class names.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dylanrandle picture dylanrandle  Â·  3Comments

marcoadurno picture marcoadurno  Â·  3Comments

rsk-07 picture rsk-07  Â·  3Comments

cchung100m picture cchung100m  Â·  4Comments

prateekgupta11 picture prateekgupta11  Â·  4Comments