mmpose icon indicating copy to clipboard operation
mmpose copied to clipboard

Unable to import MMPoseInferencer in Colab [Bug]

Open Nachiket-ML opened this issue 1 year ago • 4 comments

Prerequisite

  • [X] I have searched Issues and Discussions but cannot get the expected help.
  • [X] The bug has not been fixed in the latest version(https://github.com/open-mmlab/mmpose).

Environment

OrderedDict([('sys.platform', 'linux'), ('Python', '3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]'), ('CUDA available', True), ('MUSA available', False), ('numpy_random_seed', 2147483648), ('GPU 0', 'Tesla T4'), ('CUDA_HOME', '/usr/local/cuda'), ('NVCC', 'Cuda compilation tools, release 12.2, V12.2.140'), ('GCC', 'x86_64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0'), ('PyTorch', '2.2.1+cu121'), ('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 v3.3.2 (Git Hash 2dc95a2ad0841e29db8b22fbccaf3e5da7992b01)\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: AVX512\n - CUDA Runtime 12.1\n - NVCC architecture flags: -gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-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\n - CuDNN 8.9.2\n - Magma 2.6.1\n - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=12.1, CUDNN_VERSION=8.9.2, CXX_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/c++, CXX_FLAGS= -D_GLIBCXX_USE_CXX11_ABI=0 -fabi-version=11 -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 -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-stringop-overflow -Wsuggest-override -Wno-psabi -Wno-error=pedantic -Wno-error=old-style-cast -Wno-missing-braces -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=2.2.1, 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, USE_ROCM_KERNEL_ASSERT=OFF, \n'), ('TorchVision', '0.17.1+cu121'), ('OpenCV', '4.8.0'), ('MMEngine', '0.10.4'), ('MMPose', '1.3.1+5a3be94')])

Reproduces the problem - code sample

!pip3 install openmim !mim install mmengine !mim install "mmcv>=2.0.1"

!git clone https://github.com/open-mmlab/mmpose.git %cd mmpose !pip install -e .

%cd ..

!git clone https://github.com/open-mmlab/mmdetection.git

%cd mmdetection %pip install -v -e . -r requirements/tracking.txt

from mmpose.apis import MMPoseInferencer img_path = 'tests/data/coco/000000000785.jpg' inferencer = MMPoseInferencer('human') result_generator = inferencer(img_path, show=True) result = next(result_generator)

Reproduces the problem - command or script

from mmpose.apis import MMPoseInferencer

Reproduces the problem - error message


AssertionError Traceback (most recent call last) in <cell line: 1>() ----> 1 from mmpose.apis import MMPoseInferencer 2 3 img_path = 'C:\Users\nacho\Downloads\DataSets.v1-video-one.coco\train\Screenshot-2023-04-03-164435_png.rf.74cd225f91b08fd28bd424b85385ad15' # replace this with your own image path 4 5 # instantiate the inferencer using the model alias

4 frames /content/mmpose/mmpose/apis/init.py in 5 extract_pose_sequence, inference_pose_lifter_model) 6 from .inference_tracking import _compute_iou, _track_by_iou, _track_by_oks ----> 7 from .inferencers import MMPoseInferencer, Pose2DInferencer 8 from .visualization import visualize 9

/content/mmpose/mmpose/apis/inferencers/init.py in 1 # Copyright (c) OpenMMLab. All rights reserved. ----> 2 from .hand3d_inferencer import Hand3DInferencer 3 from .mmpose_inferencer import MMPoseInferencer 4 from .pose2d_inferencer import Pose2DInferencer 5 from .pose3d_inferencer import Pose3DInferencer

/content/mmpose/mmpose/apis/inferencers/hand3d_inferencer.py in 18 from mmpose.registry import INFERENCERS 19 from mmpose.structures import PoseDataSample, merge_data_samples ---> 20 from .base_mmpose_inferencer import BaseMMPoseInferencer 21 22 InstanceList = List[InstanceData]

/content/mmpose/mmpose/apis/inferencers/base_mmpose_inferencer.py in 31 32 try: ---> 33 from mmdet.apis.det_inferencer import DetInferencer 34 has_mmdet = True 35 except (ImportError, ModuleNotFoundError):

/content/mmdetection/mmdet/init.py in 15 16 assert (mmcv_version >= digit_version(mmcv_minimum_version) ---> 17 and mmcv_version < digit_version(mmcv_maximum_version)),
18 f'MMCV=={mmcv.version} is used but incompatible. '
19 f'Please install mmcv>={mmcv_minimum_version}, <{mmcv_maximum_version}.'

AssertionError: MMCV==2.2.0 is used but incompatible. Please install mmcv>=2.0.0rc4, <2.2.0.

Additional information

I expected to see an image with pose estimation. I think there is a dependency conflict between mmdet-3.3.0 and mmcv 2.2.0. How do I fix this? I am unable to install mmdet using mim, so that is why I installed from the source in the script above.

Nachiket-ML avatar Apr 30 '24 23:04 Nachiket-ML

Any updates?

NigelHiggs30 avatar May 22 '24 18:05 NigelHiggs30

Also working through the same error at the moment:

MMCV==2.2.0 is used but incompatible.

perry-smartsizer avatar Jul 12 '24 03:07 perry-smartsizer

Using MMCV 2.1.0 seemed to fix the issue.

Nachiket-ML avatar Jul 13 '24 16:07 Nachiket-ML

@Nachiket-ML Mine hangs at !mim install "mmcv==2.1.0" . How long did it take you to install 2.1.0?
Installing 2.2.0 was quick though but was incompatible as the error message above says.

[Edit: turns out it took 23 min for me]

xianjiuqi avatar Sep 06 '24 05:09 xianjiuqi