在tensorflow中使用预训练的resent模型进行对象检测时出错
Error using the pre-trained resent model for object detection in tensorflow
我从预训练的 resnet50 模型创建了一个保存的模型,用于使用 tensorflow 服务模块进行服务。但是当我尝试 运行 模型服务器时,我得到了这个错误:
2018-03-23 13:36:37.130839: E external/org_tensorflow/tensorflow/core/common_runtime/executor.cc:651] Executor failed to create kernel. Invalid argument: NodeDef mentions attr 'dilations' not in Op output:T; attr=T:type,allowed=[DT_HALF, DT_FLOAT]; attr=strides:list(int); attr=use_cudnn_on_gpu:bool,default=true; attr=padding:string,allowed=["SAME", "VALID"];
attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW"]>; NodeDef: FirstStageFeatureExtractor/resnet_v1_50/resnet_v1_50/conv1/Conv2D = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="VALID", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](FirstStageFeatureExtractor/resnet_v1_50/resnet_v1_50/Pad, FirstStageFeatureExtractor/resnet_v1_50/conv1/weights/read). (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).
[[Node: FirstStageFeatureExtractor/resnet_v1_50/resnet_v1_50/conv1/Conv2D = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="VALID", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](FirstStageFeatureExtractor/resnet_v1_50/resnet_v1_50/Pad, FirstStageFeatureExtractor/resnet_v1_50/conv1/weights/read)]]
好吧,它告诉你出了什么问题,尽管在所有细节下可能很难看清:
"Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary"
您似乎使用的是最新版本的 TensorFlow,它向 Conv2D 添加了一个 "dilations" 参数。
tensorflow_model_server 中的 TensorFlow 版本比那个版本旧,因此不知道如何实例化该运算符。
要么尝试在足够旧的 TensorFlow 版本上重建模型,要么尝试使用更新的 TensorFlow 版本创建 tensorflow_model_server。
在当前的 TensorFlow Serving 池中,这可以通过
轻松完成
bazel build --action_env TF_REVISION="{git hash}" //tensorflow_serving/model_servers:tensorflow_model_server
详情见https://github.com/tensorflow/serving/commit/f9e602c753ef82ff96b28429dd07e900f10eb007
我从预训练的 resnet50 模型创建了一个保存的模型,用于使用 tensorflow 服务模块进行服务。但是当我尝试 运行 模型服务器时,我得到了这个错误:
2018-03-23 13:36:37.130839: E external/org_tensorflow/tensorflow/core/common_runtime/executor.cc:651] Executor failed to create kernel. Invalid argument: NodeDef mentions attr 'dilations' not in Op output:T; attr=T:type,allowed=[DT_HALF, DT_FLOAT]; attr=strides:list(int); attr=use_cudnn_on_gpu:bool,default=true; attr=padding:string,allowed=["SAME", "VALID"]; attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW"]>; NodeDef: FirstStageFeatureExtractor/resnet_v1_50/resnet_v1_50/conv1/Conv2D = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="VALID", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](FirstStageFeatureExtractor/resnet_v1_50/resnet_v1_50/Pad, FirstStageFeatureExtractor/resnet_v1_50/conv1/weights/read). (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.). [[Node: FirstStageFeatureExtractor/resnet_v1_50/resnet_v1_50/conv1/Conv2D = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="VALID", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](FirstStageFeatureExtractor/resnet_v1_50/resnet_v1_50/Pad, FirstStageFeatureExtractor/resnet_v1_50/conv1/weights/read)]]
好吧,它告诉你出了什么问题,尽管在所有细节下可能很难看清:
"Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary"
您似乎使用的是最新版本的 TensorFlow,它向 Conv2D 添加了一个 "dilations" 参数。
tensorflow_model_server 中的 TensorFlow 版本比那个版本旧,因此不知道如何实例化该运算符。
要么尝试在足够旧的 TensorFlow 版本上重建模型,要么尝试使用更新的 TensorFlow 版本创建 tensorflow_model_server。
在当前的 TensorFlow Serving 池中,这可以通过
轻松完成bazel build --action_env TF_REVISION="{git hash}" //tensorflow_serving/model_servers:tensorflow_model_server
详情见https://github.com/tensorflow/serving/commit/f9e602c753ef82ff96b28429dd07e900f10eb007