diff --git a/mmseg/models/backbones/fast_scnn.py b/mmseg/models/backbones/fast_scnn.py index 9a1284d5f..031fdc779 100644 --- a/mmseg/models/backbones/fast_scnn.py +++ b/mmseg/models/backbones/fast_scnn.py @@ -3,9 +3,8 @@ import torch.nn as nn from mmcv.cnn import ConvModule, constant_init, kaiming_init from torch.nn.modules.batchnorm import _BatchNorm -from mmseg.models.backbones.mobile_net_v2 import InvertedResidual from mmseg.models.decode_heads.psp_head import PPM -from mmseg.ops import DepthwiseSeparableConvModule, resize +from mmseg.ops import DepthwiseSeparableConvModule, InvertedResidual, resize from ..builder import BACKBONES diff --git a/mmseg/ops/__init__.py b/mmseg/ops/__init__.py index 54b0d0b79..29a148b45 100644 --- a/mmseg/ops/__init__.py +++ b/mmseg/ops/__init__.py @@ -1,5 +1,8 @@ from .encoding import Encoding +from .inverted_residual_module import InvertedResidual from .separable_conv_module import DepthwiseSeparableConvModule from .wrappers import resize -__all__ = ['resize', 'DepthwiseSeparableConvModule', 'Encoding'] +__all__ = [ + 'resize', 'DepthwiseSeparableConvModule', 'InvertedResidual', 'Encoding' +] diff --git a/mmseg/models/backbones/mobile_net_v2.py b/mmseg/ops/inverted_residual_module.py similarity index 80% rename from mmseg/models/backbones/mobile_net_v2.py rename to mmseg/ops/inverted_residual_module.py index 3160ed9b1..1d7ea36bf 100644 --- a/mmseg/models/backbones/mobile_net_v2.py +++ b/mmseg/ops/inverted_residual_module.py @@ -3,6 +3,17 @@ from torch import nn class InvertedResidual(nn.Module): + """Inverted Residual Module + Args: + inp (int): input channels. + oup (int): output channels. + stride (int): downsampling factor. + expand_ratio (int): 1 or 2. + dilation (int): Dilated conv. Default: 1 + conv_cfg (dict|None): Config of conv layers. + norm_cfg (dict|None): Config of norm layers. + act_cfg (dict): Config of activation layers. + """ def __init__(self, inp,