Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What version of dependencies are used? #12

Closed
joakimjohnander opened this issue Sep 11, 2020 · 13 comments
Closed

What version of dependencies are used? #12

joakimjohnander opened this issue Sep 11, 2020 · 13 comments

Comments

@joakimjohnander
Copy link

Hey,

I have tried to run SipMask-VIS, but get
ImportError: cannot import name 'get_dist_info' from 'mmcv.runner.utils'
and upon checking mmcv, it seems like get_dist_info has been deprecated for quite some time. How would I most easily run your code? I will supply the docker file I used below.

ARG PYTORCH="1.4"
ARG CUDA="10.1"
ARG CUDNN="7"

FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel

RUN apt-get update && apt-get install -y ffmpeg libglib2.0-0 libsm6 libxrender-dev libxext6 gcc git

# Install mmdetection
RUN conda install cython -y
RUN pip install mmcv-full==latest+torch1.4.0+cu101 -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.\
html
RUN git clone https://github.com/open-mmlab/mmdetection.git /mmdetection
WORKDIR /mmdetection
RUN pip install -e .
RUN python setup.py develop
RUN git clone https://github.com/youtubevos/cocoapi.git /cocoapi
WORKDIR /cocoapi/PythonAPI
RUN pip uninstall -y pycocotools
RUN python setup.py build_ext install
RUN git clone https://github.com/JialeCao001/SipMask.git /SipMask
WORKDIR /SipMask/SipMask-VIS
ENV TORCH_CUDA_ARCH_LIST="3.5;3.7;5.0;5.2;6.0+PTX;6.1+PTX;7.0+PTX;7.5+PTX"
RUN pip install -e .

Best regards,
Joakim

@JialeCao001
Copy link
Owner

@joakimjohnander PyTorch1.1.0, cuda9.0/10.0, and mmcv0.2.1 are used by me. Please refer to Readme for more details.

@OneDirection9
Copy link

Hi @JialeCao001 , I am using mmcv==0.2.1, but following ImportError occurred:

ImportErrorImportError: : cannot import name 'caffe2_xavier_init' from 'mmcv.cnn.weight_init'

@JialeCao001
Copy link
Owner

@OneDirection9 Can you provide more details? Are you sure that mmcv==0.2.1 is successfully installed? It is difficult for me to judge the problem based on your description.

@OneDirection9
Copy link

@JialeCao001 Thanks for your reply. Here is the details:

