【问题标题】:Tensorflow servingTensorFlow 服务
【发布时间】:2018-03-01 00:12:31
【问题描述】:

有人知道如何为 tensorflow 服务创建 C# 客户端吗?

我的 tensorflow 服务安装:

我使用 tensorflow serving dockerfile 安装了 tensorflow serving,然后在容器内我做了以下操作:

pip install tensorflow

pip install tensorflow-serving-api

echo "deb [arch=amd64] http://storage.googleapis.com/tensorflow-serving-apt stable tensorflow-model-server tensorflow-model-server-universal" | tee /etc/apt/sources.list.d/tensorflow-serving.list

curl https://storage.googleapis.com/tensorflow-serving-apt/tensorflow-serving.release.pub.gpg | apt-key add -
apt-get update && apt-get install tensorflow-model-server

然后我运行 tensorflow 服务服务器:

tensorflow_model_server --port=9000 --model_name=example_model --model_base_path=/serving/my_model_2 &> my_log &

其中 my_model_2 包含我要服务的导出 tensorflow 模型。

鉴于此信息,我有以下问题:

  • 我是否需要以不同的方式安装 tensorflow 服务才能创建 C# 客户端?如果我需要以不同的方式安装它;你能告诉我怎么做吗?
  • 您能否大致了解我必须做什么才能实现我的目标?我的意思是,我怀疑我必须以不同的方式安装我的 tf serving 才能创建一个明确的 .proto 文件。如果你能给我一个大概的想法和一个例子,我会有点迷茫,我会很感激的。

【问题讨论】:

    标签: c# python client grpc tensorflow-serving


    【解决方案1】:

    据我了解,您需要 proto 文件在 C# 中为 grpc 服务生成一个 tensorflow 服务客户端。

    https://github.com/Wertugo/TensorFlowServingCSharpClient 这是我正在关注的一个例子。它与 C# 客户端的 MNIST 示例相同。

    希望这会有所帮助。

    如果您有更好的选择,请在此处更新。

    【讨论】:

    • 如果可能的话,你能分享一下c#客户端吗?我仍在试图弄清楚如何实现 c# 客户端。任何帮助表示赞赏。
    • 您是如何将 proto 文件转换为 .cs 文件的?我试过 packages\Grpc.Tools.1.10.x\tools\windows_x86\protoc.exe -I/Docments/files/tensorflow_serving/apis --csharp_out services --grpc_out services /Documents/tensorflow_serving/apis/*.proto --plugin =protoc-gen-grpc=packages/Grpc.Tools.1.10.x/tools/windows_x86/grpc_csharp_plugin.exe 这是将.proto文件转换为.cs的方法吗?
    • 你不需要编译它们,@Wertugo 已经编译好了,它们在服务文件夹中(github.com/Wertugo/TensorFlowServingCSharpClient/tree/master/…)。你只需要使用它们。
    • 在我上面提到的文件夹中,您可以找到与从 C# 服务的 TensorFlow 进行通信所需的所有类。您可以再次编译它们,但不是必需的,所以我没有这样做。因此,我没有确切的命令。
    • util 文件夹是用图像数据创建消息的。如果你想实现一个不操纵图像的模型,那么你不需要 Util 的类,(他创建了这些类,他没有创建服务类(它们是编译 proto 文件的产物))但是你做需要所有服务的类。您不需要这些属性。给我积分!抱歉回复晚了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-07
    • 2019-02-16
    • 1970-01-01
    相关资源
    最近更新 更多