open-mmlab / mmpose

OpenMMLab Pose Estimation Toolbox and Benchmark.
https://mmpose.readthedocs.io/en/latest/
Apache License 2.0
5.55k stars 1.21k forks source link

[Bug] RTMDet works perfectly with mmdet::image_demo.py but no detections with topdown_demo_with_mmdet #2295

Closed robotville closed 1 year ago

robotville commented 1 year ago

Prerequisite

Environment

OrderedDict([('sys.platform', 'linux'), ('Python', '3.8.10 (default, Nov 14 2022, 12:59:47) [GCC 9.4.0]'), ('CUDA available', True), ('numpy_random_seed', 2147483648), ('GPU 0,1', 'NVIDIA GeForce RTX 4090'), ('CUDA_HOME', '/usr/local/cuda'), ('NVCC', 'Cuda compilation tools, release 12.1, V12.1.66'), ('GCC', 'x86_64-linux-gnu-gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0'), ('PyTorch', '2.0.0a0+1767026'), ('PyTorch compiling details', 'PyTorch built with:\n - GCC 9.4\n - C++ Version: 201703\n - Intel(R) oneAPI Math Kernel Library Version 2021.1-Product Build 20201104 for Intel(R) 64 architecture applications\n - Intel(R) MKL-DNN v2.7.3 (Git Hash N/A)\n - OpenMP 201511 (a.k.a. OpenMP 4.5)\n - LAPACK is enabled (usually provided by MKL)\n - NNPACK is enabled\n - CPU capability usage: AVX2\n - CUDA Runtime 12.1\n - NVCC architecture flags: -gencode;arch=compute_52,code=sm_52;-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_90,code=compute_90\n - CuDNN 8.8.1 (built against CUDA 12.0)\n - Magma 2.6.2\n - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=12.1, CUDNN_VERSION=8.8.1, CXX_COMPILER=/usr/bin/c++, CXX_FLAGS=-fno-gnu-unique -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Werror=bool-operation -Wnarrowing -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wunused-local-typedefs -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -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, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_DISABLE_GPU_ASSERTS=ON, TORCH_VERSION=2.0.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=ON, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, \n'), ('TorchVision', '0.15.0a0'), ('OpenCV', '4.6.0'), ('MMEngine', '0.7.2'), ('MMPose', '1.0.0+')])

mmcv 2.0.0 mmdet 3.0.0
mmengine 0.7.2 mmpose 1.0.0

Reproduces the problem - code sample

The only code used were existing scripts: mmdetection/demo/image_demo.py mmpose/demo/topdown_demo_with_mmdet.py

image_demo.py WORKS MMPose demo topdown_demo_with_mmdet.py fails to produce any detection!

Reproduces the problem - command or script

The only code used were existing scripts:

python ../mmdetection/demo/image_demo.py 0166f0b1-19d3-435a-b2bc-ba85ba2d0cfa.png rtmdet_m_640-8xb32_coco-person.py --weights epoch_5.pth --device cuda

python demo/topdown_demo_with_mmdet.py --input 0166f0b1-19d3-435a-b2bc-ba85ba2d0cfa.png --output-root demo-mmdet-pose --save-predictions rtmdet_m_640-8xb32_coco-person.py epoch_5.pth rtmpose-m_8xb256-420e_coco-384x288.py best_coco_AP_epoch_160.pth

Reproduces the problem - error message

image_demo.py WORKS ... output below

NOTE! Installing ujson may make loading annotations faster. Loads checkpoint by local backend from path: epoch_5.pth 04/23 13:20:32 - mmengine - WARNING - Failed to search registry with scope "mmdet" in the "function" registry tree. As a workaround, the current "function" registry in "mmengine" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmdet" is a correct scope, or whether the registry is initialized. 04/23 13:20:32 - mmengine - WARNING - Visualizer backend is not initialized because save_dir is None. /usr/local/lib/python3.8/dist-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at /opt/pytorch/pytorch/aten/src/ATen/native/TensorShape.cpp:3483.) return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] Inference ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
results have been saved at outputs

MMPose demo fails to produce any detection! python demo/topdown_demo_with_mmdet.py

NOTE! Installing ujson may make loading annotations faster. Loads checkpoint by local backend from path: epoch_5.pth Loads checkpoint by local backend from path: best_coco_AP_epoch_160.pth /usr/local/lib/python3.8/dist-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at /opt/pytorch/pytorch/aten/src/ATen/native/TensorShape.cpp:3483.) return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] /bg-data/mmpose/mmpose/structures/utils.py:36: UserWarning: Try to merge an empty list of data samples. warnings.warn('Try to merge an empty list of data samples.') predictions have been saved at demo-mmdet-pose/results_0166f0b1-19d3-435a-b2bc-ba85ba2d0cfa.json

Additional information

I am training with a custom COCO dataset My COCO formatted dataset has no segmentation labels, only BBOX

Ben-Louis commented 1 year ago

Thanks for using MMPose. You may need to verify the following:

  1. Confirm that the category ID for 'person' in your dataset is 0. If this is not the case, specify the argument --det-cat-id when executing demo/topdown_demo_with_mmdet.py.
  2. Ensure that the score of the predicted boxes exceeds 0.3. If it does not, consider adjusting the threshold by specifying --bbox-thr=0 in your command.
robotville commented 1 year ago

Specifying the det-cat-id parameter fixed my problem perfectly. Thanks for the rapid excellent response!