`deeplabv3_unet_s5-d16` 是 mmsegmentation 提供的一种语义分割模型,其网络结构是将 DeepLabv3 和 UNet 结合在一起,可以同时兼顾 DeepLabv3 的优秀语义分割能力和 UNet 的精细边缘检测能力。
具体来说,`deeplabv3_unet_s5-d16` 的 backbone 是一个 ResNet-101,decode_head 是一个 Deeplabv3+UNet 的结合体,其中 DeepLabv3 部分使用空洞卷积(ASPPHead)来扩大感受野,UNet 部分使用上采样和融合不同层的特征图来增强精细边缘检测的能力。该模型的输入大小为 $512\times512$,输出大小为 $512\times512$,输出通道数为 19(COCO 数据集的类别数)。
下面是该模型的网络结构:
```python
norm_cfg = dict(type='BN', requires_grad=True)
model = dict(
type='EncDec',
backbone=dict(
type='ResNet',
arch='resnet101',
replace_stride_with_dilation=[False, True, True],
output_stride=16),
decode_head=dict(
type='DepthwiseSeparableASPPHead',
in_channels=2048,
in_index=3,
channels=512,
dilations=(1, 12, 24, 36),
c1_in_channels=256,
c1_channels=48,
dropout_ratio=0.1,
num_classes=19,
norm_cfg=norm_cfg,
align_corners=False,
loss_decode=dict(
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
auxiliary_head=dict(
type='FCNHead',
in_channels=1024,
in_index=2,
channels=256,
num_convs=1,
concat_input=False,
dropout_ratio=0.1,
num_classes=19,
norm_cfg=norm_cfg,
align_corners=False,
loss_decode=dict(
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)))
```
其中,`DepthwiseSeparableASPPHead` 是 DeepLabv3 的 ASPPHead 和 UNet 的 Decoder 部分结合的产物,`FCNHead` 是 UNet 的 Encoder 部分。该模型在训练时使用交叉熵损失函数,损失函数的权重为 1.0 和 0.4(对应 decode_head 和 auxiliary_head)。