Skip to content

[Bug] mmdeploy/tools/deploy.py 报错 #2891

Open
@Zhiquan98

Description

@Zhiquan98

Checklist

  • 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

利用mmdet框架训练 和 pth文件本地预测都试过了,都没问题。但是导出 pth 为 onnx 这一步报错
%onnx::Reshape_1217 : Long(2, strides=[1], device=cpu) = onnx::Concataxis=0, scope: mmdet.models.detectors.rtmdet.RTMDet:: # d:\situzhiquan\python project\mmlab\mmpose\mmdeploy-main\mmdeploy\mmcv\ops\nms.py:258:0
%labels : Long(*, *, strides=[201, 1], requires_grad=0, device=cpu) = onnx::Reshape(%onnx::Reshape_1216, %onnx::Reshape_1217), scope: mmdet.models.detectors.rtmdet.RTMDet:: # d:\situzhiquan\python project\mmlab\mmpose\mmdeploy-main\mmdeploy\mmcv\ops\nms.py:258:0
return (%dets, %labels)

04/30 15:12:02 - mmengine - ERROR - d:\situzhiquan\python project\mmlab\mmpose\mmdeploy-main\mmdeploy\apis\core\pipeline_manager.py - pop_mp_output - 80 - mmdeploy.apis.pytorch2onnx.torch2onnx with Call id: 0 failed. exit.

Process finished with exit code 1

Reproduction

在 mmdet 可以成功训练并且本地预测的环境下,执行以下步骤
一、下载 mmdeploy 代码到本地
二、pip install -e .
二、pip install onnxruntime
三、python mmdeploy-main/tools/deploy.py
"mmdeploy-main/configs/mmdet/detection/detection_onnxruntime_dynamic.py"
"data/rtmdet_tiny_triangle.py"
"checkpoint/rtmdet_tiny-18272d07.pth"
"data/test/st.jpg"
--work-dir "checkpoint/onnx/rtmdet"
--dump-info

Environment

(MMlab) D:\situzhiquan\Python Project\MMLAB\MMPose>pip list
Package                Version      Editable project location
---------------------- ------------ -----------------------------------------------------------
addict                 2.4.0
aenum                  3.1.16
albucore               0.0.23
albumentations         2.0.5
aliyun-python-sdk-core 2.16.0
aliyun-python-sdk-kms  2.16.5
annotated-types        0.7.0
certifi                2025.1.31
cffi                   1.17.1
charset-normalizer     3.4.1
chumpy                 0.70
click                  8.1.8
colorama               0.4.6
coloredlogs            15.0.1
contourpy              1.3.0
crcmod                 1.7
cryptography           44.0.2
cycler                 0.12.1
Cython                 3.0.12
dill                   0.4.0
eval_type_backport     0.2.2
filelock               3.14.0
flatbuffers            25.2.10
fonttools              4.57.0
fsspec                 2025.3.2
grpcio                 1.71.0
humanfriendly          10.0
idna                   3.10
importlib_metadata     8.6.1
importlib_resources    6.5.2
Jinja2                 3.1.6
jmespath               0.10.0
json-tricks            3.17.3
kiwisolver             1.4.7
Markdown               3.8
markdown-it-py         3.0.0
MarkupSafe             3.0.2
matplotlib             3.9.4
mdurl                  0.1.2
mmcv                   2.1.0
mmdeploy               1.3.1        d:\situzhiquan\python project\mmlab\mmpose\mmdeploy-main
mmdet                  3.3.0        d:\situzhiquan\python project\mmlab\mmpose\mmdetection-main
mmengine               0.10.7
mmpose                 1.3.2        d:\situzhiquan\python project\mmlab\mmpose\mmpose-main
model-index            0.1.11
mpmath                 1.3.0
multiprocess           0.70.18
munkres                1.1.4
networkx               3.2.1
numpy                  2.0.2
onnx                   1.17.0
onnxruntime            1.8.1
opencv-python          4.11.0.86
opencv-python-headless 4.11.0.86
opendatalab            0.0.10
openmim                0.3.9
openxlab               0.1.2
ordered-set            4.1.0
oss2                   2.17.0
packaging              24.2
pandas                 2.2.3
pillow                 11.0.0
pip                    25.0
platformdirs           4.3.7
prettytable            3.16.0
protobuf               3.20.2
pycocotools            2.0.8
pycparser              2.22
pycryptodome           3.22.0
pydantic               2.11.3
pydantic_core          2.33.1
Pygments               2.19.1
pyparsing              3.2.3
pyreadline3            3.5.4
python-dateutil        2.9.0.post0
pytz                   2023.4
pywin32                310
PyYAML                 6.0.2
regex                  2024.11.6
requests               2.28.2
rich                   13.4.2
scipy                  1.13.1
seaborn                0.13.2
setuptools             60.2.0
shapely                2.0.7
simsimd                6.2.1
six                    1.17.0
stringzilla            3.12.5
sympy                  1.13.1
tabulate               0.9.0
termcolor              3.0.1
terminaltables         3.1.10
tomli                  2.2.1
torch                  2.6.0+cu124
torchaudio             2.6.0+cu124
torchvision            0.21.0+cu124
tqdm                   4.65.2
typing_extensions      4.13.2
typing-inspection      0.4.0
tzdata                 2025.2
urllib3                1.26.20
wcwidth                0.2.13
wheel                  0.45.1
xtcocotools            1.14.3
yapf                   0.43.0
zipp                   3.21.0

Error traceback

。。。。。。。。上面省略一大堆%onnx开头的信息
%onnx::Reshape_1217 : Long(2, strides=[1], device=cpu) = onnx::Concat[axis=0](%onnx::Concat_1213), scope: mmdet.models.detectors.rtmdet.RTMDet:: # d:\situzhiquan\python project\mmlab\mmpose\mmdeploy-main\mmdeploy\mmcv\ops\nms.py:258:0
  %labels : Long(*, *, strides=[201, 1], requires_grad=0, device=cpu) = onnx::Reshape(%onnx::Reshape_1216, %onnx::Reshape_1217), scope: mmdet.models.detectors.rtmdet.RTMDet:: # d:\situzhiquan\python project\mmlab\mmpose\mmdeploy-main\mmdeploy\mmcv\ops\nms.py:258:0
  return (%dets, %labels)

04/30 15:12:02 - mmengine - ERROR - d:\situzhiquan\python project\mmlab\mmpose\mmdeploy-main\mmdeploy\apis\core\pipeline_manager.py - pop_mp_output - 80 - `mmdeploy.apis.pytorch2onnx.torch2onnx` with Call id: 0 failed. exit.

Process finished with exit code 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions