open-mmlab / mmaction2

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

[Bug] long-video-demo raised AssertionError on assert crop_h == img_h or crop_w == img_w #2783

Open vba34520 opened 9 months ago

vba34520 commented 9 months ago

Branch

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

Prerequisite

Environment

sys.platform: win32 Python: 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] CUDA available: True MUSA available: False numpy_random_seed: 2147483648 GPU 0: NVIDIA GeForce RTX 3060 Laptop GPU CUDA_HOME: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1 NVCC: Cuda compilation tools, release 11.1, V11.1.74 MSVC: 用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.29.30153 版 GCC: n/a PyTorch: 1.12.1+cu113 PyTorch compiling details: PyTorch built with:

TorchVision: 0.13.1+cu113 OpenCV: 4.9.0 MMEngine: 0.10.3 MMAction2: 1.2.0+4d6c934 MMCV: 2.1.0 MMDetection: 3.3.0

Describe the bug

At long-video-demo

python demo/long_video_demo.py configs/recognition/i3d/i3d_imagenet-pretrained-r50_8xb8-32x2x1-100e_kinetics400-rgb.py \
  checkpoints/i3d_imagenet-pretrained-r50_8xb8-32x2x1-100e_kinetics400-rgb_20220812-e213c223.pth PATH_TO_LONG_VIDEO tools/data/kinetics/label_map_k400.txt PATH_TO_SAVED_VIDEO \
  --label-color 255 255 0

not suitable for my video with 1920×1080.

It raised AssertionError:

  File "demo/long_video_demo.py", line 270, in <module>
    main()
  File "demo/long_video_demo.py", line 266, in main
    show_results(model, data, label, args)
  File "demo/long_video_demo.py", line 172, in show_results
    ret, scores = inference(model, data, args, frame_queue)
  File "demo/long_video_demo.py", line 217, in inference
    result = inference_recognizer(
  File "d:\mycode\mmaction2\mmaction\apis\inference.py", line 105, in inference_recognizer
    data = test_pipeline(data)
  File "C:\Users\Administrator\Envs\test\lib\site-packages\mmengine\dataset\base_dataset.py", line 60, in __call__
    data = t(data)
  File "C:\Users\Administrator\Envs\test\lib\site-packages\mmcv\transforms\base.py", line 12, in __call__
    return self.transform(results)
  File "d:\mycode\mmaction2\mmaction\datasets\transforms\processing.py", line 1168, in transform
    assert crop_h == img_h or crop_w == img_w

Thanks a lot.

Reproduces the problem - code sample

No response

Reproduces the problem - command or script

No response

Reproduces the problem - error message

No response

Additional information

No response

fengjingchehu commented 8 months ago

i wonder how can i get files like checkpoints/i3d_imagenet-pretrained-r50_8xb8-32x2x1-100e_kinetics400-rgb_20220812-e213c223.pth ?

deeperrrr commented 8 months ago

i wonder how can i get files like checkpoints/i3d_imagenet-pretrained-r50_8xb8-32x2x1-100e_kinetics400-rgb_20220812-e213c223.pth ?我想知道如何获取像 checkpoints/i3d_imagenet-pretrained-r50_8xb8-32x2x1-100e_kinetics400-rgb_20220812-e213c223.pth 这样的文件?

is here~ https://download.openmmlab.com/mmaction/v1.0/recognition/i3d/i3d_imagenet-pretrained-r50_8xb8-32x2x1-100e_kinetics400-rgb/i3d_imagenet-pretrained-r50_8xb8-32x2x1-100e_kinetics400-rgb_20220812-e213c223.pth

fengjingchehu commented 8 months ago

Thank you for sharing !

fengjingchehu commented 8 months ago

god, i meet the same question. File "mmaction2-main/mmaction/datasets/transforms/processing.py", line 1168, in transform assert crop_h == img_h or crop_w == img_w AssertionError

This should be a matter of video size.

St4r4x commented 7 months ago

This issue occurs when using the ThreeCrop method with the longvideodemo script. I resolved this issue by modifying the crop method in the configuration file.

PopGreen69 commented 6 months ago

@St4r4x Hi, may I ask the details about how modify the crop method in the configuration file?

St4r4x commented 6 months ago

I replaced ThreeCrop method by CenterCrop

PopGreen69 commented 6 months ago

I replaced ThreeCrop method by CenterCrop

It works, thank you so much ! @St4r4x

Kataglyphis commented 4 months ago

The resize filter in the test_pipeline seems to be corrupt. I could fix the demo with adding manual resizing into line 209: resized_windows = [cv2.resize(frame, (224, 224)) for frame in cur_windows]

line 213 change cur_windows into resized_windows respectively.