likyoo/open-cd

ImportError: cannot import name 'revert_sync_batchnorm' from 'mmcv.cnn.utils'

Closed this issue · 6 comments

Hello

I'm trying to do the training on a Colab notebook, the link is: this

On this notebook I am running the following commands:

!pip3 install -U openmim
!mim install mmengine
!mim install "mmcv>=2.0.0"
!mim install "mmpretrain>=1.0.0rc6"
!pip install "mmsegmentation>=1.0.0"
!pip install "mmdet>=3.0.0"

Followed by:

%cd /content/
!git clone https://github.com/likyoo/open-cd.git
%cd open-cd
!pip install -v -e .

Then:

!python tools/train.py configs/changer/changer_ex_r18_512x512_40k_levircd.py --work-dir ./changer_r18_levir_workdir --gpu-id 0 --seed 307

And get this error:

Traceback (most recent call last):
  File "/content/open-cd/tools/train.py", line 13, in <module>
    from mmcv.cnn.utils import revert_sync_batchnorm
ImportError: cannot import name 'revert_sync_batchnorm' from 'mmcv.cnn.utils' (/usr/local/lib/python3.9/dist-packages/mmcv/cnn/utils/__init__.py)

I read the documentation, open and closed issues of mmsegmentation and mmcv and i couldn't find anything related to this error.

Should I open an issue in the mmcv repository? Or could you guide me where to look for the solution?

From already thank you very much!

please make sure the OpenCD verson you used. The dependencies you list is for v1.x version, but your command (and your code, I guess) is for v0.x.

You're right, I was getting confused with the versions! Thank you!!

You're right, I was getting confused with the versions! Thank you!!
Can you elaborate on how to solve it?please

please make sure the OpenCD verson you used. The dependencies you list is for v1.x version, but your command (and your code, I guess) is for v0.x.

Can you elaborate on how to solve it?please

please make sure the OpenCD verson you used. The dependencies you list is for v1.x version, but your command (and your code, I guess) is for v0.x.

Can you elaborate on how to solve it?please

Here you have a colab notebook to see an example.

please make sure the OpenCD verson you used. The dependencies you list is for v1.x version, but your command (and your code, I guess) is for v0.x.

Can you elaborate on how to solve it?please

Here you have a colab notebook to see an example.

Great! Could you create a PR for this valuable notebook? Maybe you can add a link to it in the README's Usage part.