open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
29.43k stars 9.43k forks source link

DSC not in registry #6789

Closed jaideep11061982 closed 2 years ago

jaideep11061982 commented 2 years ago

Hi I tried to add new project to existing MM detect could you tell me what m missing in below as i get dsc not in registry error

!mkdir  ./mmdetection/configs/dsc
!cp  /dsc_r50_fpn_1x_coco.py  ./mmdetection/configs/dsc
!cp  /dsc_x101_32x4d_fpn_20e_coco.py  ./mmdetection/configs/dsc
!cp  /dsc.py ./mmdetection/mmdet/models/detectors/
!cp  /dsc_roi_head.py./mmdetection/mmdet/models/roi_heads/
!cp  /roi_heads_init.py ./mmdetection/mmdet/models/roi_heads/__init__.py

!cp ../dsc_mask_head.py ./mmdetection/mmdet/models/roi_heads/mask_heads/

!cp ./mask_head_init.py ./mmdetection/mmdet/models/roi_heads/mask_heads/__init__.py
!cp ./dsc_bbox_head.py ./mmdetection/mmdet/models/roi_heads/bbox_heads/

!cp ./bbox_heads_init.py ./mmdetection/mmdet/models/roi_heads/bbox_heads/__init__.py
AronLin commented 2 years ago

You have not imported your dsc in the init file of detectors

jaideep11061982 commented 2 years ago

I did that off lately .. but still sane issue dsc-configs/detectors_init.py ./mmdetection/mmdet/models/detectors/init.py from .dsc import DSC ['TwoStagePanopticSegmentor', 'PanopticFPN', 'QueryInst', 'LAD', 'DSC' ] On Thu, 16 Dec 2021, 18:24 Guangchen Lin, @.***> wrote:

You have not imported your dsc in the init file of detectors

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/open-mmlab/mmdetection/issues/6789#issuecomment-995789364, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJDFNZDZECCKASNHBI6ELBDURHOOZANCNFSM5KBPJGPQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

AronLin commented 2 years ago

Can you show us the error tracking? If you import your model in the __init__.py and use the build_detector in mmdet, it should work.

jaideep11061982 commented 2 years ago

@AronLin

here it is
KeyError                                  Traceback (most recent call last)
/tmp/ipykernel_53/856151518.py in <module>
      1 import warnings
      2 warnings.filterwarnings("ignore")
----> 3 model = build_detector(cfg.model, train_cfg=cfg.get('train_cfg'), test_cfg=cfg.get('test_cfg'))
      4 datasets = [build_dataset(cfg.data.train)]
      5 #datasets = [build_dataset(cfg.data.train.dataset)]

/kaggle/working/mmdetection/mmdet/models/builder.py in build_detector(cfg, train_cfg, test_cfg)
     57         'test_cfg specified in both outer field and model field '
     58     return DETECTORS.build(
---> 59         cfg, default_args=dict(train_cfg=train_cfg, test_cfg=test_cfg))

/opt/conda/lib/python3.7/site-packages/mmcv/utils/registry.py in build(self, *args, **kwargs)
    210 
    211     def build(self, *args, **kwargs):
--> 212         return self.build_func(*args, **kwargs, registry=self)
    213 
    214     def _add_children(self, registry):

/opt/conda/lib/python3.7/site-packages/mmcv/cnn/builder.py in build_model_from_cfg(cfg, registry, default_args)
     25         return Sequential(*modules)
     26     else:
---> 27         return build_from_cfg(cfg, registry, default_args)
     28 
     29 

/opt/conda/lib/python3.7/site-packages/mmcv/utils/registry.py in build_from_cfg(cfg, registry, default_args)
     43         if obj_cls is None:
     44             raise KeyError(
---> 45                 f'{obj_type} is not in the {registry.name} registry')
     46     elif inspect.isclass(obj_type):
     47         obj_cls = obj_type

KeyError: 'DSC is not in the models registry'
AronLin commented 2 years ago

Ok, it is strange. Do you use @DETECTORS.register_module() in your model DSC?

jaideep11061982 commented 2 years ago

Not sure how it works with other new additions that are made with mmdet. DSC is successor of detectorRS, if we have this added to latest repo would e great

from ..builder import DETECTORS
from .two_stage import TwoStageDetector

@DETECTORS.register_module()
class DSC(TwoStageDetector):

i do not know mmcv registry version has got some thing to do this is authors repo https://github.com/hding2455/DSC/blob/main/configs/dsc/dsc_r50_fpn_1x_coco.py

