mmdetection: AttributeError: 'CascadeRoIHead' object has no attribute 'onnx_export'

Thanks for your error report and we appreciate it a lot.

Checklist

  1. I have searched related issues but cannot get the expected help.
  2. I have read the FAQ documentation but cannot get the expected help.
  3. The bug has not been fixed in the latest version.

Describe the bug A clear and concise description of what the bug is. cascade_rcnn 使用python3.7.5 tools/deployment/pytorch2onnx.py configs/cascade_rcnn/cascade_rcnn_r50_fpn_1x_coco.py ./cascade_rcnn_r50_fpn_1x_coco_20200316-3dc56deb.pth --shape=1216 --output-file=cascadedRCNN.onnx 导出onnx报错,错误:AttributeError: ‘CascadeRoIHead’ object has no attribute ‘onnx_export’ Reproduction

  1. What command or script did you run?
A placeholder for the command.
  1. Did you make any modifications on the code or config? Did you understand what you have modified?
  2. What dataset did you use?

Environment ubuntu18.04 x86

  1. Please run python mmdet/utils/collect_env.py to collect necessary environment information and paste it here.
  2. You may add addition that may be helpful for locating the problem, such as
    • How you installed PyTorch [e.g., pip, conda, source]
    • Other environment variables that may be related (such as $PATH, $LD_LIBRARY_PATH, $PYTHONPATH, etc.)

Error traceback If applicable, paste the error trackback here.

A placeholder for trackback.

Bug fix If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 15 (2 by maintainers)

Most upvoted comments

@pengaoao I did it in PR #5486, the Cascade-RCNN can be exported to ONNX with batch dimension. The visualization result seems reasonable, You can try it. PR #5486 would be merged soon

I’ve done a same model recently but using v2.10 since the latest version has an error as described in this PR. In my experiment, if only the boxes with its score greater than 0.4 for example, the onnx model could be acceptable. I’m glad to see this PR will be implemented in the short future. Thanks @jshilong

you need to pay attention to the code segment before the add_dummy_nms_for_onnx that I changed in bbox_head.py. add_dummy_nms_for_onnx has two sets of parameter forms, it is easy to make mistakes.