open-mmlab / mmdeploy

OpenMMLab Model Deployment Framework
https://mmdeploy.readthedocs.io/en/latest/
Apache License 2.0
2.75k stars 631 forks source link

[Bug] `TypeError: nms_rotated(): incompatible function arguments` when trying to convert MMRotate model to ONNX in Google colab enviroment #2712

Open kristupas-g opened 7 months ago

kristupas-g commented 7 months ago

Checklist

Describe the bug

I am trying to convert a Oriented RCNN model to ONNX runtime. I am running the pretty much the same as script as in the documentation. What am I missing? The input image was downloaded off the MMRotate library and the checkpoint was downloaded using mim.

Reproduction

In google colab enviroment running this code:

!pip install -U openmim
!pip install torch==1.12.0 torchvision
!mim install mmcv-full
!mim install mmdet\<3.0.0
!pip install mmrotate

!pip install mmdeploy==0.14.0
!git clone --branch v0.14.0 https://github.com/open-mmlab/mmdeploy.git

!wget https://github.com/open-mmlab/mmrotate/raw/main/demo/dota_demo.jpg
!mim download mmrotate --config oriented_rcnn_r50_fpn_1x_dota_le90 --dest 

# The following code should be in another code cell
%%shell
wget https://github.com/microsoft/onnxruntime/releases/download/v1.8.1/onnxruntime-linux-x64-1.8.1.tgz
tar -zxvf onnxruntime-linux-x64-1.8.1.tgz
export ONNXRUNTIME_DIR=$(pwd)/onnxruntime-linux-x64-1.8.1
export LD_LIBRARY_PATH=$ONNXRUNTIME_DIR/lib:$LD_LIBRARY_PATH

cd /content/mmdeploy

python tools/deploy.py \
    configs/mmrotate/rotated-detection_onnxruntime_dynamic.py \
    /content/oriented_rcnn_r50_fpn_1x_dota_le90.py \
    /content/oriented_rcnn_r50_fpn_1x_dota_le90-6d2b2ce0.pth \
    /content/dota_demo.jpg \
    --work-dir mmdeploy_models/mmrotate/ort \
    --device cpu \
    --show \
    --dump-info

Environment

2024-03-23 17:01:21,654 - mmdeploy - INFO - 

2024-03-23 17:01:21,654 - mmdeploy - INFO - **********Environmental information**********
fatal: not a git repository (or any of the parent directories): .git
2024-03-23 17:01:22,073 - mmdeploy - INFO - sys.platform: linux
2024-03-23 17:01:22,073 - mmdeploy - INFO - Python: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
2024-03-23 17:01:22,073 - mmdeploy - INFO - CUDA available: True
2024-03-23 17:01:22,073 - mmdeploy - INFO - GPU 0: Tesla T4
2024-03-23 17:01:22,073 - mmdeploy - INFO - CUDA_HOME: /usr/local/cuda
2024-03-23 17:01:22,073 - mmdeploy - INFO - NVCC: Cuda compilation tools, release 12.2, V12.2.140
2024-03-23 17:01:22,073 - mmdeploy - INFO - GCC: x86_64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
2024-03-23 17:01:22,073 - mmdeploy - INFO - PyTorch: 1.12.0+cu102
2024-03-23 17:01:22,073 - mmdeploy - INFO - PyTorch compiling details: PyTorch built with:
  - GCC 7.3
  - C++ Version: 201402
  - Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v2.6.0 (Git Hash 52b5f107dd9cf10910aaa19cb47f3abf9b349815)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - LAPACK is enabled (usually provided by MKL)
  - NNPACK is enabled
  - CPU capability usage: AVX2
  - CUDA Runtime 10.2
  - 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_70,code=sm_70
  - CuDNN 7.6.5
  - Magma 2.5.2
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=10.2, CUDNN_VERSION=7.6.5, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.12.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=OFF, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, 