AronLin commented 2 years ago

Your model is not registered in the registry. You can check what models are registered in the model registry.

Maybe it is about the PATH. You can try these commands and rerun your file:

 cd mmdetection
 export PYTHONPATH=$PYTHONPATH:$(pwd)

If it does not work, I can not give you the answer now, I need to try your operations and check what happened.

jaideep11061982 commented 2 years ago

@AronLin how can i check and any command to registor it.. like the way we may be setting up other projects in mmdet so far

AronLin commented 2 years ago

Just print the registry before this line:

44             raise KeyError( f'{obj_type} is not in the {registry.name} registry')
jaideep11061982 commented 2 years ago

how to print that one @AronLin simple print(registry)?

AronLin commented 2 years ago

yes

jaideep11061982 commented 2 years ago

it dsnt prints any thing @AronLin even though its going till there

import warnings
warnings.filterwarnings("ignore")
model = build_detector(cfg.model, train_cfg=cfg.get('train_cfg'), test_cfg=cfg.get('test_cfg'))
datasets = [build_dataset(cfg.data.train)]
#datasets = [build_dataset(cfg.data.train.dataset)]

model.CLASSES = datasets[0].CLASSES
%%writefile /opt/conda/lib/python3.7/site-packages/mmcv/utils/registry.py
import inspect
import warnings
from functools import partial

from .misc import is_seq_of

def build_from_cfg(cfg, registry, default_args=None):
    """Build a module from config dict.

    Args:
        cfg (dict): Config dict. It should at least contain the key "type".
        registry (:obj:`Registry`): The registry to search the type from.
        default_args (dict, optional): Default initialization arguments.

    Returns:
        object: The constructed object.
    """
    if not isinstance(cfg, dict):
        raise TypeError(f'cfg must be a dict, but got {type(cfg)}')
    if 'type' not in cfg:
        if default_args is None or 'type' not in default_args:
            raise KeyError(
                '`cfg` or `default_args` must contain the key "type", '
                f'but got {cfg}\n{default_args}')
    if not isinstance(registry, Registry):
        raise TypeError('registry must be an mmcv.Registry object, '
                        f'but got {type(registry)}')
    if not (isinstance(default_args, dict) or default_args is None):
        raise TypeError('default_args must be a dict or None, '
                        f'but got {type(default_args)}')

    args = cfg.copy()

    if default_args is not None:
        for name, value in default_args.items():
            args.setdefault(name, value)

    obj_type = args.pop('type')
    if isinstance(obj_type, str):
        #print('registry',obj_type)
        obj_cls = registry.get(obj_type)

        if obj_cls is None:
            print('registry',obj_type)
            raise KeyError(
                f'{obj_type} is not  in the {registry.name} registry')
    elif inspect.isclass(obj_type):
        obj_cls = obj_type
    else:
        raise TypeError(
            f'type must be a str or valid type, but got {type(obj_type)}')
    try:
        return obj_cls(**args)
    except Exception as e:
        # Normal TypeError does not print class name.
        raise type(e)(f'{obj_cls.__name__}: {e}')

