Fixing errors with transformed models

Normally, you can use a tool called strip_unused.py, located at the same location as freeze_graph.py at tensorflow/python/tools, to remove the DecodeJpeg operation that is not included in the TensorFlow core library (see https://www.tensorflow.org/mobile/prepare_models#removing_training-only_nodes for more details), but since the input node image_feed requires the decode operation (Figure 6.2), a tool such as strip_unused won't treat the DecodeJpeg as unused so it won't be stripped. You can verify this by first running the strip_unused command as follows:

bazel-bin/tensorflow/python/tools/strip_unused --input_graph=/tmp/image2text_frozen.pb --output_graph=/tmp/image2text_frozen_stripped.pb --input_node_names="image_feed,input_feed,lstm/state_feed" ...

Get Intelligent Mobile Projects with TensorFlow now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.