如何使用带有张量流服务的 Resnet 101 模型为 Faster RCNN 提供服务
How can I serve the Faster RCNN with Resnet 101 model with tensorflow serving
我正在尝试使用带有 tensorflow 服务的 Resnet 101 模型为 Faster RCNN 提供服务。
我知道我需要使用 tf.saved_model.builder.SavedModelBuilder 来导出模型定义和变量,然后我需要 tensorflow_serving 提供的类似 inception_client.py 的脚本。
当我浏览示例和文档并进行试验时,我认为有人可能做过同样的事情。因此,如果您做过同样的事情或知道如何完成,请提供帮助。提前致谢。
Tensorflow 对象检测 API 有自己的导出器脚本,比 Tensorflow Serving 下的过时示例更复杂。
在构建 Tensorflow Serving 时,确保拉取 tensorflow/tensorflow (>r1.2) 和 tensorflow/models
的最新主提交
为 GPU 构建 Tensorflow 服务
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 服务的 Resnet 101 模型为 Faster RCNN 提供服务。
我知道我需要使用 tf.saved_model.builder.SavedModelBuilder 来导出模型定义和变量,然后我需要 tensorflow_serving 提供的类似 inception_client.py 的脚本。
当我浏览示例和文档并进行试验时,我认为有人可能做过同样的事情。因此,如果您做过同样的事情或知道如何完成,请提供帮助。提前致谢。
Tensorflow 对象检测 API 有自己的导出器脚本,比 Tensorflow Serving 下的过时示例更复杂。
在构建 Tensorflow Serving 时,确保拉取 tensorflow/tensorflow (>r1.2) 和 tensorflow/models
的最新主提交为 GPU 构建 Tensorflow 服务
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下的例子效果不错