dinov2 icon indicating copy to clipboard operation
dinov2 copied to clipboard

mmcv installation issue

Open shravankumar-concat opened this issue 10 months ago • 9 comments


ModuleNotFoundError Traceback (most recent call last) Cell In[2], line 7 5 import torch 6 import torch.nn.functional as F ----> 7 from mmseg.apis import init_segmentor, inference_segmentor 9 import dinov2.eval.segmentation.models 12 class CenterPadding(torch.nn.Module):

File ~/anaconda3/envs/dinov2-extras/lib/python3.9/site-packages/mmseg/apis/init.py:2 1 # Copyright (c) OpenMMLab. All rights reserved. ----> 2 from .inference import inference_segmentor, init_segmentor, show_result_pyplot 3 from .test import multi_gpu_test, single_gpu_test 4 from .train import (get_root_logger, init_random_seed, set_random_seed, 5 train_segmentor)

File ~/anaconda3/envs/dinov2-extras/lib/python3.9/site-packages/mmseg/apis/inference.py:9 6 from mmcv.runner import load_checkpoint 8 from mmseg.datasets.pipelines import Compose ----> 9 from mmseg.models import build_segmentor 12 def init_segmentor(config, checkpoint=None, device='cuda:0'): 13 """Initialize a segmentor from config file. 14 15 Args: (...) 23 nn.Module: The constructed segmentor. 24 """

File ~/anaconda3/envs/dinov2-extras/lib/python3.9/site-packages/mmseg/models/init.py:2 1 # Copyright (c) OpenMMLab. All rights reserved. ----> 2 from .backbones import * # noqa: F401,F403 3 from .builder import (BACKBONES, HEADS, LOSSES, SEGMENTORS, build_backbone, 4 build_head, build_loss, build_segmentor) 5 from .decode_heads import * # noqa: F401,F403

File ~/anaconda3/envs/dinov2-extras/lib/python3.9/site-packages/mmseg/models/backbones/init.py:7 5 from .cgnet import CGNet 6 from .erfnet import ERFNet ----> 7 from .fast_scnn import FastSCNN 8 from .hrnet import HRNet 9 from .icnet import ICNet

File ~/anaconda3/envs/dinov2-extras/lib/python3.9/site-packages/mmseg/models/backbones/fast_scnn.py:7 4 from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule 5 from mmcv.runner import BaseModule ----> 7 from mmseg.models.decode_heads.psp_head import PPM 8 from mmseg.ops import resize 9 from ..builder import BACKBONES

File ~/anaconda3/envs/dinov2-extras/lib/python3.9/site-packages/mmseg/models/decode_heads/init.py:2 1 # Copyright (c) OpenMMLab. All rights reserved. ----> 2 from .ann_head import ANNHead 3 from .apc_head import APCHead 4 from .aspp_head import ASPPHead

File ~/anaconda3/envs/dinov2-extras/lib/python3.9/site-packages/mmseg/models/decode_heads/ann_head.py:8 6 from ..builder import HEADS 7 from ..utils import SelfAttentionBlock as _SelfAttentionBlock ----> 8 from .decode_head import BaseDecodeHead 11 class PPMConcat(nn.ModuleList): 12 """Pyramid Pooling Module that only concat the features of each layer. 13 14 Args: 15 pool_scales (tuple[int]): Pooling scales used in Pooling Pyramid 16 Module. 17 """

File ~/anaconda3/envs/dinov2-extras/lib/python3.9/site-packages/mmseg/models/decode_heads/decode_head.py:11 9 from mmseg.ops import resize 10 from ..builder import build_loss ---> 11 from ..losses import accuracy 14 class BaseDecodeHead(BaseModule, metaclass=ABCMeta): 15 """Base class for BaseDecodeHead. 16 17 Args: (...) 51 init_cfg (dict or list[dict], optional): Initialization config dict. 52 """

File ~/anaconda3/envs/dinov2-extras/lib/python3.9/site-packages/mmseg/models/losses/init.py:6 3 from .cross_entropy_loss import (CrossEntropyLoss, binary_cross_entropy, 4 cross_entropy, mask_cross_entropy) 5 from .dice_loss import DiceLoss ----> 6 from .focal_loss import FocalLoss 7 from .lovasz_loss import LovaszLoss 8 from .utils import reduce_loss, weight_reduce_loss, weighted_loss

File ~/anaconda3/envs/dinov2-extras/lib/python3.9/site-packages/mmseg/models/losses/focal_loss.py:6 4 import torch.nn as nn 5 import torch.nn.functional as F ----> 6 from mmcv.ops import sigmoid_focal_loss as _sigmoid_focal_loss 8 from ..builder import LOSSES 9 from .utils import weight_reduce_loss

File ~/anaconda3/envs/dinov2-extras/lib/python3.9/site-packages/mmcv/ops/init.py:2 1 # Copyright (c) OpenMMLab. All rights reserved. ----> 2 from .bbox import bbox_overlaps 3 from .border_align import BorderAlign, border_align 4 from .box_iou_rotated import box_iou_rotated

File ~/anaconda3/envs/dinov2-extras/lib/python3.9/site-packages/mmcv/ops/bbox.py:4 1 # Copyright (c) OpenMMLab. All rights reserved. 2 from ..utils import ext_loader ----> 4 ext_module = ext_loader.load_ext('_ext', ['bbox_overlaps']) 7 def bbox_overlaps(bboxes1, bboxes2, mode='iou', aligned=False, offset=0): 8 """Calculate overlap between two set of bboxes. 9 10 If aligned is False, then calculate the ious between each bbox (...) 47 >>> assert tuple(bbox_overlaps(empty, empty).shape) == (0, 0) 48 """

File ~/anaconda3/envs/dinov2-extras/lib/python3.9/site-packages/mmcv/utils/ext_loader.py:13, in load_ext(name, funcs) 12 def load_ext(name, funcs): ---> 13 ext = importlib.import_module('mmcv.' + name) 14 for fun in funcs: 15 assert hasattr(ext, fun), f'{fun} miss in module {name}'

File ~/anaconda3/envs/dinov2-extras/lib/python3.9/importlib/init.py:127, in import_module(name, package) 125 break 126 level += 1 --> 127 return _bootstrap._gcd_import(name[level:], package, level)

ModuleNotFoundError: No module named 'mmcv._ext'

shravankumar-concat avatar Sep 01 '23 17:09 shravankumar-concat