Skip to content
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

obj_classification run_demo.sh cannot directly run because of existing model name 'x' #24

Open
Jingqing3948 opened this issue Mar 26, 2024 · 0 comments

Comments

@Jingqing3948
Copy link

when run obj-classification demo, the run_demo.sh will rename the onnx model as 'x'
but because the origin output_tensor_names had the 'x' tensor name, so the rename_onnx_model.py will exit with (-1)

root@instance-ff89xqcg:~/develop/Paddle-examples-for-AVH/object_classification# bash run_demo.sh --model MobileNetV3 --device cortex-m55
Device name is cortex-m55
Model name is MobileNetV3
--2024-03-26 16:08:29--  https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/inference/MobileNetV3_small_x0_35_ssld_infer.tar
Resolving paddle-imagenet-models-name.bj.bcebos.com (paddle-imagenet-models-name.bj.bcebos.com)... 100.67.200.6
Connecting to paddle-imagenet-models-name.bj.bcebos.com (paddle-imagenet-models-name.bj.bcebos.com)|100.67.200.6|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7874560 (7.5M) [application/x-tar]
Saving to: ‘MobileNetV3_small_x0_35_ssld_infer.tar’

MobileNetV3_small_x0_35_ssld_ 100%[=================================================>]   7.51M  --.-KB/s    in 0.06s

2024-03-26 16:08:29 (116 MB/s) - ‘MobileNetV3_small_x0_35_ssld_infer.tar’ saved [7874560/7874560]

