open-mmlab / mmaction2

OpenMMLab's Next Generation Video Understanding Toolbox and Benchmark
https://mmaction2.readthedocs.io
Apache License 2.0
4.16k stars 1.22k forks source link

AssertionError: Top-down heatmap only supports single instance. Got invalid shape of bbox_center (0,). #2860

Open followingcode opened 2 months ago

followingcode commented 2 months ago

Branch

main branch (1.x version, such as v1.0.0, or dev-1.x branch)

Prerequisite

Environment

sys.platform: linux Python: 3.8.19 (default, Mar 20 2024, 19:58:24) [GCC 11.2.0] CUDA available: True MUSA available: False numpy_random_seed: 2147483648 GPU 0: NVIDIA GeForce RTX 3060 CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 11.3, V11.3.109 GCC: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0 PyTorch: 1.10.1 PyTorch compiling details: PyTorch built with:

TorchVision: 0.11.2 OpenCV: 4.10.0 MMEngine: 0.10.4 MMAction2: 1.2.0+4d6c934 MMCV: 2.1.0 MMDetection: 3.3.0 MMPose: 1.3.1

Describe the bug

Loads checkpoint by http backend from path: https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco-person/faster_rcnn_r50_fpn_1x_coco-person_20201216_175929-d022e227.pth Performing Human Detection for each frame [ ] 0/64, elapsed: 0s, ETA:07/15 09:51:13 - mmengine - WARNING - "FileClient" will be deprecated in future. Please use io functions in https://mmengine.readthedocs.io/en/latest/api/fileio.html#file-io 07/15 09:51:13 - mmengine - WARNING - "HardDiskBackend" is the alias of "LocalBackend" and the former will be deprecated in future. [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 64/64, 9.1 task/s, elapsed: 7s, ETA: 0s

Hard 1-person Example, found 1 tracklet Loads checkpoint by http backend from path: https://download.openmmlab.com/mmpose/top_down/hrnet/hrnet_w32_coco_256x192-c78dce93_20200708.pth /root/mmpose/mmpose/apis/inference.py:121: UserWarning: Can not load dataset_meta from the checkpoint or the model config. Use COCO metainfo by default. warnings.warn('Can not load dataset_meta from the checkpoint or the ' /root/mmpose/mmpose/datasets/datasets/utils.py:102: UserWarning: The metainfo config file "configs/base/datasets/coco.py" does not exist. A matched config file "/root/mmpose/mmpose/.mim/configs/base/datasets/coco.py" will be used instead. warnings.warn( Performing Human Pose Estimation for each frame [ ] 0/64, elapsed: 0s, ETA:Traceback (most recent call last): File "tools/data/skeleton/ntu_pose_extraction.py", line 304, in anno = ntu_pose_extraction(args.video, args.skip_postproc) File "tools/data/skeleton/ntu_pose_extraction.py", line 273, in ntu_pose_extraction keypoints, scores = pose_inference_with_align(args, frame_paths, File "tools/data/skeleton/ntu_pose_extraction.py", line 238, in pose_inference_with_align poseresults, = pose_inference(args.pose_config, args.pose_checkpoint, File "/root/mmaction2/mmaction/apis/inference.py", line 277, in pose_inference = inference_topdown(model, f, d[..., :4], bbox_format='xyxy') File "/root/mmpose/mmpose/apis/inference.py", line 188, in inference_topdown data_list.append(pipeline(data_info)) File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/dataset/base_dataset.py", line 60, in call data = t(data) File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmcv/transforms/base.py", line 12, in call return self.transform(results) File "/root/mmpose/mmpose/datasets/transforms/topdown_transforms.py", line 93, in transform assert results['bbox_center'].shape[0] == 1, ( AssertionError: Top-down heatmap only supports single instance. Got invalid shape of bbox_center (0,). /root/miniconda3/envs/openmmlab/lib/python3.8/tempfile.py:827: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/tmpdmhfux7i'> _warnings.warn(warn_message, ResourceWarning)

Reproduces the problem - code sample

No response

Reproduces the problem - command or script

python tools/data/skeleton/ntu_pose_extraction.py tools/data/skeleton/S001C001P008R002A043_rgb.avi tools/data/skeleton/S001C001P008R002A043.pkl

Reproduces the problem - error message

Loads checkpoint by http backend from path: https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco-person/faster_rcnn_r50_fpn_1x_coco-person_20201216_175929-d022e227.pth Performing Human Detection for each frame [ ] 0/64, elapsed: 0s, ETA:07/15 09:51:13 - mmengine - WARNING - "FileClient" will be deprecated in future. Please use io functions in https://mmengine.readthedocs.io/en/latest/api/fileio.html#file-io 07/15 09:51:13 - mmengine - WARNING - "HardDiskBackend" is the alias of "LocalBackend" and the former will be deprecated in future. [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 64/64, 9.1 task/s, elapsed: 7s, ETA: 0s

Hard 1-person Example, found 1 tracklet Loads checkpoint by http backend from path: https://download.openmmlab.com/mmpose/top_down/hrnet/hrnet_w32_coco_256x192-c78dce93_20200708.pth /root/mmpose/mmpose/apis/inference.py:121: UserWarning: Can not load dataset_meta from the checkpoint or the model config. Use COCO metainfo by default. warnings.warn('Can not load dataset_meta from the checkpoint or the ' /root/mmpose/mmpose/datasets/datasets/utils.py:102: UserWarning: The metainfo config file "configs/base/datasets/coco.py" does not exist. A matched config file "/root/mmpose/mmpose/.mim/configs/base/datasets/coco.py" will be used instead. warnings.warn( Performing Human Pose Estimation for each frame [ ] 0/64, elapsed: 0s, ETA:Traceback (most recent call last): File "tools/data/skeleton/ntu_pose_extraction.py", line 304, in anno = ntu_pose_extraction(args.video, args.skip_postproc) File "tools/data/skeleton/ntu_pose_extraction.py", line 273, in ntu_pose_extraction keypoints, scores = pose_inference_with_align(args, frame_paths, File "tools/data/skeleton/ntu_pose_extraction.py", line 238, in pose_inference_with_align poseresults, = pose_inference(args.pose_config, args.pose_checkpoint, File "/root/mmaction2/mmaction/apis/inference.py", line 277, in pose_inference = inference_topdown(model, f, d[..., :4], bbox_format='xyxy') File "/root/mmpose/mmpose/apis/inference.py", line 188, in inference_topdown data_list.append(pipeline(data_info)) File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/dataset/base_dataset.py", line 60, in call data = t(data) File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmcv/transforms/base.py", line 12, in call return self.transform(results) File "/root/mmpose/mmpose/datasets/transforms/topdown_transforms.py", line 93, in transform assert results['bbox_center'].shape[0] == 1, ( AssertionError: Top-down heatmap only supports single instance. Got invalid shape of bbox_center (0,). /root/miniconda3/envs/openmmlab/lib/python3.8/tempfile.py:827: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/tmpdmhfux7i'> _warnings.warn(warn_message, ResourceWarning)

Additional information

Want to know the cause of the error and how to fix it NTU RGB+D dataset

followingcode commented 1 month ago

tools/data/skeleton/ntu_pose_extraction.py Line 216 needs to be changed to return np.stack([det_results], axis=1)

After the change, there will be no mistakes