(open-mmlab) ➜  SipMask-VIS git:(master) ✗ pip install mmcv==0.2.1
Requirement already satisfied: mmcv==0.2.1 in /anaconda3/envs/open-mmlab/lib/python3.7/site-packages (0.2.1)
Requirement already satisfied: pyyaml in /anaconda3/envs/open-mmlab/lib/python3.7/site-packages (from mmcv==0.2.1) (5.3.1)
Requirement already satisfied: six in /anaconda3/envs/open-mmlab/lib/python3.7/site-packages (from mmcv==0.2.1) (1.15.0)
Requirement already satisfied: requests in /anaconda3/envs/open-mmlab/lib/python3.7/site-packages (from mmcv==0.2.1) (2.24.0)
Requirement already satisfied: numpy>=1.11.1 in /anaconda3/envs/open-mmlab/lib/python3.7/site-packages (from mmcv==0.2.1) (1.17.0)
Requirement already satisfied: opencv-python in /anaconda3/envs/open-mmlab/lib/python3.7/site-packages (from mmcv==0.2.1) (4.4.0.42)
Requirement already satisfied: addict in /anaconda3/envs/open-mmlab/lib/python3.7/site-packages (from mmcv==0.2.1) (2.2.1)
Requirement already satisfied: chardet<4,>=3.0.2 in /anaconda3/envs/open-mmlab/lib/python3.7/site-packages (from requests->mmcv==0.2.1) (3.0.4)
Requirement already satisfied: idna<3,>=2.5 in /anaconda3/envs/open-mmlab/lib/python3.7/site-packages (from requests->mmcv==0.2.1) (2.10)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /anaconda3/envs/open-mmlab/lib/python3.7/site-packages (from requests->mmcv==0.2.1) (1.25.10)
Requirement already satisfied: certifi>=2017.4.17 in /anaconda3/envs/open-mmlab/lib/python3.7/site-packages (from requests->mmcv==0.2.1) (2020.6.20)
(open-mmlab) ➜  SipMask-VIS git:(master) ✗ CUDA_VISIBLE_DEVICES=0,1,2,3 ./tools/dist_train.sh ./configs/sipmask/sipmask_r50_caffe_fpn_gn_ms_1x.py 4
Traceback (most recent call last):                                                                                                                                                                                            [5/45635]
  File "./tools/train.py", line 11, in <module>
    from mmdet.apis import (get_root_logger, init_dist, set_random_seed,
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/apis/__init__.py", line 2, in <module>
    from .inference import (inference_detector, init_detector, show_result,
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/apis/inference.py", line 13, in <module>
    from mmdet.models import build_detector
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/models/__init__.py", line 9, in <module>
    from .necks import *  # noqa: F401,F403
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/models/necks/__init__.py", line 3, in <module>
    from .hrfpn import HRFPN
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/models/necks/hrfpn.py", line 4, in <module>
    from mmcv.cnn.weight_init import caffe2_xavier_init
ImportError: cannot import name 'caffe2_xavier_init' from 'mmcv.cnn.weight_init' (/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/cnn/weight_init.py)
Traceback (most recent call last):
  File "./tools/train.py", line 11, in <module>
    from mmdet.apis import (get_root_logger, init_dist, set_random_seed,
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/apis/__init__.py", line 2, in <module>
    from .inference import (inference_detector, init_detector, show_result,
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/apis/inference.py", line 13, in <module>
    from mmdet.models import build_detector
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/models/__init__.py", line 9, in <module>
    from .necks import *  # noqa: F401,F403
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/models/necks/__init__.py", line 3, in <module>
    from .hrfpn import HRFPN
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/models/necks/hrfpn.py", line 4, in <module>
    from mmcv.cnn.weight_init import caffe2_xavier_init
ImportError: cannot import name 'caffe2_xavier_init' from 'mmcv.cnn.weight_init' (/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/cnn/weight_init.py)
Traceback (most recent call last):
  File "./tools/train.py", line 11, in <module>
    from mmdet.apis import (get_root_logger, init_dist, set_random_seed,
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/apis/__init__.py", line 2, in <module>
    from .inference import (inference_detector, init_detector, show_result,
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/apis/inference.py", line 13, in <module>                                                                                                                                                  from mmdet.models import build_detector
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/models/__init__.py", line 9, in <module>
    from .necks import *  # noqa: F401,F403
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/models/necks/__init__.py", line 3, in <module>
    from .hrfpn import HRFPN
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/models/necks/hrfpn.py", line 4, in <module>
    from mmcv.cnn.weight_init import caffe2_xavier_init
ImportError: cannot import name 'caffe2_xavier_init' from 'mmcv.cnn.weight_init' (/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/cnn/weight_init.py)
Traceback (most recent call last):
  File "./tools/train.py", line 11, in <module>
    from mmdet.apis import (get_root_logger, init_dist, set_random_seed,
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/apis/__init__.py", line 2, in <module>
    from .inference import (inference_detector, init_detector, show_result,
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/apis/inference.py", line 13, in <module>
    from mmdet.models import build_detector
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/models/__init__.py", line 9, in <module>
    from .necks import *  # noqa: F401,F403
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/models/necks/__init__.py", line 3, in <module>
    from .hrfpn import HRFPN
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/models/necks/hrfpn.py", line 4, in <module>
    from mmcv.cnn.weight_init import caffe2_xavier_init
ImportError: cannot import name 'caffe2_xavier_init' from 'mmcv.cnn.weight_init' (/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/cnn/weight_init.py)
Traceback (most recent call last):
  File "/anaconda3/envs/open-mmlab/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/anaconda3/envs/open-mmlab/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/distributed/launch.py", line 235, in <module>
    main()
  File "/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/distributed/launch.py", line 231, in main
    cmd=process.args)
subprocess.CalledProcessError: Command '['/anaconda3/envs/open-mmlab/bin/python', '-u', './tools/train.py', '--local_rank=0', './configs/sipmask/sipmask_r50_caffe_fpn_gn_ms_1x.py', '--launcher', 'pytorch']' returned non-zero exit s
tatus 1.

@JialeCao001
Copy link
Owner

@OneDirection9 try mmcv0.2.11 or mmcv0.2.12.

@OneDirection9
Copy link

OneDirection9 commented Sep 14, 2020

@JialeCao001 There are a new error, do you have any ideas?

Traceback (most recent call last):
  File "./tools/train.py", line 110, in <module>
    main()
  File "./tools/train.py", line 106, in main
    logger=logger)
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/apis/train.py", line 58, in train_detector
    _dist_train(model, dataset, cfg, validate=validate)
  File "/root/SipMask/SipMask-VIS/tools/../mmdet/apis/train.py", line 185, in _dist_train
    runner.load_checkpoint(cfg.load_from)
  File "/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/runner.py", line 234, in load_checkpoint
    self.logger)
  File "/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/checkpoint.py", line 171, in load_checkpoint
    load_state_dict(model.module, state_dict, strict, logger)
  File "/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/checkpoint.py", line 74, in load_state_dict
    name, own_state[name].size(), param.size()))
RuntimeError: While copying the parameter named bbox_head.fcos_cls.weight, whose dimensions in the model are torch.Size([40, 256, 3, 3]) and whose dimensions in the checkpoint are torch.Size([80, 256, 3, 3]).
Traceback (most recent call last):
  File "/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/checkpoint.py", line 68, in load_state_dict
    own_state[name].copy_(param)
RuntimeError: The expanded size of the tensor (40) must match the existing size (80) at non-singleton dimension 0.  Target sizes: [40, 256, 3, 3].  Tensor sizes: [80, 256, 3, 3]

I am trying to load the model pre-trained on MSCOCO and finetune it on YouTube-VIS, like this:

load_from = './../SipMask-mmdetection/work_dirs/sipmask_r50_caffe_fpn_gn_ms_2x.pth'

It looks like mmcv will raise an error when tensor name is the same but the size is not. The number of category is different for MSCOCO (80) and YouTube-VIS (40).

@JialeCao001
Copy link
Owner

@OneDirection9 You use mmcv0.2.11?

@OneDirection9
Copy link

@JialeCao001

It worked when using mmcv==0.2.12. Thanks.

@joakimjohnander
Copy link
Author

@JialeCao001 Thanks a lot for the swift reply! Changing mmcv version and refraining from installing mmdet did it. I'll supply the Dockerfile for future reference.

ARG PYTORCH="1.4"
ARG CUDA="10.1"
ARG CUDNN="7"

FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel

RUN apt-get update && apt-get install -y ffmpeg libglib2.0-0 libsm6 libxrender-dev libxext6 gcc git

# Install mmdetection
RUN conda install cython -y
RUN pip install mmcv==0.2.10
RUN git clone https://github.com/youtubevos/cocoapi.git /cocoapi
WORKDIR /cocoapi/PythonAPI
RUN pip uninstall -y pycocotools
RUN python setup.py build_ext install
RUN git clone https://github.com/JialeCao001/SipMask.git /SipMask
WORKDIR /SipMask/SipMask-VIS
ENV TORCH_CUDA_ARCH_LIST="3.5;3.7;5.0;5.2;6.0+PTX;6.1+PTX;7.0+PTX;7.5+PTX"
RUN pip install -e .

@rusvagzur
Copy link

rusvagzur commented May 7, 2021

Hello,
I have the same issue.
How did mmcv=0.2.12 solved it? When I install it, then I get this message:
mmdet 1.1.0+1d877f8 requires mmcv>=0.3.1, but you have mmcv 0.2.12 which is incompatible.
Thanks

@OneDirection9
Copy link

Hi,

It looks like the mmdet requires higher mmcv. Can you try to downgrade mmdet?

@rusvagzur
Copy link

rusvagzur commented May 7, 2021

My version of mmdet is directly cloned from this project, how come yours is a different mmdet version? May I know your mmdet version?

@JialeCao001
Copy link
Owner

@surgavur Can you try to first compile the project with higher mmcv, uninstall mmcv, and reinstall mmcv0.2.12?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants