open-mmlab / mmpose

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

Skeleton Style #2351

Closed ryanraposo closed 1 year ago

ryanraposo commented 1 year ago

Prerequisite

Environment

OrderedDict([('sys.platform', 'linux'), ('Python', '3.10.11 (main, Apr  5 2023, 14:15:10) [GCC 9.4.0]'), ('CUDA available', False), ('numpy_random_seed', 2147483648), ('GCC', 'x86_64-linux-gnu-gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0'), ('PyTorch', '2.0.0+cu118'), ('PyTorch compiling details', 'PyTorch built with:\n  - GCC 9.3\n  - C++ Version: 201703\n  - Intel(R) oneAPI Math Kernel Library Version 2022.2-Product Build 20220804 for Intel(R) 64 architecture applications\n  - Intel(R) MKL-DNN v2.7.3 (Git Hash 6dbeffbae1f23cbbeae17adb7b5b13f1f37c080e)\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  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.8, CUDNN_VERSION=8.7.0, CXX_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/c++, CXX_FLAGS= -D_GLIBCXX_USE_CXX11_ABI=0 -fabi-version=11 -Wno-deprecated -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=OFF, USE_NCCL=1, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, \n'), ('TorchVision', '0.15.1+cu118'), ('OpenCV', '4.7.0'), ('MMEngine', '0.7.3'), ('MMPose', '1.0.0+dab2fdf')])

Reproduces the problem - code sample

https://colab.research.google.com/drive/1yCAxNcwywjqD8IoU3Vf_0JS-Jtqk184F?usp=sharing

Reproduces the problem - command or script

%cd /content/mmpose/
!python demo/image_demo.py \
    /content/justus-menke.jpg \
    /content/mmpose/configs/wholebody_2d_keypoint/topdown_heatmap/coco-wholebody/td-hm_res152_8xb32-210e_coco-wholebody-384x288.py \
    https://download.openmmlab.com/mmpose/top_down/resnet/res152_coco_wholebody_384x288-eab8caa8_20201004.pth \
    --out-file result.jpg \
    --device=cpu \
    --skeleton-style='openpose'

Reproduces the problem - error message

Loads checkpoint by http backend from path: https://download.openmmlab.com/mmpose/top_down/resnet/res152_coco_wholebody_384x288-eab8caa8_20201004.pth
/content/mmpose/configs/_base_/datasets/coco_wholebody.py
.py
05/11 11:41:29 - mmengine - WARNING - `Visualizer` backend is not initialized because save_dir is None.
Traceback (most recent call last):
  File "/content/mmpose/demo/image_demo.py", line 105, in <module>
    main()
  File "/content/mmpose/demo/image_demo.py", line 90, in main
    visualizer.add_datasample(
  File "/usr/local/lib/python3.10/dist-packages/mmengine/dist/utils.py", line 366, in wrapper
    return func(*args, **kwargs)
  File "/content/mmpose/mmpose/visualization/local_visualizer.py", line 536, in add_datasample
    pred_img_data = self._draw_instances_kpts(
  File "/content/mmpose/mmpose/visualization/local_visualizer.py", line 302, in _draw_instances_kpts
    raise ValueError(
ValueError: the length of kpt_color (133) does not matches that of keypoints (134)

Additional information

Having issues with --skeleton-style='openpose'.

I read that the 'openpose' style is meant for 17 point. Is this where I'm going wrong? I've tried a few models.

I'm most suspicious of the fact that the kpt_colors array is only short by a single color.

ryanraposo commented 1 year ago

Found a model it works with.

%cd /content/mmpose/
!python demo/image_demo.py \
    /content/walking.jpg \
    /content/mmpose/configs/body_2d_keypoint/topdown_heatmap/coco/td-hm_res152_8xb32-210e_coco-384x288.py \
    https://download.openmmlab.com/mmpose/v1/body_2d_keypoint/topdown_heatmap/coco/td-hm_res152_8xb32-210e_coco-384x288-7fbb906f_20220927.pth \
    --out-file result.jpg \
    --device=cpu \
    --skeleton-style='openpose'