2024-03-23 17:01:22,073 - mmdeploy - INFO - TorchVision: 0.13.0+cu102
2024-03-23 17:01:22,073 - mmdeploy - INFO - OpenCV: 4.8.0
2024-03-23 17:01:22,073 - mmdeploy - INFO - MMCV: 1.7.2
2024-03-23 17:01:22,073 - mmdeploy - INFO - MMCV Compiler: GCC 7.3
2024-03-23 17:01:22,073 - mmdeploy - INFO - MMCV CUDA Compiler: 10.2
2024-03-23 17:01:22,073 - mmdeploy - INFO - MMDeploy: 0.14.0+
2024-03-23 17:01:22,073 - mmdeploy - INFO - 

2024-03-23 17:01:22,073 - mmdeploy - INFO - **********Backend information**********
2024-03-23 17:01:22,082 - mmdeploy - INFO - tensorrt:   None
2024-03-23 17:01:22,083 - mmdeploy - INFO - ONNXRuntime:    None
2024-03-23 17:01:22,084 - mmdeploy - INFO - pplnn:  None
2024-03-23 17:01:22,085 - mmdeploy - INFO - ncnn:   None
2024-03-23 17:01:22,087 - mmdeploy - INFO - snpe:   None
2024-03-23 17:01:22,087 - mmdeploy - INFO - openvino:   None
2024-03-23 17:01:22,089 - mmdeploy - INFO - torchscript:    1.12.0
2024-03-23 17:01:22,090 - mmdeploy - INFO - torchscript custom ops: NotAvailable
2024-03-23 17:01:22,221 - mmdeploy - INFO - rknn-toolkit:   None
2024-03-23 17:01:22,221 - mmdeploy - INFO - rknn2-toolkit:  None
2024-03-23 17:01:22,222 - mmdeploy - INFO - ascend: None
2024-03-23 17:01:22,223 - mmdeploy - INFO - coreml: None
2024-03-23 17:01:22,224 - mmdeploy - INFO - tvm:    None
2024-03-23 17:01:22,224 - mmdeploy - INFO - 

2024-03-23 17:01:22,224 - mmdeploy - INFO - **********Codebase information**********
2024-03-23 17:01:24,243 - mmdeploy - INFO - mmdet:  2.28.2
2024-03-23 17:01:24,243 - mmdeploy - INFO - mmseg:  None
2024-03-23 17:01:24,243 - mmdeploy - INFO - mmcls:  None
2024-03-23 17:01:24,243 - mmdeploy - INFO - mmocr:  None
2024-03-23 17:01:24,243 - mmdeploy - INFO - mmedit: None
2024-03-23 17:01:24,243 - mmdeploy - INFO - mmdet3d:    None
2024-03-23 17:01:24,243 - mmdeploy - INFO - mmpose: None
2024-03-23 17:01:24,243 - mmdeploy - INFO - mmrotate:   0.3.4
2024-03-23 17:01:24,243 - mmdeploy - INFO - mmaction:   None

### Error traceback

```Shell
2024-03-23 16:57:35,869 - mmdeploy - INFO - Start pipeline mmdeploy.apis.pytorch2onnx.torch2onnx in subprocess
/usr/local/lib/python3.10/dist-packages/mmdet/models/dense_heads/anchor_head.py:116: UserWarning: DeprecationWarning: `num_anchors` is deprecated, for consistency or also use `num_base_priors` instead
  warnings.warn('DeprecationWarning: `num_anchors` is deprecated, '
load checkpoint from local path: /content/oriented_rcnn_r50_fpn_1x_dota_le90-6d2b2ce0.pth
2024-03-23 16:57:39,642 - mmdeploy - WARNING - DeprecationWarning: get_onnx_config will be deprecated in the future. 
2024-03-23 16:57:39,642 - mmdeploy - INFO - Export PyTorch model to ONNX: mmdeploy_models/mmrotate/ort/end2end.onnx.
2024-03-23 16:57:39,650 - mmdeploy - WARNING - Can not find torch._C._jit_pass_onnx_autograd_function_process, function rewrite will not be applied
/usr/local/lib/python3.10/dist-packages/mmdeploy/core/optimizers/function_marker.py:158: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  ys_shape = tuple(int(s) for s in ys.shape)
/usr/local/lib/python3.10/dist-packages/mmdet/models/dense_heads/anchor_head.py:123: UserWarning: DeprecationWarning: anchor_generator is deprecated, please use "prior_generator" instead
  warnings.warn('DeprecationWarning: anchor_generator is deprecated, '
/usr/local/lib/python3.10/dist-packages/mmdet/core/anchor/anchor_generator.py:333: UserWarning: ``grid_anchors`` would be deprecated soon. Please use ``grid_priors`` 
  warnings.warn('``grid_anchors`` would be deprecated soon. '
/usr/local/lib/python3.10/dist-packages/mmdet/core/anchor/anchor_generator.py:369: UserWarning: ``single_level_grid_anchors`` would be deprecated soon. Please use ``single_level_grid_priors`` 
  warnings.warn(
/usr/local/lib/python3.10/dist-packages/mmdeploy/codebase/mmrotate/models/dense_heads/oriented_rpn_head.py:79: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  assert cls_score.size()[-2:] == bbox_pred.size()[-2:]
/usr/local/lib/python3.10/dist-packages/mmdeploy/pytorch/functions/topk.py:28: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
  k = torch.tensor(k, device=input.device, dtype=torch.long)
/usr/local/lib/python3.10/dist-packages/mmrotate/core/bbox/coder/delta_midpointoffset_rbbox_coder.py:78: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  assert pred_bboxes.size(0) == bboxes.size(0)
/usr/local/lib/python3.10/dist-packages/mmrotate/core/bbox/coder/delta_midpointoffset_rbbox_coder.py:79: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  assert bboxes.size(-1) == 4
/usr/local/lib/python3.10/dist-packages/mmrotate/core/bbox/coder/delta_midpointoffset_rbbox_coder.py:80: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  assert pred_bboxes.size(-1) == 6
/usr/local/lib/python3.10/dist-packages/mmdeploy/codebase/mmrotate/core/post_processing/bbox_nms.py:200: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
  iou_threshold = torch.tensor([iou_threshold], dtype=torch.float32)
/usr/local/lib/python3.10/dist-packages/mmdeploy/codebase/mmrotate/core/post_processing/bbox_nms.py:201: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
  score_threshold = torch.tensor([score_threshold], dtype=torch.float32)
/usr/local/lib/python3.10/dist-packages/mmdeploy/mmcv/ops/nms.py:38: TracerWarning: Converting a tensor to a Python float might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  score_threshold = float(score_threshold)
/usr/local/lib/python3.10/dist-packages/mmdeploy/mmcv/ops/nms.py:39: TracerWarning: Converting a tensor to a Python float might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  iou_threshold = float(iou_threshold)
/usr/local/lib/python3.10/dist-packages/mmcv/ops/nms.py:171: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  assert boxes.size(1) == 4
/usr/local/lib/python3.10/dist-packages/mmcv/ops/nms.py:172: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  assert boxes.size(0) == scores.size(0)
/usr/local/lib/python3.10/dist-packages/mmcv/ops/nms.py:31: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  if max_num > 0:
/usr/local/lib/python3.10/dist-packages/mmrotate/models/roi_heads/roi_extractors/rotate_single_level_roi_extractor.py:135: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  if inds.numel() > 0:
/usr/local/lib/python3.10/dist-packages/mmrotate/core/bbox/coder/delta_xywha_rbbox_coder.py:101: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  assert pred_bboxes.size(0) == bboxes.size(0)
/usr/local/lib/python3.10/dist-packages/mmdeploy/mmcv/ops/nms_rotated.py:38: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  if _boxes.shape[0] == 0:
Process Process-2:
Traceback (most recent call last):
  File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/apis/core/pipeline_manager.py", line 107, in __call__
    ret = func(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/apis/pytorch2onnx.py", line 98, in torch2onnx
    export(
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/apis/core/pipeline_manager.py", line 356, in _wrap
    return self.call_function(func_name_, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/apis/core/pipeline_manager.py", line 326, in call_function
    return self.call_function_local(func_name, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/apis/core/pipeline_manager.py", line 275, in call_function_local
    return pipe_caller(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/apis/core/pipeline_manager.py", line 107, in __call__
    ret = func(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/apis/onnx/export.py", line 122, in export
    torch.onnx.export(
  File "/usr/local/lib/python3.10/dist-packages/torch/onnx/__init__.py", line 350, in export
    return utils.export(
  File "/usr/local/lib/python3.10/dist-packages/torch/onnx/utils.py", line 163, in export
    _export(
  File "/usr/local/lib/python3.10/dist-packages/torch/onnx/utils.py", line 1074, in _export
    graph, params_dict, torch_out = _model_to_graph(
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/core/rewriters/rewriter_utils.py", line 402, in wrapper
    return self.func(self, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/apis/onnx/optimizer.py", line 10, in model_to_graph__custom_optimizer
    graph, params_dict, torch_out = ctx.origin_func(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/torch/onnx/utils.py", line 727, in _model_to_graph
    graph, params, torch_out, module = _create_jit_graph(model, args)
  File "/usr/local/lib/python3.10/dist-packages/torch/onnx/utils.py", line 602, in _create_jit_graph
    graph, torch_out = _trace_and_get_graph_from_model(model, args)
  File "/usr/local/lib/python3.10/dist-packages/torch/onnx/utils.py", line 517, in _trace_and_get_graph_from_model
    trace_graph, torch_out, inputs_states = torch.jit._get_trace_graph(
  File "/usr/local/lib/python3.10/dist-packages/torch/jit/_trace.py", line 1175, in _get_trace_graph
    outs = ONNXTracedModule(f, strict, _force_outplace, return_inputs, _return_inputs_states)(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/torch/jit/_trace.py", line 127, in forward
    graph, out = torch._C._create_graph_by_tracing(
  File "/usr/local/lib/python3.10/dist-packages/torch/jit/_trace.py", line 118, in wrapper
    outs.append(self.inner(*trace_inputs))
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1118, in _slow_forward
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/core/rewriters/rewriter_utils.py", line 402, in wrapper
    return self.func(self, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/codebase/mmdet/models/detectors/base.py", line 70, in base_detector__forward
    return __forward_impl(ctx, self, img, img_metas=img_metas, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/core/optimizers/function_marker.py", line 261, in g
    rets = f(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/codebase/mmdet/models/detectors/base.py", line 26, in __forward_impl
    return self.simple_test(img, img_metas, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/mmrotate/models/detectors/two_stage.py", line 183, in simple_test
    return self.roi_head.simple_test(
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/core/rewriters/rewriter_utils.py", line 402, in wrapper
    return self.func(self, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/codebase/mmrotate/models/roi_heads/oriented_standard_roi_head.py", line 33, in rotate_standard_roi_head__simple_test
    det_bboxes, det_labels = self.simple_test_bboxes(
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/core/rewriters/rewriter_utils.py", line 402, in wrapper
    return self.func(self, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/codebase/mmrotate/models/roi_heads/oriented_standard_roi_head.py", line 89, in oriented_standard_roi_head__simple_test_bboxes
    det_bboxes, det_labels = self.bbox_head.get_bboxes(
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/core/rewriters/rewriter_utils.py", line 402, in wrapper
    return self.func(self, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/codebase/mmrotate/models/roi_heads/rotated_bbox_head.py", line 78, in rotated_bbox_head__get_bboxes
    return multiclass_nms_rotated(
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/core/optimizers/function_marker.py", line 261, in g
    rets = f(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/codebase/mmrotate/core/post_processing/bbox_nms.py", line 179, in multiclass_nms_rotated
    return mmdeploy.codebase.mmrotate.core.post_processing.bbox_nms.\
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/codebase/mmrotate/core/post_processing/bbox_nms.py", line 119, in _multiclass_nms_rotated
    selected_indices = ONNXNMSRotatedOp.apply(boxes, scores, iou_threshold,
  File "/usr/local/lib/python3.10/dist-packages/mmdeploy/mmcv/ops/nms_rotated.py", line 44, in forward
    box_inds = ext_module.nms_rotated(_boxes, _scores, order,
TypeError: nms_rotated(): incompatible function arguments. The following argument types are supported:
    1. (dets: at::Tensor, scores: at::Tensor, order: at::Tensor, dets_sorted: at::Tensor, labels: at::Tensor, iou_threshold: float, multi_label: int) -> at::Tensor

Invoked with: tensor([[2.9613e+02, 3.6470e+02, 3.1870e+01, 1.6630e+01, 4.8675e-02],
        [2.9571e+02, 3.6461e+02, 3.2009e+01, 1.5754e+01, 6.2583e-02],
        [2.9613e+02, 3.6507e+02, 3.2207e+01, 1.6008e+01, 5.6807e-02],
        ...,
        [1.9559e+02, 3.1674e+02, 2.6888e+01, 1.0655e+01, 1.0320e-01],
        [6.0005e+02, 7.8433e+01, 5.3136e+01, 1.9420e+01, 1.0007e-01],
        [5.2495e+02, 1.7993e+02, 2.6115e+01, 1.2138e+01, 1.5342e+00]]), tensor([0.9623, 0.9570, 0.9544, 0.9503, 0.9500, 0.9472, 0.9469, 0.9460, 0.9458,
        0.9427, 0.9417, 0.9403, 0.9398, 0.9368, 0.9335, 0.9286, 0.9256, 0.9201,
        0.9195, 0.0558, 0.0673, 0.9143, 0.0567, 0.9104, 0.9051, 0.0706, 0.9046,
        0.9042, 0.9041, 0.9035, 0.9034, 0.0525, 0.8990, 0.8987, 0.0705, 0.8982,
        0.8974, 0.0630, 0.0913, 0.8957, 0.0926, 0.8889, 0.8872, 0.8828, 0.8827,
        0.8789, 0.8781, 0.8740, 0.8728, 0.8727, 0.8723, 0.8717, 0.8707, 0.8653,
        0.8648, 0.0714, 0.8645, 0.8643, 0.8637, 0.8600, 0.8554, 0.8552, 0.8538,
        0.8494, 0.8493, 0.0573, 0.1427, 0.8439, 0.8375, 0.1426, 0.8333, 0.1512,
        0.8328, 0.8328, 0.8321, 0.8268, 0.8218, 0.1352, 0.0826, 0.8171, 0.8160,
        0.8157, 0.1286, 0.8114, 0.1614, 0.0829, 0.8096, 0.8090, 0.8084, 0.8081,
        0.8075, 0.8072, 0.8057, 0.8026, 0.7998, 0.1654, 0.1827, 0.7901, 0.7860,
        0.7859, 0.7857, 0.7831, 0.7819, 0.7802, 0.7791, 0.7771, 0.1603, 0.7677,
        0.7666, 0.7660, 0.7652, 0.7635, 0.7629, 0.7530, 0.1253, 0.7509, 0.7492,
        0.7422, 0.7408, 0.7400, 0.1707, 0.7341, 0.7306, 0.7302, 0.7286, 0.2101,
        0.7262, 0.7243, 0.7191, 0.7161, 0.7155, 0.7122, 0.7099, 0.7090, 0.7088,
        0.2424, 0.7061, 0.7036, 0.0894, 0.6997, 0.0764, 0.6952, 0.6948, 0.6943,
        0.6925, 0.6899, 0.0652, 0.6893, 0.6889, 0.6874, 0.6843, 0.0543, 0.6822,
        0.6697, 0.6685, 0.6637, 0.6624, 0.1288, 0.6533, 0.6522, 0.1406, 0.6462,
        0.6433, 0.0679, 0.6367, 0.6362, 0.6253, 0.6211, 0.6197, 0.2512, 0.3739,
        0.6116, 0.6054, 0.6045, 0.6021, 0.6001, 0.2672, 0.5992, 0.5958, 0.5931,
        0.5867, 0.5848, 0.0843, 0.5778, 0.5764, 0.5722, 0.5721, 0.5690, 0.5624,
        0.5621, 0.5619, 0.5610, 0.4101, 0.5577, 0.2707, 0.5500, 0.5460, 0.5441,
        0.5339, 0.4212, 0.4013, 0.5181, 0.5115, 0.5090, 0.5082, 0.5062, 0.5058,
        0.4528, 0.4694, 0.3026, 0.3086, 0.4935, 0.4895, 0.4731, 0.4721, 0.3375,
        0.4703, 0.4657, 0.2914, 0.4018, 0.4596, 0.4517, 0.4508, 0.4507, 0.4279,
        0.4092, 0.4000, 0.3927, 0.3835, 0.2492, 0.3482, 0.3422, 0.3373, 0.3333,
        0.3272, 0.3221, 0.0621, 0.2943, 0.2933, 0.0506, 0.2690, 0.2187, 0.1824,
        0.1615, 0.0877, 0.1279, 0.0552, 0.1151, 0.0883, 0.0706, 0.0701, 0.0679,
        0.0657, 0.0642, 0.0555]), tensor([  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,
         14,  15,  16,  17,  18,  21,  23,  24,  26,  27,  28,  29,  30,  32,
         33,  35,  36,  39,  41,  42,  43,  44,  45,  46,  47,  48,  49,  50,
         51,  52,  53,  54,  56,  57,  58,  59,  60,  61,  62,  63,  64,  67,
         68,  70,  72,  73,  74,  75,  76,  79,  80,  81,  83,  86,  87,  88,
         89,  90,  91,  92,  93,  94,  97,  98,  99, 100, 101, 102, 103, 104,
        105, 107, 108, 109, 110, 111, 112, 113, 115, 116, 117, 118, 119, 121,
        122, 123, 124, 126, 127, 128, 129, 130, 131, 132, 133, 134, 136, 137,
        139, 141, 142, 143, 144, 145, 147, 148, 149, 150, 152, 153, 154, 155,
        156, 158, 159, 161, 162, 164, 165, 166, 167, 168, 171, 172, 173, 174,
        175, 177, 178, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190,
        191, 193, 195, 196, 197, 198, 201, 202, 203, 204, 205, 206, 211, 212,
        213, 214, 216, 208, 217, 220, 207, 221, 222, 223, 224, 199, 192, 225,
        219, 200, 226, 227, 228, 170, 230, 231, 215, 232, 233, 234, 235, 210,
        209, 237, 238, 218, 194, 240, 176, 169, 229, 135, 241, 125,  96, 242,
        120,  95, 243,  84, 106,  71,  66,  69, 160,  77, 157,  82, 245, 114,
        247,  40,  38, 138, 248, 244, 182,  85,  78, 140,  55,  25, 249,  34,
        250, 163, 251,  20, 252, 146, 253,  37, 236,  65,  22,  19, 254, 246,
        151,  31, 239]), tensor([[ 2.9613e+02,  3.6470e+02,  3.1870e+01,  1.6630e+01,  4.8675e-02],
        [ 2.9571e+02,  3.6461e+02,  3.2009e+01,  1.5754e+01,  6.2583e-02],
        [ 2.9613e+02,  3.6507e+02,  3.2207e+01,  1.6008e+01,  5.6807e-02],
        ...,
        [ 3.0228e+02,  5.6023e+02,  5.8849e+01,  1.4925e+01, -9.4042e-01],
        [ 3.8076e+02,  6.9293e+02,  5.6887e+01,  1.5149e+01, -9.7851e-01],
        [ 1.9726e+02,  5.4943e+02,  4.6851e+01,  1.5591e+01, -1.0051e+00]]), 0.1, 0
2024-03-23 16:57:49,077 - mmdeploy - ERROR - `mmdeploy.apis.pytorch2onnx.torch2onnx` with Call id: 0 failed. exit.
xianmie commented 6 months ago

Did you fix this problem? I met the same problem

xianmie commented 6 months ago

I have solve it! Just find the file "nms_rotated.py" and replace the code in line 44 box_inds = ext_module.nms_rotated(_boxes, _scores, order, dets_sorted, iou_threshold, 0) with labels = torch.ones_like(_scores) * cls_id box_inds = ext_module.nms_rotated(_boxes, _scores, order, dets_sorted, labels, iou_threshold, 0)