-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyError: 'multiclass_nms3_0.tmp_2.lod' #1635
Comments
Message that will be displayed on users' first issue |
您好,我看这边您应该是使用自己训练的模型对嘛?postprocess针对不同模型处理上并不一样,这边还需要自己去做一下模型的后处理工作。Paddle Serving提供的postprocess方法只针对,Paddle Serving示例代码,并不具有通用性。因此还需要开发者参照示例的postprocess进行一定的修改。除此之外,并不是每个模型都会返回lod信息,因此报错。 |
谢谢解决了,文档还是不够全面呀。希望能增加更多系列文档。 |
我也是使用的fasterrcnn,遇到同样的问题, |
使用自己训练的yolov3 feed_var {
name: "im_shape"
alias_name: "im_shape"
is_lod_tensor: false
feed_type: 1
shape: 2
}
feed_var {
name: "image"
alias_name: "image"
is_lod_tensor: false
feed_type: 1
shape: 3
shape: 608
shape: 608
}
feed_var {
name: "scale_factor"
alias_name: "scale_factor"
is_lod_tensor: false
feed_type: 1
shape: 2
}
fetch_var {
name: "multiclass_nms3_0.tmp_0"
alias_name: "multiclass_nms3_0.tmp_0"
is_lod_tensor: true
fetch_type: 1
shape: -1
}
fetch_var {
name: "multiclass_nms3_0.tmp_2"
alias_name: "multiclass_nms3_0.tmp_2"
is_lod_tensor: false
fetch_type: 2
} 遇见了同样的问题,想问一下是什么原因造成的? |
去年就遇到了此问题,当时搞定了,今年又遇到了,来查,看到答案想抽自己俩耳光,写一下具体解决办法。 class RCNNPostprocess(object):
|
其实就是官方写的后处理计算不能兼容lod数据和定长数据两种情况。我没有找到带lod数据的模型,不能完善代码,这只是应急处理,希望官方后续更新一下。 |
部署fasterrcnn模型时,预测出错
预测的代码
import sys
import numpy as np
from paddle_serving_client import Client
from paddle_serving_app.reader import *
import cv2
preprocess = DetectionSequential([
DetectionFile2Image(),
DetectionNormalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225], True),
DetectionResize(
(800, 1333), True, interpolation=cv2.INTER_LINEAR),
DetectionTranspose((2,0,1)),
DetectionPadStride(128)
])
postprocess = RCNNPostprocess("label_list.txt", "output")
client = Client()
client.load_client_config("serving_client/serving_client_conf.prototxt")
client.connect(['127.0.0.1:9292'])
im, im_info = preprocess(sys.argv[1])
fetch_map = client.predict(
feed={
"image": im,
"im_shape": np.array(list(im.shape[1:])).reshape(-1),
"scale_factor": im_info['scale_factor'],
},
#fetch=["save_infer_model/scale_0.tmp_1"],#multiclass_nms3_0.tmp_2
fetch=["multiclass_nms3_0.tmp_2"],
batch=False)
fetch_map["image"] = sys.argv[1]
postprocess(fetch_map)
serving_client_conf.prototxt:
feed_var {
name: "im_shape"
alias_name: "im_shape"
is_lod_tensor: false
feed_type: 1
shape: 2
}
feed_var {
name: "image"
alias_name: "image"
is_lod_tensor: false
feed_type: 1
shape: 3
}
feed_var {
name: "scale_factor"
alias_name: "scale_factor"
is_lod_tensor: false
feed_type: 1
shape: 2
}
fetch_var {
name: "concat_12.tmp_0"
alias_name: "concat_12.tmp_0"
is_lod_tensor: false
fetch_type: 1
shape: 6
}
fetch_var {
name: "multiclass_nms3_0.tmp_2"
alias_name: "multiclass_nms3_0.tmp_2"
is_lod_tensor: false
fetch_type: 2
}
client报错信息
Traceback (most recent call last):
File "test_client.py", line 47, in
postprocess(fetch_map)
File "/usr/local/lib/python3.6/site-packages/paddle_serving_app/reader/image_reader.py", line 427, in call
self.clsid2catid)
File "/usr/local/lib/python3.6/site-packages/paddle_serving_app/reader/image_reader.py", line 344, in _get_bbox_result
lod = [fetch_map[fetch_name + '.lod']]
KeyError: 'multiclass_nms3_0.tmp_2.lod'
server log:
W0216 10:07:18.747469 2563 infer.cpp:287] Succ reload version engine: 18446744073709551615
I0216 10:07:18.747480 2563 manager.h:131] Finish reload 1 workflow(s)
I0216 10:07:28.747581 2563 server.cpp:151] Begin reload framework...
W0216 10:07:28.747633 2563 infer.cpp:287] Succ reload version engine: 18446744073709551615
I0216 10:07:28.747643 2563 manager.h:131] Finish reload 1 workflow(s)
I0216 10:07:38.747742 2563 server.cpp:151] Begin reload framework...
W0216 10:07:38.747807 2563 infer.cpp:287] Succ reload version engine: 18446744073709551615
I0216 10:07:38.747819 2563 manager.h:131] Finish reload 1 workflow(s)
I0216 10:07:44.068684 2572 general_model_service.pb.cc:3319] (logid=0) remote_side=[127.0.0.1:46034]
I0216 10:07:44.068742 2572 general_model_service.pb.cc:3320] (logid=0) local_side=[127.0.0.1:9292]
I0216 10:07:44.068750 2572 general_model_service.pb.cc:3321] (logid=0) service_name=[GeneralModelService]
I0216 10:07:44.068750 2572 op_repository.h:68] RAW: Succ regist op: GeneralReaderOp
I0216 10:07:44.068750 2572 op_repository.h:68] RAW: Succ regist op: GeneralInferOp
I0216 10:07:44.068750 2572 op_repository.h:68] RAW: Succ regist op: GeneralResponseOp
I0216 10:07:44.079159 2572 op.cpp:164] (logid=0) general_reader_0_time=[10296]
I0216 10:07:44.326128 2572 op.cpp:164] (logid=0) general_infer_0_time=[246925]
I0216 10:07:44.326174 2572 op.cpp:164] (logid=0) general_response_0_time=[8]
I0216 10:07:44.326189 2572 service.cpp:263] (logid=0) workflow total time: 257421
I0216 10:07:44.326215 2572 general_model_service.pb.cc:3343] [serving]logid=0,cost=257.534ms.
I0216 10:07:48.747907 2563 server.cpp:151] Begin reload framework...
W0216 10:07:48.747962 2563 infer.cpp:287] Succ reload version engine: 18446744073709551615
I0216 10:07:48.747973 2563 manager.h:131] Finish reload 1 workflow(s)
I0216 10:07:58.748062 2563 server.cpp:151] Begin reload framework...
W0216 10:07:58.748112 2563 infer.cpp:287] Succ reload version engine: 18446744073709551615
I0216 10:07:58.748121 2563 manager.h:131] Finish reload 1 workflow(s)
I0216 10:08:08.748234 2563 server.cpp:151] Begin reload framework...
W0216 10:08:08.748302 2563 infer.cpp:287] Succ reload version engine: 18446744073709551615
I0216 10:08:08.748315 2563 manager.h:131] Finish reload 1 workflow(s)
I0216 10:08:18.748411 2563 server.cpp:151] Begin reload framework...
处理
fetch_var {
name: "multiclass_nms3_0.tmp_2"
alias_name: "multiclass_nms3_0.tmp_2"
is_lod_tensor: false
fetch_type: 2
}
修改为
fetch_var {
name: "multiclass_nms3_0.tmp_2"
alias_name: "multiclass_nms3_0.tmp_2"
is_lod_tensor: true
fetch_type: 2
}
也不行
The text was updated successfully, but these errors were encountered: