Transforming and optimizing the image captioning model
If you really can't wait any longer and decide to try the freshly frozen hot model on your iOS or Android app now, you certainly can, but you'll be shown a fatal error, No OpKernel was registered to support Op 'DecodeJpeg' with these attrs
, to force you to reconsider your decision.
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...