推理示例代码的 deploy/python/infer.py 推理 tood\\tood_r50_fpn_1x_coco模型大部分coco2007图片报错,少部分可以正常
535205856 opened this issue · 0 comments
535205856 commented
问题确认 Search before asking
Bug组件 Bug Component
Inference, Deploy
Bug描述 Describe the Bug
"tood\tood_r50_fpn_1x_coco"
推理使用的导出tood\tood_r50_fpn_1x_coco的模型为推理模型
tood\tood_r50_fpn_1x_coco
推理配置文件为 infer_cfg.yml, 内容如下, labellist根据实际整理出来了,未贴出
mode: paddle
draw_threshold: 0.5
metric: COCO
use_dynamic_shape: false
arch: TOOD
min_subgraph_size: 5
Preprocess:
- keep_ratio: true
target_size:- 640
- 640
type: Resize
- is_scale: true
mean:- 0.485
- 0.456
- 0.406
std: - 0.229
- 0.224
- 0.225
type: NormalizeImage
- type: Permute
- stride: 32
type: PadStride
label_list: []
"""
File "E:\work_aiplat\pp_detection_sample\PaddleDetection\deploy\python\infer.py",
result = self.predict()
File "E:\work_aiplat\pp_detection_sample\PaddleDetection\deploy\python\infer.py", line xxx, in predict
self.predictor.run()
ValueError: In user code:
File "cus_share/PaddleDetection/eyecool_export_test_for_folder.py", line 155, in <module>
export_pretrain_model_by_config_folder(path=WEIGHTS_HOME)
File "cus_share/PaddleDetection/eyecool_export_test_for_folder.py", line 40, in export_pretrain_model_by_config_folder
export_pretrain_model_by_config_folder(item_path, suffix, outFilter)
File "cus_share/PaddleDetection/eyecool_export_test_for_folder.py", line 52, in export_pretrain_model_by_config_folder
export_model_by_config_and_weight(item_path)
File "cus_share/PaddleDetection/eyecool_export_test_for_folder.py", line 148, in export_model_by_config_and_weight
trainer.export(infer_folder)
File "/xxx/cus_share/PaddleDetection/ppdet/engine/trainer.py", line 734, in export
save_dir)
File "/xxx/cus_share/PaddleDetection/ppdet/engine/trainer.py", line 711, in _get_infer_cfg_and_input_spec
input_spec, static_model.forward.main_program,
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 563, in main_program
concrete_program = self.concrete_program
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 479, in concrete_program
return self.concrete_program_specify_input_spec(input_spec=None)
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 517, in concrete_program_specify_input_spec
*desired_input_spec)
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 427, in get_concrete_program
concrete_program, partial_program_layer = self._program_cache[cache_key]
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 723, in __getitem__
self._caches[item] = self._build_once(item)
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 714, in _build_once
**cache_key.kwargs)
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
return wrapped_func(*args, **kwargs)
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/paddle/fluid/dygraph/base.py", line 51, in __impl__
return func(*args, **kwargs)
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 662, in from_func_spec
outputs = static_func(*inputs)
File "/tmp/tmpp2e7y5ht.py", line 100, in forward
false_fn_5, (), (inputs, self), (out,))
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_operators.py", line 211, in convert_ifelse
out = _run_py_ifelse(pred, true_fn, false_fn, true_args, false_args)
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_operators.py", line 257, in _run_py_ifelse
return true_fn(*true_args) if pred else false_fn(*false_args)
File "/tmp/tmpp2e7y5ht.py", line 83, in false_fn_5
for_loop_body_0, [__for_loop_var_index_0, inputs_list])
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_operators.py", line 45, in convert_while_loop
loop_vars = _run_py_while(cond, body, loop_vars)
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/convert_operators.py", line 59, in _run_py_while
loop_vars = body(*loop_vars)
File "/tmp/tmpp2e7y5ht.py", line 78, in for_loop_body_0
dy2static.convert_call(self.get_pred)())
File "/xxx/cus_share/PaddleDetection/ppdet/modeling/architectures/tood.py", line 75, in get_pred
bbox_pred, bbox_num = self._forward()
File "/xxx/cus_share/PaddleDetection/ppdet/modeling/architectures/tood.py", line 62, in _forward
head_outs = self.head(fpn_feats)
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 917, in __call__
return self._dygraph_call_func(*inputs, **kwargs)
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 907, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/xxx/cus_share/PaddleDetection/ppdet/modeling/heads/tood_head.py", line 255, in forward
reg_dist = scale_reg(self.tood_reg(reg_feat).exp())
File "/xxx/cus_share/PaddleDetection/ppdet/modeling/bbox_utils.py", line 766, in batch_distance2bbox
# while tensor add parameters, parameters should be better placed on the second place
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/paddle/fluid/layers/math_op_patch.py", line 347, in __impl__
attrs={'axis': axis})
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/paddle/fluid/framework.py", line 3184, in append_op
attrs=kwargs.get("attrs", None))
File "/xxx/condas/envs/xxx/lib/python3.7/site-packages/paddle/fluid/framework.py", line 2224, in __init__
for frame in traceback.extract_stack():
InvalidArgumentError: Broadcast dimension mismatch. Operands could not be broadcast together with the shape of X = [1, 4480, 2] and the shape of Y = [1, 6400, 2]. Received [4480] in X is not equal to [6400] in Y at i:1.
[Hint: Expected x_dims_array[i] == y_dims_array[i] || x_dims_array[i] <= 1 || y_dims_array[i] <= 1 == true, but received x_dims_array[i] == y_dims_array[i] || x_dims_array[i] <= 1 || y_dims_array[i] <= 1:0 != true:1.] (at C:\home\workspace\Paddle_release\paddle/fluid/operators/elementwise/elementwise_op_function.h:240)
[operator < elementwise_add > error]
"""
复现环境 Environment
OS: Linux/Windows
PaddlePaddle: 2.2.2
PaddleDetection: release/2.5
Python: 3.7.0
CUDA: 10.1
CUDNN: 7.6
GCC: 8.2.0
windows使用的cpu推理的,linux使用cpu/gpu 均出现该错误
Bug描述确认 Bug description confirmation
- 我确认已经提供了Bug复现步骤、代码改动说明、以及环境信息,确认问题是可以复现的。I confirm that the bug replication steps, code change instructions, and environment information have been provided, and the problem can be reproduced.
是否愿意提交PR? Are you willing to submit a PR?
- 我愿意提交PR!I'd like to help by submitting a PR!