From b5ae7a7f69a1b0667bd5f039cdaa02f247b5ce33 Mon Sep 17 00:00:00 2001 From: Junjun2016 Date: Tue, 27 Jul 2021 23:19:12 +0800 Subject: [PATCH] [Fix] Fix ATTENTION registry (#729) * register ATTENTION registry from the parent ATTENTION registry of MMCV to avoid conflict with other repos * remove redundant file --- mmseg/models/backbones/swin.py | 3 +-- mmseg/models/builder.py | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mmseg/models/backbones/swin.py b/mmseg/models/backbones/swin.py index 1ea6389fa4..ef027dc0d9 100644 --- a/mmseg/models/backbones/swin.py +++ b/mmseg/models/backbones/swin.py @@ -5,7 +5,6 @@ import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import build_norm_layer, trunc_normal_init -from mmcv.cnn.bricks.registry import ATTENTION from mmcv.cnn.bricks.transformer import FFN, build_dropout from mmcv.cnn.utils.weight_init import constant_init from mmcv.runner import _load_checkpoint @@ -15,7 +14,7 @@ from torch.nn.modules.utils import _pair as to_2tuple from ...utils import get_root_logger -from ..builder import BACKBONES +from ..builder import ATTENTION, BACKBONES from ..utils import PatchEmbed, swin_convert diff --git a/mmseg/models/builder.py b/mmseg/models/builder.py index 9b68ff888c..05d0606807 100644 --- a/mmseg/models/builder.py +++ b/mmseg/models/builder.py @@ -1,9 +1,11 @@ import warnings from mmcv.cnn import MODELS as MMCV_MODELS +from mmcv.cnn.bricks.registry import ATTENTION as MMCV_ATTENTION from mmcv.utils import Registry MODELS = Registry('models', parent=MMCV_MODELS) +ATTENTION = Registry('attention', parent=MMCV_ATTENTION) BACKBONES = MODELS NECKS = MODELS