Skip to content

无法导入MultiScaleDeformableAttention #5

@Jessy-Huang

Description

@Jessy-Huang

在运行generate_output.py是报错无法导入MultiScaleDeformableAttention,点进去相关的代码都在,这个问题有知道怎么解决的小伙伴吗?

python occdepth/scripts/generate_output.py n_gpus=4 batch_size_per_gpu=1
/media/hjc/DeepLearning1/Anaconda3/envs/occdepth1/lib/python3.7/site-packages/mmcv/cnn/bricks/transformer.py:28: UserWarning: Fail to import ``MultiScaleDeformableAttention`` from ``mmcv.ops.multi_scale_deform_attn``, You should install ``mmcv-full`` if you need this module. 
  warnings.warn('Fail to import ``MultiScaleDeformableAttention`` from '
/media/hjc/DeepLearning1/Anaconda3/envs/occdepth1/lib/python3.7/site-packages/mmdet/models/utils/transformer.py:27: UserWarning: `MultiScaleDeformableAttention` in MMCV has been moved to `mmcv.ops.multi_scale_deform_attn`, please update your MMCV
  '`MultiScaleDeformableAttention` in MMCV has been moved to '
Traceback (most recent call last):
  File "/media/hjc/DeepLearning1/Anaconda3/envs/occdepth1/lib/python3.7/site-packages/mmdet/models/utils/transformer.py", line 23, in <module>
    from mmcv.ops.multi_scale_deform_attn import MultiScaleDeformableAttention
  File "/media/hjc/DeepLearning1/Anaconda3/envs/occdepth1/lib/python3.7/site-packages/mmcv/ops/__init__.py", line 2, in <module>
    from .assign_score_withk import assign_score_withk
  File "/media/hjc/DeepLearning1/Anaconda3/envs/occdepth1/lib/python3.7/site-packages/mmcv/ops/assign_score_withk.py", line 6, in <module>
    '_ext', ['assign_score_withk_forward', 'assign_score_withk_backward'])
  File "/media/hjc/DeepLearning1/Anaconda3/envs/occdepth1/lib/python3.7/site-packages/mmcv/utils/ext_loader.py", line 13, in load_ext
    ext = importlib.import_module('mmcv.' + name)
  File "/media/hjc/DeepLearning1/Anaconda3/envs/occdepth1/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'mmcv._ext'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "occdepth/scripts/generate_output.py", line 2, in <module>
    from occdepth.models.OccDepth import OccDepth
  File "/media/hjc/DeepLearning1/DLProjects/Robot-binocular-vision/OccDepth-main/occdepth/models/OccDepth.py", line 18, in <module>
    from occdepth.models.flosp_depth.flosp_depth import FlospDepth
  File "/media/hjc/DeepLearning1/DLProjects/Robot-binocular-vision/OccDepth-main/occdepth/models/flosp_depth/flosp_depth.py", line 4, in <module>
    from mmdet.models.backbones.resnet import BasicBlock
  File "/media/hjc/DeepLearning1/Anaconda3/envs/occdepth1/lib/python3.7/site-packages/mmdet/models/__init__.py", line 2, in <module>
    from .backbones import *  # noqa: F401,F403
  File "/media/hjc/DeepLearning1/Anaconda3/envs/occdepth1/lib/python3.7/site-packages/mmdet/models/backbones/__init__.py", line 2, in <module>
    from .csp_darknet import CSPDarknet
  File "/media/hjc/DeepLearning1/Anaconda3/envs/occdepth1/lib/python3.7/site-packages/mmdet/models/backbones/csp_darknet.py", line 11, in <module>
    from ..utils import CSPLayer
  File "/media/hjc/DeepLearning1/Anaconda3/envs/occdepth1/lib/python3.7/site-packages/mmdet/models/utils/__init__.py", line 16, in <module>
    from .transformer import (DetrTransformerDecoder, DetrTransformerDecoderLayer,
  File "/media/hjc/DeepLearning1/Anaconda3/envs/occdepth1/lib/python3.7/site-packages/mmdet/models/utils/transformer.py", line 29, in <module>
    from mmcv.cnn.bricks.transformer import MultiScaleDeformableAttention
ImportError: cannot import name 'MultiScaleDeformableAttention' from 'mmcv.cnn.bricks.transformer' (/media/hjc/DeepLearning1/Anaconda3/envs/occdepth1/lib/python3.7/site-packages/mmcv/cnn/bricks/transformer.py)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions