PaddlePaddle / PaddleDetection

Object Detection toolkit based on PaddlePaddle. It supports object detection, instance segmentation, multiple object tracking and real-time multi-person keypoint detection.
Apache License 2.0
12.67k stars 2.87k forks source link

third_engine--demo_openvino报错,模型是从paddle的inference导出的onnx格式,在demo_onnxruntime中测试没有问题 #6279

Open dengmingD opened 2 years ago

dengmingD commented 2 years ago

问题确认 Search before asking

bug描述 Describe the Bug

Traceback (most recent call last): File "D:/work/projects/PaddleDetection/deploy/third_engine/demo_openvino/python/openvino_infer.py", line 265, in compiled_model = ie.compile_model(net, 'CPU') File "D:\work\apps\Anaconda3\lib\site-packages\openvino\runtime\ie_api.py", line 266, in compile_model super().compile_model(model, device_name, {} if config is None else config) RuntimeError: NonZero layer with name 'NonZero_0' has incorrect number of output edges: 2

复现环境 Environment

win10 paddlepaddle2.2 paddledetection2.4 openvino-dev2022.1.0

是否愿意提交PR Are you willing to submit a PR?

yghstill commented 2 years ago

@dengmingD 请问是PPYOLOE模型吗?导出模型时包含NMS吗?

dengmingD commented 2 years ago

@dengmingD 请问是PPYOLOE模型吗?导出模型时包含NMS吗? picodet、ppyoloe报一样的错

按文档导出 paddle2onnx --model_dir output_inference/ppyoloe_crn_l_300e_coco --model_filename model.pdmodel --params_filename model.pdiparams --opset_version 11 --save_file ppyoloe_crn_l_300e_coco.onnx

转成openvino模型 mo --input_model ppyoloe_crn_s_300e_coco.onnx

加载模型报错 RuntimeError: NonZero layer with name 'NonZero_0' has incorrect number of output edges: 2

我试了一下用hub导出的可以正常使用 MODEL_NAME = "mobilenet_v3_large_imagenet_ssld" hub.config.server = "https://paddlepaddle.org.cn/paddlehub" target_height, target_width = next(iter(input_shape))[2:] x_spec = InputSpec([1, 3, target_height, target_width], "float32", "x") print( "Exporting PaddlePaddle model to ONNX with target_height " f"{target_height} and target_width {target_width}" ) classifier.export_onnx_model(".", input_spec=[x_spec], opset_version=11) mo --input_model {MODEL_NAME}.onnx --input_shape "[1,3,{target_height},{target_width}] 这时加载模型不会报错,可以正常预测

dengmingD commented 2 years ago

是因为两个模型的输入和输出不同导致,怎能才能把ppyoloe_crn_s_300e_coco的input和output与ResNeXt101_vd_64x4d_infer一致

diff_model