class Registry:
    """A registry to map strings to classes.

    Registered object could be built from registry.
    Example:
        >>> MODELS = Registry('models')
        >>> @MODELS.register_module()
        >>> class ResNet:
        >>>     pass
        >>> resnet = MODELS.build(dict(type='ResNet'))

    Please refer to
    https://mmcv.readthedocs.io/en/latest/understand_mmcv/registry.html for
    advanced usage.

    Args:
        name (str): Registry name.
        build_func(func, optional): Build function to construct instance from
            Registry, func:`build_from_cfg` is used if neither ``parent`` or
            ``build_func`` is specified. If ``parent`` is specified and
            ``build_func`` is not given,  ``build_func`` will be inherited
            from ``parent``. Default: None.
        parent (Registry, optional): Parent registry. The class registered in
            children registry could be built from parent. Default: None.
        scope (str, optional): The scope of registry. It is the key to search
            for children registry. If not specified, scope will be the name of
            the package where class is defined, e.g. mmdet, mmcls, mmseg.
            Default: None.
    """

    def __init__(self, name, build_func=None, parent=None, scope=None):
        self._name = name
        self._module_dict = dict()
        self._children = dict()
        self._scope = self.infer_scope() if scope is None else scope

        # self.build_func will be set with the following priority:
        # 1. build_func
        # 2. parent.build_func
        # 3. build_from_cfg
        print('build',build_from_cfg)
        if build_func is None:
            if parent is not None:
                self.build_func = parent.build_func
            else:
                self.build_func = build_from_cfg
        else:
            self.build_func = build_func
        if parent is not None:
            assert isinstance(parent, Registry)
            parent._add_children(self)
            self.parent = parent
        else:
            self.parent = None

    def __len__(self):
        return len(self._module_dict)

    def __contains__(self, key):
        return self.get(key) is not None

    def __repr__(self):
        format_str = self.__class__.__name__ + \
                     f'(name={self._name}, ' \
                     f'items={self._module_dict})'
        return format_str

    @staticmethod
    def infer_scope():
        """Infer the scope of registry.

        The name of the package where registry is defined will be returned.

        Example:
            # in mmdet/models/backbone/resnet.py
            >>> MODELS = Registry('models')
            >>> @MODELS.register_module()
            >>> class ResNet:
            >>>     pass
            The scope of ``ResNet`` will be ``mmdet``.

        Returns:
            scope (str): The inferred scope name.
        """
        # inspect.stack() trace where this function is called, the index-2
        # indicates the frame where `infer_scope()` is called
        filename = inspect.getmodule(inspect.stack()[2][0]).__name__
        split_filename = filename.split('.')
        return split_filename[0]

    @staticmethod
    def split_scope_key(key):
        """Split scope and key.

        The first scope will be split from key.

        Examples:
            >>> Registry.split_scope_key('mmdet.ResNet')
            'mmdet', 'ResNet'
            >>> Registry.split_scope_key('ResNet')
            None, 'ResNet'

        Return:
            scope (str, None): The first scope.
            key (str): The remaining key.
        """
        split_index = key.find('.')
        if split_index != -1:
            return key[:split_index], key[split_index + 1:]
        else:
            return None, key

    @property
    def name(self):
        return self._name

    @property
    def scope(self):
        return self._scope

    @property
    def module_dict(self):
        return self._module_dict

    @property
    def children(self):
        return self._children

    def get(self, key):
        """Get the registry record.

        Args:
            key (str): The class name in string format.

        Returns:
            class: The corresponding class.
        """
        scope, real_key = self.split_scope_key(key)

        if scope is None or scope == self._scope:
            # get from self
            #print(scope,real_key,self._module_dict)
            if real_key in self._module_dict:
                return self._module_dict[real_key]
        else:
            # get from self._children
            if scope in self._children:
                return self._children[scope].get(real_key)
            else:
                # goto root
                parent = self.parent
                print('scope',scope,real_key)
                while parent.parent is not None:
                    parent = parent.parent
                return parent.get(key)

    def build(self, *args, **kwargs):
        return self.build_func(*args, **kwargs, registry=self)

    def _add_children(self, registry):
        """Add children for a registry.

        The ``registry`` will be added as children based on its scope.
        The parent registry could build objects from children registry.

        Example:
            >>> models = Registry('models')
            >>> mmdet_models = Registry('models', parent=models)
            >>> @mmdet_models.register_module()
            >>> class ResNet:
            >>>     pass
            >>> resnet = models.build(dict(type='mmdet.ResNet'))
        """

        assert isinstance(registry, Registry)
        assert registry.scope is not None
        assert registry.scope not in self.children, \
            f'scope {registry.scope} exists in {self.name} registry'
        self.children[registry.scope] = registry

    def _register_module(self, module_class, module_name=None, force=False):
        if not inspect.isclass(module_class):
            raise TypeError('module must be a class, '
                            f'but got {type(module_class)}')

        if module_name is None:
            module_name = module_class.__name__
        if isinstance(module_name, str):
            module_name = [module_name]
        for name in module_name:
            if not force and name in self._module_dict:
                raise KeyError(f'{name} is already registered '
                               f'in {self.name}')
            self._module_dict[name] = module_class

    def deprecated_register_module(self, cls=None, force=False):
        warnings.warn(
            'The old API of register_module(module, force=False) '
            'is deprecated and will be removed, please use the new API '
            'register_module(name=None, force=False, module=None) instead.')
        if cls is None:
            return partial(self.deprecated_register_module, force=force)
        self._register_module(cls, force=force)
        return cls

    def register_module(self, name=None, force=False, module=None):
        """Register a module.

        A record will be added to `self._module_dict`, whose key is the class
        name or the specified name, and value is the class itself.
        It can be used as a decorator or a normal function.

        Example:
            >>> backbones = Registry('backbone')
            >>> @backbones.register_module()
            >>> class ResNet:
            >>>     pass

            >>> backbones = Registry('backbone')
            >>> @backbones.register_module(name='mnet')
            >>> class MobileNet:
            >>>     pass

            >>> backbones = Registry('backbone')
            >>> class ResNet:
            >>>     pass
            >>> backbones.register_module(ResNet)

        Args:
            name (str | None): The module name to be registered. If not
                specified, the class name will be used.
            force (bool, optional): Whether to override an existing class with
                the same name. Default: False.
            module (type): Module class to be registered.
        """
        if not isinstance(force, bool):
            raise TypeError(f'force must be a boolean, but got {type(force)}')
        # NOTE: This is a walkaround to be compatible with the old api,
        # while it may introduce unexpected bugs.
        if isinstance(name, type):
            return self.deprecated_register_module(name, force=force)

        # raise the error ahead of time
        if not (name is None or isinstance(name, str) or is_seq_of(name, str)):
            raise TypeError(
                'name must be either of None, an instance of str or a sequence'
                f'  of str, but got {type(name)}')

        # use it as a normal method: x.register_module(module=SomeClass)
        if module is not None:
            self._register_module(
                module_class=module, module_name=name, force=force)
            return module

        # use it as a decorator: @x.register_module()
        def _register(cls):
            self._register_module(
                module_class=cls, module_name=name, force=force)
            return cls

        return _register
