Skip to content

[Bug] bug in convert mmrotate model to onnx #2894

Open
@ZeroLelouch1205

Description

@ZeroLelouch1205

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

when i user mmdeploy/tools/depoly.py convert my mmrotate model to onnx,it report 2 warning,it makes my inference result isn't same as pth
like this:

05/08 15:26:01 - mmengine - WARNING - Failed to search registry with scope "mmrotate" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmrotate" is a correct scope, or whether the registry is initialized.
05/08 15:26:01 - mmengine - WARNING - Failed to search registry with scope "mmrotate" in the "mmrotate_tasks" registry tree. As a workaround, the current "mmrotate_tasks" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmrotate" is a correct scope, or whether the registry is initialized.

and it also report 4 warning:

[W C:\cb\pytorch_1000000000000\work\torch\csrc\jit\passes\onnx\shape_type_inference.cpp:1924] Warning: The shape inference of mmdeploy::MMCVRoIAlignRotated type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. (function UpdateReliable)
[W C:\cb\pytorch_1000000000000\work\torch\csrc\jit\passes\onnx\shape_type_inference.cpp:1924] Warning: The shape inference of mmdeploy::MMCVRoIAlignRotated type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. (function UpdateReliable)
[W C:\cb\pytorch_1000000000000\work\torch\csrc\jit\passes\onnx\shape_type_inference.cpp:1924] Warning: The shape inference of mmdeploy::MMCVRoIAlignRotated type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. (function UpdateReliable)
[W C:\cb\pytorch_1000000000000\work\torch\csrc\jit\passes\onnx\shape_type_inference.cpp:1924] Warning: The shape inference of mmdeploy::NMSRotated type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. (function UpdateReliable)

Reproduction

my_depoly_config:

backend_config=dict(type='onnxruntime'),
codebase_config=dict(
    type='mmrotate',
    task='RotatedDetection',
    post_processing=dict(
        score_threshold=0.05,
        iou_threshold=0.1,
        pre_top_k=3000,
        keep_top_k=2000,
        max_output_boxes_per_class=2000)
),
onnx_config = dict(
    type='onnx',
    export_params=True,
    keep_initializers_as_inputs=False,
    output_names=['dets', 'labels'],
    input_names=['input'],
    input_shape=[1024, 1024],
    opset_version=11,
    optimize=True
)

Environment

05/08 15:24:09 - mmengine - INFO - 

05/08 15:24:09 - mmengine - INFO - **********Environmental information**********
05/08 15:24:12 - mmengine - INFO - sys.platform: win32
05/08 15:24:12 - mmengine - INFO - Python: 3.9.22 | packaged by conda-forge | (main, Apr 14 2025, 23:26:18) [MSC v.1929 64 bit (AMD64)]
05/08 15:24:12 - mmengine - INFO - CUDA available: True
05/08 15:24:12 - mmengine - INFO - MUSA available: False
05/08 15:24:12 - mmengine - INFO - numpy_random_seed: 2147483648
05/08 15:24:12 - mmengine - INFO - GPU 0: NVIDIA GeForce RTX 4090 D
05/08 15:24:12 - mmengine - INFO - CUDA_HOME: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8
05/08 15:24:12 - mmengine - INFO - NVCC: Cuda compilation tools, release 11.8, V11.8.89
05/08 15:24:12 - mmengine - INFO - MSVC: 用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.43.34808 版
05/08 15:24:12 - mmengine - INFO - GCC: n/a
05/08 15:24:12 - mmengine - INFO - PyTorch: 2.0.1
05/08 15:24:12 - mmengine - INFO - PyTorch compiling details: PyTorch built with:
  - C++ Version: 199711
  - MSVC 193431937
  - Intel(R) Math Kernel Library Version 2020.0.2 Product Build 20200624 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v2.7.3 (Git Hash 6dbeffbae1f23cbbeae17adb7b5b13f1f37c080e)
  - OpenMP 2019
  - LAPACK is enabled (usually provided by MKL)
  - CPU capability usage: AVX2
  - CUDA Runtime 11.8
  - NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_90,code=sm_90;-gencode;arch=compute_37,code=compute_37
  - CuDNN 8.7
  - Magma 2.5.4
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.8, CUDNN_VERSION=8.7.0, CXX_COMPILER=C:/cb/pytorch_1000000000000/work/tmp_bin/sccache-cl.exe, CXX_FLAGS=/DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj /FS -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DLIBKINETO_NOROCTRACER -DUSE_FBGEMM -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_DISABLE_GPU_ASSERTS=OFF, TORCH_VERSION=2.0.1, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=OFF, USE_NNPACK=OFF, USE_OPENMP=ON, USE_ROCM=OFF, 

05/08 15:24:12 - mmengine - INFO - TorchVision: 0.15.2
05/08 15:24:12 - mmengine - INFO - OpenCV: 4.11.0
05/08 15:24:12 - mmengine - INFO - MMEngine: 0.10.7
05/08 15:24:12 - mmengine - INFO - MMCV: 2.0.1
05/08 15:24:12 - mmengine - INFO - MMCV Compiler: MSVC 192930148
05/08 15:24:12 - mmengine - INFO - MMCV CUDA Compiler: 11.8
05/08 15:24:12 - mmengine - INFO - MMDeploy: 1.3.1+
05/08 15:24:12 - mmengine - INFO - 

05/08 15:24:12 - mmengine - INFO - **********Backend information**********
05/08 15:24:12 - mmengine - INFO - tensorrt:	None
05/08 15:24:12 - mmengine - INFO - ONNXRuntime:	1.17.3
05/08 15:24:12 - mmengine - INFO - ONNXRuntime-gpu:	1.17.1
05/08 15:24:12 - mmengine - INFO - ONNXRuntime custom ops:	Available
05/08 15:24:12 - mmengine - INFO - pplnn:	None
05/08 15:24:12 - mmengine - INFO - ncnn:	None
05/08 15:24:12 - mmengine - INFO - snpe:	None
05/08 15:24:12 - mmengine - INFO - openvino:	None
05/08 15:24:12 - mmengine - INFO - torchscript:	2.0.1+cu118
05/08 15:24:12 - mmengine - INFO - torchscript custom ops:	NotAvailable
05/08 15:24:12 - mmengine - INFO - rknn-toolkit:	None
05/08 15:24:12 - mmengine - INFO - rknn-toolkit2:	None
05/08 15:24:12 - mmengine - INFO - ascend:	None
05/08 15:24:12 - mmengine - INFO - coreml:	None
05/08 15:24:12 - mmengine - INFO - tvm:	None
05/08 15:24:12 - mmengine - INFO - vacc:	None
05/08 15:24:12 - mmengine - INFO - 

05/08 15:24:12 - mmengine - INFO - **********Codebase information**********
05/08 15:24:12 - mmengine - INFO - mmdet:	3.1.0
05/08 15:24:12 - mmengine - INFO - mmseg:	1.2.1
05/08 15:24:12 - mmengine - INFO - mmpretrain:	None
05/08 15:24:12 - mmengine - INFO - mmocr:	None
05/08 15:24:12 - mmengine - INFO - mmagic:	None
05/08 15:24:12 - mmengine - INFO - mmdet3d:	None
05/08 15:24:12 - mmengine - INFO - mmpose:	None
05/08 15:24:12 - mmengine - INFO - mmrotate:	1.0.0rc1
05/08 15:24:12 - mmengine - INFO - mmaction:	None
05/08 15:24:12 - mmengine - INFO - mmrazor:	None
05/08 15:24:12 - mmengine - INFO - mmyolo:	None

Error traceback

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