open-mmlab / mmaction2

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

[Bug] demo.py does not work with MMCV2.2.0 #2852

Closed rmuraix closed 4 months ago

rmuraix commented 4 months ago

Branch

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

Prerequisite

Environment

I installed mmaction2 via Docker(docker/Dockerfile) pip freeze in container

addict==2.4.0
aliyun-python-sdk-core==2.15.1
aliyun-python-sdk-kms==2.16.3
backcall @ file:///home/ktietz/src/ci/backcall_1611930011877/work
beautifulsoup4 @ file:///home/linux1/recipes/ci/beautifulsoup4_1610988766420/work
brotlipy==0.7.0
certifi==2021.5.30
cffi @ file:///tmp/build/80754af9/cffi_1613246939562/work
chardet @ file:///tmp/build/80754af9/chardet_1605303159953/work
charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
conda==4.10.1
conda-build==3.21.4
conda-package-handling @ file:///tmp/build/80754af9/conda-package-handling_1618262151086/work
crcmod==1.7
cryptography @ file:///tmp/build/80754af9/cryptography_1616769182610/work
cycler==0.11.0
Cython==3.0.10
decorator @ file:///tmp/build/80754af9/decorator_1621259047763/work
decord==0.6.0
dnspython==2.1.0
einops==0.6.1
filelock @ file:///home/linux1/recipes/ci/filelock_1610993975404/work
fonttools==4.38.0
glob2 @ file:///home/linux1/recipes/ci/glob2_1610991677669/work
idna @ file:///tmp/build/80754af9/idna_1593446292537/work
importlib-metadata==6.7.0
ipython @ file:///tmp/build/80754af9/ipython_1617118429768/work
ipython-genutils @ file:///tmp/build/80754af9/ipython_genutils_1606773439826/work
jedi==0.17.0
Jinja2 @ file:///tmp/build/80754af9/jinja2_1621238361758/work
jmespath==0.10.0
kiwisolver==1.4.5
libarchive-c @ file:///tmp/build/80754af9/python-libarchive-c_1617780486945/work
Markdown==3.4.4
markdown-it-py==2.2.0
MarkupSafe @ file:///tmp/build/80754af9/markupsafe_1621528142364/work
matplotlib==3.5.3
mdurl==0.1.2
mkl-fft==1.3.0
mkl-random @ file:///tmp/build/80754af9/mkl_random_1618853974840/work
mkl-service==2.3.0
-e git+https://github.com/open-mmlab/mmaction2.git@4d6c93474730cad2f25e51109adcf96824efc7a3#egg=mmaction2
mmcv==2.2.0
mmengine==0.10.4
model-index==0.1.11
numpy @ file:///tmp/build/80754af9/numpy_and_numpy_base_1620831194891/work
olefile==0.46
opencv-contrib-python==4.10.0.82
opencv-python==4.10.0.82
opendatalab==0.0.10
openmim==0.3.9
openxlab==0.0.10
ordered-set==4.1.0
oss2==2.17.0
packaging==24.0
pandas==1.3.5
parso @ file:///tmp/build/80754af9/parso_1617223946239/work
pexpect @ file:///tmp/build/80754af9/pexpect_1605563209008/work
pickleshare @ file:///tmp/build/80754af9/pickleshare_1606932040724/work
Pillow @ file:///tmp/build/80754af9/pillow_1617386154241/work
pkginfo==1.7.0
platformdirs==4.0.0
prompt-toolkit @ file:///tmp/build/80754af9/prompt-toolkit_1616415428029/work
psutil @ file:///tmp/build/80754af9/psutil_1612298016854/work
ptyprocess @ file:///tmp/build/80754af9/ptyprocess_1609355006118/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl
pycosat==0.6.3
pycparser @ file:///tmp/build/80754af9/pycparser_1594388511720/work
pycryptodome==3.20.0
pygments==2.17.2
pyOpenSSL @ file:///tmp/build/80754af9/pyopenssl_1605545627475/work
pyparsing==3.1.2
PySocks @ file:///tmp/build/80754af9/pysocks_1594394576006/work
python-dateutil==2.9.0.post0
python-etcd==0.4.5
pytz==2023.4
PyYAML==6.0.1
requests==2.28.2
rich==13.7.1
ruamel-yaml-conda @ file:///tmp/build/80754af9/ruamel_yaml_1616016701961/work
scipy==1.7.3
six @ file:///tmp/build/80754af9/six_1605205313296/work
soupsieve @ file:///tmp/build/80754af9/soupsieve_1616183228191/work
tabulate==0.9.0
termcolor==2.3.0
tomli==2.0.1
torch==1.8.1
torchelastic==0.2.0
torchtext==0.9.1
torchvision==0.9.1
tqdm==4.65.2
traitlets @ file:///home/ktietz/src/ci/traitlets_1611929699868/work
typing-extensions==4.7.1
urllib3 @ file:///tmp/build/80754af9/urllib3_1603305693037/work
wcwidth @ file:///tmp/build/80754af9/wcwidth_1593447189090/work
yapf==0.40.2
zipp==3.15.0

Describe the bug

After starting the mmaction2 Docker container, I tried to run the demo according to the documentation.

However, the demo failed to run because MMCV2.2.0 was installed. I specified MMCV2.1.0 and it worked fine.

Reproduces the problem - code sample

No response

Reproduces the problem - command or script

docker build -f ./docker/Dockerfile --rm -t mmaction2 .
docker run --gpus all --shm-size=8g -it -v ./data:/mmaction2/data mmaction2

# in a container
mim download mmaction2 --config tsn_imagenet-pretrained-r50_8xb32-1x1x8-100e_kinetics400-rgb --dest .
# The demo.mp4 and label_map_k400.txt are both from Kinetics-400
python demo/demo.py tsn_imagenet-pretrained-r50_8xb32-1x1x8-100e_kinetics400-rgb.py \
    tsn_imagenet-pretrained-r50_8xb32-1x1x8-100e_kinetics400-rgb_20220906-2692d16c.pth \
    demo/demo.mp4 tools/data/kinetics/label_map_k400.txt

Reproduces the problem - error message

Traceback (most recent call last):
  File "demo/demo.py", line 9, in <module>
    from mmaction.apis import inference_recognizer, init_recognizer
  File "/mmaction2/mmaction/__init__.py", line 18, in <module>
    f'MMCV=={mmcv.__version__} is used but incompatible. ' \
AssertionError: MMCV==2.2.0 is used but incompatible. Please install mmcv>=2.0.0rc4, <2.2.0.

Additional information

No response

rmuraix commented 4 months ago

Sorry, I mistakenly thought that mmaction2 supported MMCV2.2.0

22222222z commented 3 months ago

I meet the same question. How did you solve it?

rmuraix commented 3 months ago

I meet the same question. How did you solve it?

I changed this line in the docker/Dockerfile as follows.

RUN mim install mmengine mmcv==2.1.0

Current MMaction seems to require less than MMCV 2.2.0: https://github.com/open-mmlab/mmaction2/blob/4d6c93474730cad2f25e51109adcf96824efc7a3/mmaction/__init__.py#L8-L19