AronLin commented 2 years ago

Do you mean there is nothing in the registry.model_dict()? If true, this indicates that the initialization of the entire project has not been completed. Have you tried to add the path of mmdetection to the system path or PYTHONPATH in your script?

os.chdir('.mmdetection')
sys.path.append('.mmdetection')
jaideep11061982 commented 2 years ago

@AronLin i had to restart the kernel to have new changes included here is the registr

'SingleStageDetector': <class 'mmdet.models.detectors.single_stage.SingleStageDetector'>, 'ATSS': <class 'mmdet.models.detectors.atss.ATSS'>, 'AutoAssign': <class 'mmdet.models.detectors.autoassign.AutoAssign'>, 'TwoStageDetector': <class 'mmdet.models.detectors.two_stage.TwoStageDetector'>, 'CascadeRCNN': <class 'mmdet.models.detectors.cascade_rcnn.CascadeRCNN'>, 'CenterNet': <class 'mmdet.models.detectors.centernet.CenterNet'>, 'CornerNet': <class 'mmdet.models.detectors.cornernet.CornerNet'>, 'DETR': <class 'mmdet.models.detectors.detr.DETR'>, 'DeformableDETR': <class 'mmdet.models.detectors.deformable_detr.DeformableDETR'>, 'FastRCNN': <class 'mmdet.models.detectors.fast_rcnn.FastRCNN'>, 'FasterRCNN': <class 'mmdet.models.detectors.faster_rcnn.FasterRCNN'>, 'FCOS': <class 'mmdet.models.detectors.fcos.FCOS'>, 'FOVEA': <class 'mmdet.models.detectors.fovea.FOVEA'>, 'FSAF': <class 'mmdet.models.detectors.fsaf.FSAF'>, 'GFL': <class 'mmdet.models.detectors.gfl.GFL'>, 'GridRCNN': <class 'mmdet.models.detectors.grid_rcnn.GridRCNN'>, 'HybridTaskCascade': <class 'mmdet.models.detectors.htc.HybridTaskCascade'>, 'KnowledgeDistillationSingleStageDetector': <class 'mmdet.models.detectors.kd_one_stage.KnowledgeDistillationSingleStageDetector'>, 'MaskRCNN': <class 'mmdet.models.detectors.mask_rcnn.MaskRCNN'>, 'MaskScoringRCNN': <class 'mmdet.models.detectors.mask_scoring_rcnn.MaskScoringRCNN'>, 'NASFCOS': <class 'mmdet.models.detectors.nasfcos.NASFCOS'>, 'PAA': <class 'mmdet.models.detectors.paa.PAA'>, 'BBoxHead': <class 'mmdet.models.roi_heads.bbox_heads.bbox_head.BBoxHead'>, 'ConvFCBBoxHead': <class 'mmdet.models.roi_heads.bbox_heads.convfc_bbox_head.ConvFCBBoxHead'>, 'Shared2FCBBoxHead': <class 'mmdet.models.roi_heads.bbox_heads.convfc_bbox_head.Shared2FCBBoxHead'>, 'Shared4Conv1FCBBoxHead': <class 'mmdet.models.roi_heads.bbox_heads.convfc_bbox_head.Shared4Conv1FCBBoxHead'>, 'DIIHead': <class 'mmdet.models.roi_heads.bbox_heads.dii_head.DIIHead'>, 'DoubleConvFCBBoxHead': <class 'mmdet.models.roi_heads.bbox_heads.double_bbox_head.DoubleConvFCBBoxHead'>, 'SABLHead': <class 'mmdet.models.roi_heads.bbox_heads.sabl_head.SABLHead'>, 'SCNetBBoxHead': <class 'mmdet.models.roi_heads.bbox_heads.scnet_bbox_head.SCNetBBoxHead'>, 'CascadeRoIHead': <class 'mmdet.models.roi_heads.cascade_roi_head.CascadeRoIHead'>, 'StandardRoIHead': <class 'mmdet.models.roi_heads.standard_roi_head.StandardRoIHead'>, 'DoubleHeadRoIHead': <class 'mmdet.models.roi_heads.double_roi_head.DoubleHeadRoIHead'>, 'DynamicRoIHead': <class 'mmdet.models.roi_heads.dynamic_roi_head.DynamicRoIHead'>, 'GridRoIHead': <class 'mmdet.models.roi_heads.grid_roi_head.GridRoIHead'>, 'HybridTaskCascadeRoIHead': <class 'mmdet.models.roi_heads.htc_roi_head.HybridTaskCascadeRoIHead'>, 'FCNMaskHead': <class 'mmdet.models.roi_heads.mask_heads.fcn_mask_head.FCNMaskHead'>, 'CoarseMaskHead': <class 'mmdet.models.roi_heads.mask_heads.coarse_mask_head.CoarseMaskHead'>, 'DynamicMaskHead': <class 'mmdet.models.roi_heads.mask_heads.dynamic_mask_head.DynamicMaskHead'>, 'FeatureRelayHead': <class 'mmdet.models.roi_heads.mask_heads.feature_relay_head.FeatureRelayHead'>, 'FusedSemanticHead': <class 'mmdet.models.roi_heads.mask_heads.fused_semantic_head.FusedSemanticHead'>, 'GlobalContextHead': <class 'mmdet.models.roi_heads.mask_heads.global_context_head.GlobalContextHead'>, 'GridHead': <class 'mmdet.models.roi_heads.mask_heads.grid_head.GridHead'>, 'HTCMaskHead': <class 'mmdet.models.roi_heads.mask_heads.htc_mask_head.HTCMaskHead'>, 'MaskPointHead': <class 'mmdet.models.roi_heads.mask_heads.mask_point_head.MaskPointHead'>, 'MaskIoUHead': <class 'mmdet.models.roi_heads.mask_heads.maskiou_head.MaskIoUHead'>, 'SCNetMaskHead': <class 'mmdet.models.roi_heads.mask_heads.scnet_mask_head.SCNetMaskHead'>, 'SCNetSemanticHead': <class 'mmdet.models.roi_heads.mask_heads.scnet_semantic_head.SCNetSemanticHead'>, 'MaskScoringRoIHead': <class 'mmdet.models.roi_heads.mask_scoring_roi_head.MaskScoringRoIHead'>, 'PISARoIHead': <class 'mmdet.models.roi_heads.pisa_roi_head.PISARoIHead'>, 'PointRendRoIHead': <class 'mmdet.models.roi_heads.point_rend_roi_head.PointRendRoIHead'>, 'GenericRoIExtractor': <class 'mmdet.models.roi_heads.roi_extractors.generic_roi_extractor.GenericRoIExtractor'>, 'SingleRoIExtractor': <class 'mmdet.models.roi_heads.roi_extractors.single_level_roi_extractor.SingleRoIExtractor'>, 'SCNetRoIHead': <class 'mmdet.models.roi_heads.scnet_roi_head.SCNetRoIHead'>, 'ResLayer': <class 'mmdet.models.roi_heads.shared_heads.res_layer.ResLayer'>, 'SparseRoIHead': <class 'mmdet.models.roi_heads.sparse_roi_head.SparseRoIHead'>, 'TridentRoIHead': <class 'mmdet.models.roi_heads.trident_roi_head.TridentRoIHead'>, 'TwoStagePanopticSegmentor': <class 'mmdet.models.detectors.panoptic_two_stage_segmentor.TwoStagePanopticSegmentor'>, 'PanopticFPN': <class 'mmdet.models.detectors.panoptic_fpn.PanopticFPN'>, 'PointRend': <class 'mmdet.models.detectors.point_rend.PointRend'>, 'SparseRCNN': <class 'mmdet.models.detectors.sparse_rcnn.SparseRCNN'>, 'QueryInst': <class 'mmdet.models.detectors.queryinst.QueryInst'>, 'RepPointsDetector': <class 'mmdet.models.detectors.reppoints_detector.RepPointsDetector'>, 'RetinaNet': <class 'mmdet.models.detectors.retinanet.RetinaNet'>, 'RPN': <class 'mmdet.models.detectors.rpn.RPN'>, 'SCNet': <class 'mmdet.models.detectors.scnet.SCNet'>, 'SingleStageInstanceSegmentor': <class 'mmdet.models.detectors.single_stage_instance_seg.SingleStageInstanceSegmentor'>, 'SOLO': <class 'mmdet.models.detectors.solo.SOLO'>, 'TridentFasterRCNN': <class 'mmdet.models.detectors.trident_faster_rcnn.TridentFasterRCNN'>, 'VFNet': <class 'mmdet.models.detectors.vfnet.VFNet'>, 'YOLACT': <class 'mmdet.models.detectors.yolact.YOLACT'>, 'YOLOV3': <class 'mmdet.models.detectors.yolo.YOLOV3'>, 'YOLOF': <class 'mmdet.models.detectors.yolof.YOLOF'>, 'YOLOX': <class 'mmdet.models.detectors.yolox.YOLOX'>, 'PanopticFPNHead': <class 'mmdet.models.seg_heads.panoptic_fpn_head.PanopticFPNHead'>, 'HeuristicFusionHead': <class 'mmdet.models.seg_heads.panoptic_fusion_heads.heuristic_fusion_head.HeuristicFusionHead'>})