[Paddle2ONNX] Start to parse PaddlePaddle model...
[Paddle2ONNX] Model file path: /root/develop/Paddle-examples-for-AVH/object_classification/model/inference.pdmodel
[Paddle2ONNX] Paramters file path: /root/develop/Paddle-examples-for-AVH/object_classification/model/inference.pdiparams
[Paddle2ONNX] Start to parsing Paddle model...
[Paddle2ONNX] Use opset_version = 9 for ONNX export.
[Paddle2ONNX] PaddlePaddle model is exported as ONNX format now.
2024-03-26 16:08:29 [INFO]      ===============Make PaddlePaddle Better!================
2024-03-26 16:08:29 [INFO]      A little survey: https://iwenjuan.baidu.com/?code=r8hu2s
Existing names in the model: {'batch_norm_27.w_2', 'p2o.Mul.23', 'p2o.Add.87', 'batch_norm_6.w_0', 'batch_norm_10.w_0', 'conv2d_46.w_0', 'batch_norm_12.tmp_3', 'batch_norm_29.b_0', 'conv2d_2.w_0', 'batch_norm_3.tmp_3', 'p2o.Mul.39', 'conv2d_8.w_0', 'batch_norm_30.b_0', 'batch_norm_27.b_0', 'p2o.Mul.53', 'conv2d_33.w_0', 'p2o.Clip.17', 'conv2d_39.w_0', 'p2o.Add.67', 'p2o.Mul.17', 'p2o.helper.constant.11', 'batch_norm_20.w_2', 'conv2d_20.w_0', 'conv2d_3.b_0', 'batch_norm_30.w_2', 'batch_norm_4.w_2', 'conv2d_45.w_0', 'batch_norm_24.b_0', 'conv2d_24.b_0', 'relu_0.tmp_0', 'conv2d_74.tmp_0', 'conv2d_35.w_0', 'p2o.helper.constant.23', 'batch_norm_4.w_0', 'batch_norm_7.tmp_3', 'batch_norm_33.w_0', 'softmax_1.tmp_0', 'p2o.helper.constant.31', 'p2o.Clip.33', 'conv2d_56.tmp_0', 'conv2d_28.w_0', 'conv2d_3.w_0', 'batch_norm_24.w_2', 'conv2d_30.b_0', 'batch_norm_21.tmp_3', 'relu_3.tmp_0', 'batch_norm_21.b_0', 'p2o.helper.constant.29', 'p2o.Clip.1', 'batch_norm_13.b_0', 'conv2d_20.b_0', 'conv2d_94.tmp_0', 'batch_norm_8.w_1', 'hardsigmoid_14.tmp_0', 'batch_norm_21.w_1', 'p2o.Mul.9', 'conv2d_58.tmp_0', 'batch_norm_15.w_2', 'batch_norm_9.b_0', 'conv2d_90.tmp_0', 'batch_norm_2.w_2', 'conv2d_11.w_0', 'conv2d_50.w_0', 'p2o.GlobalAveragePool.3', 'batch_norm_25.b_0', 'p2o.helper.constant.0', 'batch_norm_23.tmp_3', 'conv2d_95.tmp_0', 'hardswish_31.tmp_0', 'batch_norm_5.w_1', 'p2o.GlobalAveragePool.19', 'batch_norm_17.w_1', 'depthwise_conv2d_4.tmp_0', 'p2o.Clip.35', 'batch_norm_23.w_2', 'batch_norm_4.b_0', 'p2o.Mul.51', 'p2o.Add.89', 'batch_norm_14.w_0', 'batch_norm_12.w_2', 'conv2d_13.w_0', 'conv2d_71.tmp_0', 'conv2d_70.tmp_0', 'conv2d_37.w_0', 'depthwise_conv2d_9.tmp_0', 'hardswish_28.tmp_0', 'p2o.Add.57', 'depthwise_conv2d_7.tmp_0', 'p2o.Add.45', 'p2o.Add.25', 'relu_7.tmp_0', 'batch_norm_33.w_2', 'batch_norm_7.w_1', 'batch_norm_0.w_1', 'p2o.Add.49', 'p2o.helper.constant.13', 'conv2d_75.tmp_0', 'batch_norm_33.tmp_3', 'conv2d_47.w_0', 'p2o.Clip.25', 'p2o.helper.constant.28', 'p2o.Mul.11', 'batch_norm_28.b_0', 'batch_norm_7.w_2', 'p2o.Add.27', 'batch_norm_3.b_0', 'conv2d_38.w_0', 'conv2d_93.tmp_0', 'p2o.Add.11', 'conv2d_14.b_0', 'conv2d_53.w_0', 'conv2d_9.w_0', 'batch_norm_27.w_0', 'p2o.Clip.7', 'batch_norm_24.tmp_3', 'hardswish_35.tmp_0', 'conv2d_55.tmp_0', 'batch_norm_30.w_1', 'hardsigmoid_11.tmp_0', 'flatten_1.tmp_0', 'batch_norm_20.w_0', 'batch_norm_12.w_1', 'p2o.Concat.1', 'p2o.Add.7', 'hardswish_20.tmp_0', 'hardswish_25.tmp_0', 'p2o.MatMul.1', 'batch_norm_19.w_2', 'p2o.helper.constant.52', 'p2o.helper.constant.10', 'batch_norm_2.w_0', 'batch_norm_28.w_0', 'linear_0.b_0', 'p2o.Clip.27', 'p2o.Mul.43', 'batch_norm_20.tmp_3', 'p2o.Mul.47', 'batch_norm_31.b_0', 'batch_norm_17.w_2', 'batch_norm_13.w_1', 'p2o.Mul.49', 'p2o.helper.constant.41', 'batch_norm_11.w_1', 'conv2d_39.b_0', 'batch_norm_14.tmp_3', 'batch_norm_6.w_2', 'batch_norm_8.b_0', 'p2o.helper.constant.1', 'p2o.Clip.9', 'p2o.Mul.3', 'p2o.Add.47', 'p2o.Clip.3', 'batch_norm_6.w_1', 'batch_norm_18.b_0', 'batch_norm_23.w_1', 'hardsigmoid_15.tmp_0', 'p2o.helper.constant.36', 'batch_norm_18.w_0', 'p2o.Add.59', 'conv2d_86.tmp_0', 'conv2d_49.w_0', 'p2o.Add.17', 'batch_norm_5.tmp_3', 'conv2d_34.b_0', 'batch_norm_22.tmp_3', 'conv2d_51.w_0', 'batch_norm_21.w_2', 'conv2d_23.w_0', 'conv2d_25.b_0', 'batch_norm_26.w_1', 'batch_norm_30.tmp_3', 'relu_9.tmp_0', 'relu_1.tmp_0', 'conv2d_89.tmp_0', 'conv2d_34.w_0', 'conv2d_17.w_0', 'conv2d_63.tmp_0', 'p2o.helper.constant.42', 'batch_norm_28.w_1', 'p2o.helper.constant.57', 'p2o.Clip.23', 'batch_norm_28.tmp_3', 'hardswish_21.tmp_0', 'conv2d_73.tmp_0', 'batch_norm_13.w_2', 'batch_norm_16.w_2', 'p2o.Add.1', 'conv2d_92.tmp_0', 'conv2d_35.b_0', 'p2o.Clip.5', 'p2o.helper.constant.18', 'conv2d_76.tmp_0', 'batch_norm_6.b_0', 'conv2d_41.w_0', 'conv2d_42.w_0', 'batch_norm_31.w_1', 'p2o.Add.37', 'p2o.Mul.35', 'p2o.Add.35', 'relu_8.tmp_0', 'p2o.GlobalAveragePool.15', 'batch_norm_6.tmp_3', 'batch_norm_28.w_2', 'batch_norm_4.w_1', 'p2o.helper.constant.47', 'p2o.Mul.37', 'batch_norm_30.w_0', 'p2o.Clip.31', 'conv2d_25.w_0', 'conv2d_4.w_0', 'p2o.Add.29', 'conv2d_44.w_0', 'p2o.helper.constant.24', 'conv2d_78.tmp_0', 'batch_norm_1.b_0', 'batch_norm_31.tmp_3', 'batch_norm_22.w_1', 'batch_norm_5.w_0', 'conv2d_64.tmp_0', 'hardswish_37.tmp_0', 'batch_norm_0.w_2', 'batch_norm_3.w_1', 'batch_norm_0.tmp_3', 'batch_norm_12.b_0', 'batch_norm_15.tmp_3', 'batch_norm_16.w_0', 'p2o.Clip.11', 'batch_norm_19.w_1', 'batch_norm_2.w_1', 'batch_norm_13.tmp_3', 'conv2d_32.w_0', 'batch_norm_27.w_1', 'depthwise_conv2d_2.tmp_0', 'hardswish_32.tmp_0', 'hardswish_26.tmp_0', 'batch_norm_25.w_0', 'hardsigmoid_10.tmp_0', 'batch_norm_26.b_0', 'p2o.helper.constant.25', 'relu_6.tmp_0', 'conv2d_91.tmp_0', 'conv2d_82.tmp_0', 'p2o.Shape.1', 'conv2d_43.w_0', 'conv2d_79.tmp_0', 'p2o.Add.75', 'batch_norm_18.w_2', 'relu_5.tmp_0', 'batch_norm_19.tmp_3', 'hardsigmoid_13.tmp_0', 'hardswish_27.tmp_0', 'hardswish_34.tmp_0', 'batch_norm_23.w_0', 'p2o.Mul.13', 'conv2d_6.w_0', 'batch_norm_34.w_0', 'batch_norm_12.w_0', 'p2o.Add.77', 'p2o.Mul.5', 'relu_13.tmp_0', 'conv2d_69.tmp_0', 'batch_norm_16.w_1', 'batch_norm_18.w_1', 'batch_norm_20.w_1', 'p2o.Mul.25', 'p2o.helper.constant.37', 'p2o.Mul.29', 'hardswish_19.tmp_0', 'batch_norm_25.tmp_3', 'relu_2.tmp_0', 'batch_norm_21.w_0', 'conv2d_19.b_0', 'batch_norm_17.tmp_3', 'p2o.GlobalAveragePool.1', 'conv2d_19.w_0', 'batch_norm_32.tmp_3', 'conv2d_84.tmp_0', 'relu_10.tmp_0', 'batch_norm_33.b_0', 'p2o.Mul.27', 'conv2d_4.b_0', 'batch_norm_26.w_0', 'conv2d_52.w_0', 'hardsigmoid_12.tmp_0', 'batch_norm_25.w_1', 'conv2d_26.w_0', 'batch_norm_16.tmp_3', 'p2o.helper.constant.54', 'p2o.helper.slice.0', 'p2o.helper.constant.7', 'conv2d_29.b_0', 'p2o.helper.constant.48', 'batch_norm_34.w_2', 'conv2d_12.w_0', 'batch_norm_4.tmp_3', 'conv2d_88.tmp_0', 'conv2d_18.w_0', 'conv2d_60.tmp_0', 'hardswish_29.tmp_0', 'batch_norm_0.b_0', 'batch_norm_25.w_2', 'batch_norm_31.w_2', 'conv2d_16.w_0', 'depthwise_conv2d_0.tmp_0', 'batch_norm_5.b_0', 'dropout_1.tmp_0', 'conv2d_81.tmp_0', 'batch_norm_32.w_2', 'conv2d_22.w_0', 'batch_norm_11.b_0', 'conv2d_30.w_0', 'conv2d_50.b_0', 'batch_norm_2.tmp_3', 'conv2d_54.tmp_0', 'p2o.Add.65', 'p2o.helper.constant.35', 'batch_norm_7.w_0', 'conv2d_62.tmp_0', 'batch_norm_2.b_0', 'p2o.helper.constant.40', 'linear_0.w_0', 'batch_norm_14.b_0', 'relu_11.tmp_0', 'batch_norm_3.w_2', 'batch_norm_32.w_0', 'hardsigmoid_9.tmp_0', 'batch_norm_29.w_0', 'p2o.Add.39', 'batch_norm_24.w_1', 'batch_norm_10.w_1', 'batch_norm_26.w_2', 'p2o.Add.19', 'conv2d_36.w_0', 'conv2d_65.tmp_0', 'batch_norm_1.w_2', 'p2o.GlobalAveragePool.17', 'depthwise_conv2d_8.tmp_0', 'conv2d_7.w_0', 'p2o.helper.constant.49', 'p2o.helper.constant.55', 'batch_norm_5.w_2', 'hardswish_33.tmp_0', 'p2o.helper.constant.4', 'p2o.helper.constant.5', 'batch_norm_14.w_1', 'batch_norm_18.tmp_3', 'batch_norm_31.w_0', 'conv2d_48.w_0', 'relu_12.tmp_0', 'depthwise_conv2d_5.tmp_0', 'p2o.helper.constant.22', 'batch_norm_10.w_2', 'conv2d_0.w_0', 'relu_14.tmp_0', 'p2o.Add.73', 'batch_norm_9.w_1', 'p2o.helper.constant.19', 'batch_norm_1.tmp_3', 'conv2d_85.tmp_0', 'p2o.GlobalAveragePool.13', 'p2o.helper.constant.53', 'depthwise_conv2d_6.tmp_0', 'batch_norm_15.b_0', 'p2o.Clip.29', 'conv2d_72.tmp_0', 'p2o.Mul.45', 'batch_norm_32.w_1', 'hardsigmoid_17.tmp_0', 'conv2d_14.w_0', 'conv2d_49.b_0', 'p2o.helper.constant.46', 'p2o.Add.85', 'batch_norm_19.b_0', 'batch_norm_11.w_2', 'batch_norm_22.w_2', 'conv2d_67.tmp_0', 'conv2d_27.w_0', 'p2o.Mul.19', 'conv2d_83.tmp_0', 'p2o.Mul.31', 'depthwise_conv2d_1.tmp_0', 'conv2d_21.w_0', 'batch_norm_11.w_0', 'p2o.Clip.37', 'batch_norm_17.b_0', 'hardswish_22.tmp_0', 'batch_norm_22.b_0', 'batch_norm_29.w_1', 'p2o.Mul.33', 'conv2d_40.w_0', 'p2o.helper.constant.43', 'batch_norm_10.tmp_3', 'conv2d_96.tmp_0', 'batch_norm_0.w_0', 'conv2d_44.b_0', 'conv2d_61.tmp_0', 'p2o.helper.constant.30', 'batch_norm_14.w_2', 'p2o.GlobalAveragePool.7', 'batch_norm_15.w_0', 'batch_norm_8.w_2', 'conv2d_1.w_0', 'conv2d_10.w_0', 'conv2d_57.tmp_0', 'p2o.Mul.15', 'p2o.Mul.55', 'hardswish_36.tmp_0', 'batch_norm_34.w_1', 'conv2d_45.b_0', 'batch_norm_15.w_1', 'p2o.GlobalAveragePool.5', 'p2o.GlobalAveragePool.9', 'conv2d_40.b_0', 'batch_norm_16.b_0', 'p2o.helper.constant.16', 'p2o.helper.constant.6', 'batch_norm_20.b_0', 'conv2d_68.tmp_0', 'conv2d_24.w_0', 'p2o.Add.9', 'p2o.Clip.19', 'p2o.GlobalAveragePool.11', 'p2o.Mul.7', 'batch_norm_17.w_0', 'batch_norm_33.w_1', 'x', 'batch_norm_23.b_0', 'batch_norm_32.b_0', 'hardswish_30.tmp_0', 'batch_norm_26.tmp_3', 'p2o.Mul.21', 'conv2d_80.tmp_0', 'batch_norm_1.w_0', 'p2o.helper.constant.56', 'batch_norm_7.b_0', 'p2o.helper.constant.34', 'p2o.Add.55', 'p2o.Clip.21', 'hardswish_23.tmp_0', 'batch_norm_34.b_0', 'batch_norm_27.tmp_3', 'batch_norm_10.b_0', 'batch_norm_9.w_0', 'hardswish_24.tmp_0', 'batch_norm_1.w_1', 'p2o.helper.constant.12', 'p2o.Add.83', 'batch_norm_9.tmp_3', 'batch_norm_24.w_0', 'p2o.Mul.41', 'batch_norm_29.tmp_3', 'batch_norm_8.w_0', 'conv2d_87.tmp_0', 'depthwise_conv2d_3.tmp_0', 'hardsigmoid_16.tmp_0', 'conv2d_15.w_0', 'depthwise_conv2d_10.tmp_0', 'relu_4.tmp_0', 'batch_norm_13.w_0', 'conv2d_59.tmp_0', 'batch_norm_19.w_0', 'batch_norm_3.w_0', 'conv2d_5.w_0', 'batch_norm_8.tmp_3', 'conv2d_31.w_0', 'conv2d_15.b_0', 'batch_norm_34.tmp_3', 'batch_norm_11.tmp_3', 'p2o.Clip.13', 'p2o.Clip.15', 'conv2d_77.tmp_0', 'batch_norm_9.w_2', 'conv2d_66.tmp_0', 'batch_norm_22.w_0', 'conv2d_29.w_0', 'p2o.Mul.1', 'batch_norm_29.w_2', 'p2o.helper.constant.17'}
Conflicting new name: x
[ERROR] The defined new_name '{}' is already exist in the onnx model, which is not allowed.

here is the relevant rename_onnx_model.py code:
image
(the code in red square is my modification for debug.)
So I have to modify the run_demo.sh to change the default onnx name ('x'), I think this implementation is a bit bad :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant