open-mmlab / mmdeploy

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

[Bug] cascade mask-rcnn + mmdeploy error: [mmdeploy] [error] [instance_segmentation.cpp:78] invalid argument (1)? #2825

Open yangzhiyin opened 2 months ago

yangzhiyin commented 2 months ago

Checklist

Describe the bug

mmdeploy: 1.3.1

cascade mask-rcnn train config:https://github.com/open-mmlab/mmdetection/blob/3.x/configs/cascade_rcnn/cascade-mask-rcnn_r50_fpn_1x_coco.py pt : https://download.openmmlab.com/mmdetection/v2.0/cascade_rcnn/cascade_mask_rcnn_r50_fpn_1x_coco/cascade_mask_rcnn_r50_fpn_1x_coco_20200203-9d4dcb24.pth

model convert to onnx success.

run inference, error: [mmdeploy] [error] [instance_segmentation.cpp:78] invalid argument (1)

how to solve it ?

Reproduction

python example/python/object_detection.py cpu maskrcnn/onnx/mask-rcnn maskrcnn/data/demo.jpg

Environment

python mmdeploy/tools/check_env.py
09/23 15:45:25 - mmengine - INFO -

09/23 15:45:25 - mmengine - INFO - **********Environmental information**********
09/23 15:45:41 - mmengine - INFO - sys.platform: win32
09/23 15:45:41 - mmengine - INFO - Python: 3.9.19 (main, May  6 2024, 20:12:36) [MSC v.1916 64 bit (AMD64)]
09/23 15:45:41 - mmengine - INFO - CUDA available: False
09/23 15:45:41 - mmengine - INFO - MUSA available: False
09/23 15:45:41 - mmengine - INFO - numpy_random_seed: 2147483648
09/23 15:45:41 - mmengine - INFO - MSVC: 用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.39.33523 版
09/23 15:45:41 - mmengine - INFO - GCC: n/a
09/23 15:45:41 - mmengine - INFO - PyTorch: 1.12.1
09/23 15:45:41 - mmengine - INFO - PyTorch compiling details: PyTorch built with:
  - C++ Version: 199711
  - MSVC 192829337
  - Intel(R) Math Kernel Library Version 2020.0.2 Product Build 20200624 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v2.6.0 (Git Hash 52b5f107dd9cf10910aaa19cb47f3abf9b349815)
  - OpenMP 2019
  - LAPACK is enabled (usually provided by MKL)
  - CPU capability usage: AVX2
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CXX_COMPILER=C:/cb/pytorch_1000000000000/work/tmp_bin/sccache-cl.exe, CXX_FLAGS=/DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj -DUSE_PTHREADPOOL -openmp:experimental -IC:/cb/pytorch_1000000000000/work/mkl/include -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DUSE_FBGEMM -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.12.1, USE_CUDA=0, USE_CUDNN=OFF, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=OFF, USE_MPI=OFF, USE_NCCL=OFF, USE_NNPACK=OFF, USE_OPENMP=ON, USE_ROCM=OFF,

09/23 15:45:41 - mmengine - INFO - TorchVision: 0.13.1
09/23 15:45:41 - mmengine - INFO - OpenCV: 4.10.0
09/23 15:45:41 - mmengine - INFO - MMEngine: 0.10.4
09/23 15:45:41 - mmengine - INFO - MMCV: 2.0.1
09/23 15:45:41 - mmengine - INFO - MMCV Compiler: MSVC 192930148
09/23 15:45:41 - mmengine - INFO - MMCV CUDA Compiler: not available
09/23 15:45:41 - mmengine - INFO - MMDeploy: 1.3.1+
09/23 15:45:41 - mmengine - INFO -

09/23 15:45:41 - mmengine - INFO - **********Backend information**********
09/23 15:45:41 - mmengine - INFO - tensorrt:    None
09/23 15:45:42 - mmengine - INFO - ONNXRuntime: 1.8.1
09/23 15:45:42 - mmengine - INFO - ONNXRuntime-gpu:     None
09/23 15:45:42 - mmengine - INFO - ONNXRuntime custom ops:      Available
09/23 15:45:42 - mmengine - INFO - pplnn:       None
09/23 15:45:42 - mmengine - INFO - ncnn:        None
09/23 15:45:42 - mmengine - INFO - snpe:        None
09/23 15:45:42 - mmengine - INFO - openvino:    None
09/23 15:45:42 - mmengine - INFO - torchscript: 1.12.1
09/23 15:45:42 - mmengine - INFO - torchscript custom ops:      NotAvailable
09/23 15:45:42 - mmengine - INFO - rknn-toolkit:        None
09/23 15:45:42 - mmengine - INFO - rknn-toolkit2:       None
09/23 15:45:42 - mmengine - INFO - ascend:      None
09/23 15:45:42 - mmengine - INFO - coreml:      None
09/23 15:45:42 - mmengine - INFO - tvm: None
09/23 15:45:42 - mmengine - INFO - vacc:        None
09/23 15:45:42 - mmengine - INFO -

09/23 15:45:42 - mmengine - INFO - **********Codebase information**********
09/23 15:45:43 - mmengine - INFO - mmdet:       3.1.0
09/23 15:45:43 - mmengine - INFO - mmseg:       None
09/23 15:45:43 - mmengine - INFO - mmpretrain:  1.2.0
09/23 15:45:43 - mmengine - INFO - mmocr:       None
09/23 15:45:43 - mmengine - INFO - mmagic:      None
09/23 15:45:43 - mmengine - INFO - mmdet3d:     None
09/23 15:45:43 - mmengine - INFO - mmpose:      None
09/23 15:45:43 - mmengine - INFO - mmrotate:    None
09/23 15:45:43 - mmengine - INFO - mmaction:    None
09/23 15:45:43 - mmengine - INFO - mmrazor:     None
09/23 15:45:43 - mmengine - INFO - mmyolo:      None

Error traceback

No response

yangzhiyin commented 2 months ago

调试发现,推理结果里面没有masks字段,取而代之的是一个数字"3367"的字段,把它取为masks,则能有正常结果。 image

所以,这里要问,这个3367是从哪里来的?模型转换的时候,需要配置什么参数吗?还是说这本身是一个bug

yangzhiyin commented 2 months ago

用notepad++打开转换后的onnx文件,发现有3367字段。 image

yangzhiyin commented 2 months ago

https://netron.app

image

yangzhiyin commented 2 months ago

有人来处理一下吗?看起来像是个配置的问题