jaideep11061982 commented 2 years ago

Looks likt it is not takin updated detector RS,not sure from where does it takes in..

jaideep11061982 commented 2 years ago
!pip install '../input/pytorch-190/torch-1.9.0+cu111-cp37-cp37m-linux_x86_64.whl' --no-deps

!pip install '/kaggle/input/mmdetection-v217/mmdetection/addict-2.4.0-py3-none-any.whl' --no-deps
!pip install '/kaggle/input/mmdetection-v217/mmdetection/yapf-0.31.0-py2.py3-none-any.whl' --no-deps
!pip install '/kaggle/input/mmdetection-v217/mmdetection/terminal-0.4.0-py3-none-any.whl' --no-deps
!pip install '/kaggle/input/mmdetection-v217/mmdetection/terminaltables-3.1.0-py3-none-any.whl' --no-deps
!pip install '/kaggle/input/mmdetection-v217/mmdetection/mmcv_full-1.3.x-py2.py3-none-any/mmcv_full-1.3.16-cp37-cp37m-manylinux1_x86_64.whl' --no-deps
!pip install '/kaggle/input/mmdetection-v217/mmdetection/pycocotools-2.0.2/pycocotools-2.0.2' --no-deps
!pip install '/kaggle/input/mmdetection-v217/mmdetection/mmpycocotools-12.0.3/mmpycocotools-12.0.3' --no-deps

!rm -rf mmdetection

!cp -r /kaggle/input/mmdetection-v217/mmdetection/mmdetection-2.18.0 /kaggle/working/
!mv /kaggle/working/mmdetection-2.18.0 /kaggle/working/mmdetection
%cd /kaggle/working/mmdetection
!pip install -e .

%cd ..

this is my complete installation script followed by above CP commands for copyin new project files

AronLin commented 2 years ago

'SingleStageDetector': <class 'mmdet.models.detectors.single_stage.SingleStageDetector'>, 'ATSS': <class ...

It is normal now.

!pip install -e .

You do not need to install mmdetection.

!mkdir ./mmdetection/configs/dsc !cp /dsc_r50_fpn_1x_coco.py ./mmdetection/configs/dsc ...

Just copy your files to mmdetection,

os.chdir('.mmdetection') sys.path.append('.mmdetection')

add mmdetection to your path,

import warnings warnings.filterwarnings("ignore") ...

and run your script. And check whether DSC is in the registry.

If still fails, I think you need an IDE and check for errors step by step.

jaideep11061982 commented 2 years ago

I resolved the installation issue.. i had copy first all files during installation