Skip to content

[Bug] Quantized RTMDet model does not detect objects/humans  #2871

Open
@guntisuSICKAG

Description

@guntisuSICKAG

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

After I downloaded the model configs and checkpoints of rtmdet_small (rtmdet_s_8xb32-300e_coco_20220905_161602-387a891e) model, I converted the model to onnx backend using torch2onnx and then to tensorrt backend using onnx2tensorrt along with the calibration file generated using create_calib_input_data for quantization purposes. The resulting quantized model does not detect objects/humans. However, when I tested the quantized YoloX and DeTR models, they could detect humans pretty well.

Reproduction

  1. Download the RTMDet model using "mim download mmdet --config rtmdet_s_8xb32-300e_coco_20220905_161602-387a891e --dest ." .
  2. Generate calibration file using create_calib_input_data from mmdeploy.apis.calibration
  3. Conversion to ONNX backend using torch2onnx from mmdeploy.apis
  4. Conversion to TRT backend using onnx2tensorrt from mmdeploy.backend.tensorrt.onnx2tensorrt

Environment

Environment Info:

01/13 13:24:38 - mmengine - INFO - 

01/13 13:24:38 - mmengine - INFO - **********Environmental information**********
01/13 13:24:39 - mmengine - INFO - sys.platform: linux
01/13 13:24:39 - mmengine - INFO - Python: 3.8.10 (default, Nov  7 2024, 13:10:47) [GCC 9.4.0]
01/13 13:24:39 - mmengine - INFO - CUDA available: True
01/13 13:24:39 - mmengine - INFO - MUSA available: False
01/13 13:24:39 - mmengine - INFO - numpy_random_seed: 2147483648
01/13 13:24:39 - mmengine - INFO - GPU 0: Orin
01/13 13:24:39 - mmengine - INFO - CUDA_HOME: /usr/local/cuda
01/13 13:24:39 - mmengine - INFO - NVCC: Cuda compilation tools, release 11.4, V11.4.315
01/13 13:24:39 - mmengine - INFO - GCC: aarch64-linux-gnu-gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
01/13 13:24:39 - mmengine - INFO - PyTorch: 1.11.0
01/13 13:24:39 - mmengine - INFO - PyTorch compiling details: PyTorch built with:
  - GCC 9.4
  - C++ Version: 201402
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - LAPACK is enabled (usually provided by MKL)
  - NNPACK is enabled
  - CPU capability usage: NO AVX
  - CUDA Runtime 11.4
  - NVCC architecture flags: -gencode;arch=compute_72,code=sm_72;-gencode;arch=compute_87,code=sm_87
  - CuDNN 8.6
    - Built with CuDNN 8.3.2
  - Build settings: BLAS_INFO=open, BUILD_TYPE=Release, CUDA_VERSION=11.4, CUDNN_VERSION=8.3.2, CXX_COMPILER=/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -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-sign-compare -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 -Werror=cast-function-type -Wno-stringop-overflow, FORCE_FALLBACK_CUDA_MPI=1, LAPACK_INFO=open, TORCH_VERSION=1.11.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EIGEN_FOR_BLAS=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=OFF, USE_MKLDNN=OFF, USE_MPI=ON, USE_NCCL=0, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, 

01/13 13:24:39 - mmengine - INFO - TorchVision: 0.12.0a0+9b5a3fe
01/13 13:24:39 - mmengine - INFO - OpenCV: 4.10.0
01/13 13:24:39 - mmengine - INFO - MMEngine: 0.10.5
01/13 13:24:39 - mmengine - INFO - MMCV: 2.1.0
01/13 13:24:39 - mmengine - INFO - MMCV Compiler: GCC 9.4
01/13 13:24:39 - mmengine - INFO - MMCV CUDA Compiler: 11.4
01/13 13:24:39 - mmengine - INFO - MMDeploy: 1.3.1+af7ac02
01/13 13:24:39 - mmengine - INFO - 

01/13 13:24:39 - mmengine - INFO - **********Backend information**********
01/13 13:24:39 - mmengine - INFO - tensorrt:    8.5.2.2
01/13 13:24:39 - mmengine - INFO - tensorrt custom ops: Available
01/13 13:24:39 - mmengine - INFO - ONNXRuntime: None
01/13 13:24:39 - mmengine - INFO - ONNXRuntime-gpu:     1.16.0
01/13 13:24:39 - mmengine - INFO - ONNXRuntime custom ops:      NotAvailable
01/13 13:24:39 - mmengine - INFO - pplnn:       None
01/13 13:24:39 - mmengine - INFO - ncnn:        None
01/13 13:24:39 - mmengine - INFO - snpe:        None
01/13 13:24:39 - mmengine - INFO - openvino:    None
01/13 13:24:39 - mmengine - INFO - torchscript: 1.11.0
01/13 13:24:39 - mmengine - INFO - torchscript custom ops:      NotAvailable
01/13 13:24:39 - mmengine - INFO - rknn-toolkit:        None
01/13 13:24:39 - mmengine - INFO - rknn-toolkit2:       None
01/13 13:24:39 - mmengine - INFO - ascend:      None
01/13 13:24:39 - mmengine - INFO - coreml:      None
01/13 13:24:39 - mmengine - INFO - tvm: None
01/13 13:24:39 - mmengine - INFO - vacc:        None
01/13 13:24:39 - mmengine - INFO - 

01/13 13:24:39 - mmengine - INFO - **********Codebase information**********
01/13 13:24:39 - mmengine - INFO - mmdet:       3.2.0
01/13 13:24:39 - mmengine - INFO - mmseg:       None
01/13 13:24:39 - mmengine - INFO - mmpretrain:  None
01/13 13:24:39 - mmengine - INFO - mmocr:       None
01/13 13:24:39 - mmengine - INFO - mmagic:      None
01/13 13:24:39 - mmengine - INFO - mmdet3d:     None
01/13 13:24:39 - mmengine - INFO - mmpose:      1.3.2
01/13 13:24:39 - mmengine - INFO - mmrotate:    None
01/13 13:24:39 - mmengine - INFO - mmaction:    None
01/13 13:24:39 - mmengine - INFO - mmrazor:     None
01/13 13:24:39 - mmengine - INFO - mmyolo:      None

Error traceback

No response

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