インセプション モデル用にセットアップされたサービス提供ツールを使用して、再トレーニングされたインセプション モデルをセットアップしようとしています。ここのチュートリアルに従っています。再トレーニングされたモデルを使用してサーバーをセットアップすることができました。エクスポートするために、retrain.py ファイルの末尾に次のコードを追加しました。
export_path = "/tmp/export"
export_version = "1"
# Export inference model.
init_op = tf.group(tf.initialize_all_tables(), name='init_op')
saver = tf.train.Saver(sharded=True)
model_exporter = exporter.Exporter(saver)
signature = exporter.classification_signature(input_tensor=jpeg_data_tensor, scores_tensor=final_tensor)
model_exporter.init(sess.graph.as_graph_def(), default_graph_signature=signature)
model_exporter.export(FLAGS.export_dir, tf.constant(export_version), sess)
print('Successfully exported model to %s' % export_path)
今のところ4クラスしかありません。Tensorflow ツール (Serving なし) を使用してモデルを作成しました。モデルがテスト イメージで動作することを確認できました。今、私はそれを提供しようとしています。次のコマンドを使用して、モデルにサーバーをセットアップしました。
bazel-bin/tensorflow_serving/example/inception_inference --port=9000 /tmp/export/ &> retrain.log &
最後の2行を連続して印刷すると、次の出力が得られます。
I tensorflow_serving/core/basic_manager.cc:189] Using InlineExecutor for BasicManager.
I tensorflow_serving/example/inception_inference.cc:383] Waiting for models to be loaded...
I tensorflow_serving/sources/storage_path/file_system_storage_path_source.cc:147] Aspiring version for servable default from path: /tmp/exportdir/00000001
I tensorflow_serving/session_bundle/session_bundle.cc:130] Attempting to load a SessionBundle from: /tmp/exportdir/00000001
I tensorflow_serving/session_bundle/session_bundle.cc:107] Running restore op for SessionBundle
I tensorflow_serving/session_bundle/session_bundle.cc:184] Done loading SessionBundle
I tensorflow_serving/sources/storage_path/file_system_storage_path_source.cc:147] Aspiring version for servable default from path: /tmp/exportdir/00000001
I tensorflow_serving/example/inception_inference.cc:349] Running...
I tensorflow_serving/sources/storage_path/file_system_storage_path_source.cc:147] Aspiring version for servable default from path: /tmp/exportdir/00000001
I tensorflow_serving/sources/storage_path/file_system_storage_path_source.cc:147] Aspiring version for servable default from path: /tmp/exportdir/00000001
これをテストするためにインセプションに python クライアントを使用しようとすると、次のエラーが発生し、出力が見つからないように見えます。
vagrant@ubuntu:~/serving$ bazel-bin/tensorflow_serving/example/inception_client --image=/home/vagrant/AE.JPG
Traceback (most recent call last):
File "/home/vagrant/serving/bazel bin/tensorflow_serving/example/inception_client.runfiles/tf_serving/tensorflow_serving/example/inception_client.py", line 57, in <module>
tf.app.run()
File "/home/vagrant/serving/bazel-bin/tensorflow_serving/example/inception_client.runfiles/tf/tensorflow/python/platform/app.py", line 30, in run
sys.exit(main(sys.argv))
File "/home/vagrant/serving/bazel-bin/tensorflow_serving/example/inception_client.runfiles/tf_serving/tensorflow_serving/example/inception_client.py", line 51, in main
result = stub.Classify(request, 5.0) # 10 secs timeout
File "/usr/local/lib/python2.7/dist-packages/grpc/framework/crust/implementations.py", line 75, in __call__
protocol_options, metadata, request)
File "/usr/local/lib/python2.7/dist-packages/grpc/framework/crust/_calls.py", line 109, in blocking_unary_unary
return next(rendezvous)
File "/usr/local/lib/python2.7/dist-packages/grpc/framework/crust/_control.py", line 415, in next
raise self._termination.abortion_error
grpc.framework.interfaces.face.face.NetworkError: NetworkError(code=StatusCode.INTERNAL, details="FetchOutputs node : not found")
誰かがこれを案内してくれますか?実際のプロジェクトで Tensorflow を使用するのはこれが初めてです。