Shortcuts

mmedit.models.base_archs.aspp

Module Contents

Classes

ASPPPooling

ASPP Pooling module.

ASPP

ASPP module from DeepLabV3.

class mmedit.models.base_archs.aspp.ASPPPooling(in_channels: int, out_channels: int, conv_cfg: Optional[dict], norm_cfg: Optional[dict], act_cfg: Optional[dict])[源代码]

Bases: torch.nn.Sequential

ASPP Pooling module.

The code is adopted from https://github.com/pytorch/vision/blob/master/torchvision/models/ segmentation/deeplabv3.py

参数
  • in_channels (int) – Input channels of the module.

  • out_channels (int) – Output channels of the module.

  • conv_cfg (dict) – Config dict for convolution layer. If “None”, nn.Conv2d will be applied.

  • norm_cfg (dict) – Config dict for normalization layer.

  • act_cfg (dict) – Config dict for activation layer.

forward(x: torch.Tensor) torch.Tensor[源代码]

Forward function for ASPP Pooling module.

参数

x (Tensor) – Input tensor.

返回

Output tensor.

返回类型

Tensor

class mmedit.models.base_archs.aspp.ASPP(in_channels: int, out_channels: int = 256, mid_channels: int = 256, dilations: Sequence[int] = (12, 24, 36), conv_cfg: Optional[dict] = None, norm_cfg: Optional[dict] = dict(type='BN'), act_cfg: Optional[dict] = dict(type='ReLU'), separable_conv: bool = False)[源代码]

Bases: torch.nn.Module

ASPP module from DeepLabV3.

The code is adopted from https://github.com/pytorch/vision/blob/master/torchvision/models/ segmentation/deeplabv3.py

For more information about the module: “Rethinking Atrous Convolution for Semantic Image Segmentation”.

参数
  • in_channels (int) – Input channels of the module.

  • out_channels (int) – Output channels of the module. Default: 256.

  • mid_channels (int) – Output channels of the intermediate ASPP conv modules. Default: 256.

  • dilations (Sequence[int]) – Dilation rate of three ASPP conv module. Default: [12, 24, 36].

  • conv_cfg (dict) – Config dict for convolution layer. If “None”, nn.Conv2d will be applied. Default: None.

  • norm_cfg (dict) – Config dict for normalization layer. Default: dict(type=’BN’).

  • act_cfg (dict) – Config dict for activation layer. Default: dict(type=’ReLU’).

  • separable_conv (bool) – Whether replace normal conv with depthwise separable conv which is faster. Default: False.

forward(x: torch.Tensor) torch.Tensor[源代码]

Forward function for ASPP module.

参数

x (Tensor) – Input tensor with shape (N, C, H, W).

返回

Output tensor.

返回类型

Tensor

Read the Docs v: latest
Versions
master
latest
stable
zyh-doc-notfound-extend
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.