serving icon indicating copy to clipboard operation
serving copied to clipboard

Export and run inference on modified InceptionV3 trained model

Open sskgit opened this issue 9 years ago • 4 comments

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?

sskgit avatar Feb 08 '17 17:02 sskgit

On Wed, Feb 8, 2017 at 9:06 AM, sskgit [email protected] 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 .

lilao avatar Feb 09 '17 17:02 lilao

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.

sukritiramesh avatar Feb 09 '17 17:02 sukritiramesh

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?

sskgit avatar Feb 13 '17 20:02 sskgit

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.

moonite avatar Mar 08 '17 02:03 moonite