Closed mmis00112 closed 1 year ago
I also encounter the same error, revert to version1.0.0 works
@zzhang2816 @mmis00112 This is a bug caused by mmengine 0.8.3, they will fix it soon. You can install mmengine==0.8.2 to avoid it .
Thanks for the solid advice.
We are always grateful for your wonderful development.
Prerequisite
Environment
Run on google colab to demonstrate inference.
・python -c "from mmpose.utils import collect_env; print(collect_env())" {result} OrderedDict([('sys.platform', 'linux'), ('Python', '3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]'), ('CUDA available', True), ('numpy_random_seed', 2147483648), ('GPU 0', 'Tesla T4'), ('CUDA_HOME', '/usr/local/cuda'), ('NVCC', 'Cuda compilation tools, release 11.8, V11.8.89'), ('GCC', 'x86_64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0'), ('PyTorch', '2.0.1+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 - CUDA Runtime 11.8\n - NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-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.7\n - Magma 2.6.1\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.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, \n'), ('TorchVision', '0.15.2+cu118'), ('OpenCV', '4.7.0'), ('MMEngine', '0.8.3'), ('MMPose', '1.1.0+537bd8e')])
Reproduces the problem - code sample
Visualize the output results according to https://mmpose.readthedocs.io/en/latest/user_guides/inference.html#visualization
Reproduces the problem - command or script
i tried two ways. [cmd] !python demo/inferencer_demo.py 'tests/data/coco/000000000785.jpg' --pose2d 'human' --vis-out-dir './out' --pred-out-dir './pred'
and
[cord] from mmpose.apis import MMPoseInferencer
img_path = 'tests/data/coco/000000000785.jpg' # replace this with your own image path
instantiate the inferencer using the model alias
inferencer = MMPoseInferencer('human')
The MMPoseInferencer API employs a lazy inference approach,
creating a prediction generator when given input
result_generator = inferencer(img_path,out_dir = './out',retuen_vis=True ) result = next(result_generator)
Reproduces the problem - error message
Loads checkpoint by http backend from path: https://download.openmmlab.com/mmpose/v1/projects/rtmposev1/rtmpose-m_simcc-aic-coco_pt-aic-coco_420e-256x192-63eb25f7_20230126.pth 08/02 03:45:24 - mmengine - WARNING - Failed to search registry with scope "mmpose" 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 "mmpose" is a correct scope, or whether the registry is initialized. Loads checkpoint by http backend from path: https://download.openmmlab.com/mmdetection/v3.0/rtmdet/rtmdet_m_8xb32-300e_coco/rtmdet_m_8xb32-300e_coco_20220719_112220-229f527c.pth The model and loaded state dict do not match exactly
unexpected key in source state_dict: data_preprocessor.mean, data_preprocessor.std
08/02 03:45:25 - 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. /usr/local/lib/python3.10/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 ../aten/src/ATen/native/TensorShape.cpp:3483.) return _VF.meshgrid(tensors, kwargs) # type: ignore[attr-defined] Inference ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
main()
File "/content/mmpose/demo/inferencerdemo.py", line 180, in main
for in inferencer( call_args):
File "/content/mmpose/mmpose/apis/inferencers/mmpose_inferencer.py", line 202, in call
visualization = self.visualize(ori_inputs, preds,
File "/content/mmpose/mmpose/apis/inferencers/mmpose_inferencer.py", line 238, in visualize
return self.inferencer.visualize(
File "/content/mmpose/mmpose/apis/inferencers/base_mmpose_inferencer.py", line 330, in visualize
visualization = self.visualizer.add_datasample(
File "/usr/local/lib/python3.10/dist-packages/mmengine/dist/utils.py", line 401, in wrapper
return func(*args, *kwargs)
File "/content/mmpose/mmpose/visualization/local_visualizer.py", line 581, in add_datasample
self.add_image(name, drawn_img, step)
File "/usr/local/lib/python3.10/dist-packages/mmengine/dist/utils.py", line 401, in wrapper
return func(args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/mmengine/visualization/visualizer.py", line 1082, in add_image
vis_backend.add_image(name, image, step) # type: ignore
File "/usr/local/lib/python3.10/dist-packages/mmengine/visualization/vis_backend.py", line 56, in wrapper
obj._init_env() # type: ignore
File "/usr/local/lib/python3.10/dist-packages/mmengine/visualization/vis_backend.py", line 212, in _init_env
if not os.path.exists(self._save_dir):
File "/usr/lib/python3.10/genericpath.py", line 19, in exists
os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
Traceback (most recent call last): File "/content/mmpose/demo/inferencer_demo.py", line 185, in
Additional information
I've tried a few things and without --vis-out-dir it works fine. --vis-out results only not available. Available in Prered.
Sorry if it was my simple mistake. I would appreciate it if you could help me.