【问题标题】:How can I serve the Faster RCNN with Resnet 101 model with tensorflow serving如何使用带有 tensorflow 服务的 Resnet 101 模型为 Faster RCNN 提供服务
【发布时间】:2017-12-27 00:05:49
【问题描述】:

我正在尝试使用带有 tensorflow 服务的 Resnet 101 模型为 Faster RCNN 提供服务。

我知道我需要使用 tf.saved_model.builder.SavedModelBuilder 来导出模型定义以及变量,然后我需要一个类似 tensorflow_serving 提供的 inception_client.py 的脚本。

当我浏览示例、文档和实验时,我认为可能有人做过同样的事情。因此,如果您做过同样的事情或知道如何完成它,请提供帮助。提前致谢。

【问题讨论】:

    标签: object-detection tensorflow-serving


    【解决方案1】:

    Tensorflow 对象检测 API 有自己的导出器脚本,它比 Tensorflow Serving 下的过时示例更复杂。

    在构建 Tensorflow Serving 时,确保拉取 tensorflow/tensorflow (>r1.2) 和 tensorflow/models 的最新主提交

    为 GPU 构建 TensorFlow Serving

    bazel build -c opt --config=cuda tensorflow_serving/...

    如果您遇到有关 crosstool 和 nccl 的错误,请遵循以下解决方案 https://github.com/tensorflow/serving/issues/186#issuecomment-251152755 https://github.com/tensorflow/serving/issues/327#issuecomment-305771708

    用法

    python tf_models/object_detection/export_inference_graph.py \ --pipeline_config_path=/path/to/ssd_inception_v2.config \ --trained_checkpoint_prefix=/path/to/trained/checkpoint/model.ckpt \ --output_directory /path/to/output/1 \ --export_as_saved_model \ --input_type=image_tensor

    请注意,在导出期间,所有变量都会转换为常量并烘焙到 protobuf 二进制文件中。如果您在 saved_model/variables 目录下没有找到任何文件,请不要惊慌

    要启动服务器,

    bazel-bin/tensorflow_serving/model_servers/tensorflow_model_server --port=9000 --model_name=inception_v2 --model_base_path=/path/to/output --enable_batching=true

    对于客户端,Tensorflow Serving 下的示例运行良好

    【讨论】:

    • 我已经按照 tensorflow 服务示例和对象检测 api jupyter notebook 中的代码编写了一个导出脚本,但是您的答案是更好的选择。
    • 我正在写一个合适的 pipeline_config 文件,你知道怎么写吗,在哪里可以找到示例?
    • 您可以在 tensorflow here 下找到所有可用对象检测模型的模板管道配置文件
    猜你喜欢
    • 2018-09-12
    • 2021-05-19
    • 2019-04-21
    • 1970-01-01
    • 2019-12-08
    • 2016-09-11
    • 2016-07-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多