PaddleDetection export得到的模型部署后出现ShapeError
Created by: omtbreak
前提条件
条件1
在PaddleDetection训练得到的模型权重,由提供的export工具,将其转换得到serving_server、serving_client等文件
serving_server 中的serving_server_conf.prototxt
serving_client中的serving_client_conf.prototxt
条件2
同时已跑通部署示例,此示例是Paddle开发人员训练的cascade rcnn模型,并提供了serving_server和serving_client等文件,在服务器开启服务后,使用rpc方式调用
问题
在跑通示例后,将我们训练的条件1中的模型,在服务器上开启了部署,本地客户端代码未更改,重新运行得到ShapeError
--------------------------------------------
C++ Call Stacks (More useful to developers):
--------------------------------------------
------------------------------------------
Python Call Stacks (More useful to users):
------------------------------------------
File "/home/chenbaicheng/.local/lib/python3.6/site-packages/paddle/fluid/framework.py", line 2525, in append_op
attrs=kwargs.get("attrs", None))
File "/home/chenbaicheng/.local/lib/python3.6/site-packages/paddle/fluid/layer_helper.py", line 43, in append_op
return self.main_program.current_block().append_op(*args, **kwargs)
File "/home/chenbaicheng/.local/lib/python3.6/site-packages/paddle/fluid/layers/nn.py", line 1405, in conv2d
"data_format": data_format,
File "/home/chenbaicheng/PaddleDetection/ppdet/modeling/backbones/resnet.py", line 162, in _conv_norm
name=_name + '.conv2d.output.1')
File "/home/chenbaicheng/PaddleDetection/ppdet/modeling/backbones/resnet.py", line 430, in c1_stage
name=_name)
File "/home/chenbaicheng/PaddleDetection/ppdet/modeling/backbones/resnet.py", line 451, in __call__
res = self.c1_stage(res)
File "/home/chenbaicheng/PaddleDetection/ppdet/modeling/architectures/cascade_rcnn.py", line 98, in build
body_feats = self.backbone(im)
File "/home/chenbaicheng/PaddleDetection/ppdet/modeling/architectures/cascade_rcnn.py", line 336, in test
return self.build(feed_vars, 'test')
File "tools/export_serving_model.py", line 190, in main
test_fetches = model.test(feed_vars)
File "tools/export_serving_model.py", line 209, in <module>
main()
----------------------
Error Message Summary:
----------------------
Error: ShapeError: the input of Op(conv) should be 4-D or 5-D Tensor. But received: 2-D Tensor, the shape of input is [1, 3].
[Hint: Expected in_dims.size() == 4 || in_dims.size() == 5 == true, but received in_dims.size() == 4 || in_dims.size() == 5:0 != true:1.] at (/paddle/paddle/fluid/operators/conv_op.cc:61)
[operator < conv2d > error]