# 電腦視覺 - 語義分割（二）

U-Net適用於醫學映像分割、自然映像產生。

1. 因為利用了底層的特徵（同解析度級聯）改善上採樣的資訊不足。

2. 醫學映像資料一般較少，底層的特徵其實很重要。

1. 最常見的損失函數就是 binary cross entropy loss 結合 dice coeff loss
前者是像素層級的損失函數
後者是映像層級或者是 batch 層級的損失函數，適合基於以 IOU 作為評價指標的問題。

2. online bootstrapped cross entropy loss
比如FRNN，難樣本挖掘的一種

3. lovasz loss
來自論文 The Lovasz-Softmax loss: A tractable surrogate for the optimization of the intersection-over-union measure in neural networks
也是適合以 IOU 作為評價指標的問題。

Concurrent Spatial and Channel Squeeze & Excitation in Fully Convolutional Networks
SE-Net 中的 SE 結構就是對 feature maps 中的不同 channel 進行加權處理。

``class cSELayer(nn.Module):    def __init__(self, channel, reduction=2):        super(cSELayer, self).__init__()        self.avg_pool = nn.AdaptiveAvgPool2d(1)        self.fc = nn.Sequential(            nn.Linear(channel, channel // reduction),            nn.ELU(inplace=True),            nn.Linear(channel // reduction, channel),            nn.Sigmoid()        )            def forward(self, x):        b, c, _, _ = x.size()        y = self.avg_pool(x).view(b, c)        y = self.fc(y).view(b, c, 1, 1)        return x * yclass sSELayer(nn.Module):    def __init__(self, channel):        super(sSELayer, self).__init__()        self.fc = nn.Conv2d(channel, 1, kernel_size=1)        self.sigmoid = nn.Sigmoid()    def forward(self, x):        y = self.fc(x)        y = self.sigmoid(y)        return x * yclass scSELayer(nn.Module):    def __init__(self, channels, reduction=2):        super(scSELayer, self).__init__()        self.sSE = sSELayer(channels)        self.cSE = cSELayer(channels, reduction=reduction)    def forward(self, x):        sx = self.sSE(x)        cx = self.cSE(x)        x = sx + cx        return x``

``class Dblock(nn.Module):    def __init__(self, channel):        super(Dblock, self).__init__()        self.dilate1 = nn.Conv2d(channel, channel, kernel_size=3, dilation=1, padding=1)        self.dilate2 = nn.Conv2d(channel, channel, kernel_size=3, dilation=2, padding=2)        self.dilate3 = nn.Conv2d(channel, channel, kernel_size=3, dilation=4, padding=4)        for m in self.modules():            if isinstance(m, nn.Conv2d):                if m.bias is not None:                    m.bias.data.zero_()    def forward(self, x):        dilate1_out = F.relu(self.dilate1(x), inplace=True)        dilate2_out = F.relu(self.dilate2(dilate1_out), inplace=True)        dilate3_out = F.relu(self.dilate3(dilate2_out), inplace=True)        out = x + dilate1_out + dilate2_out + dilate3_out        return out``

OCNet: Object Context Network for Scene Parsing

Hypercolumns for Object Segmentation and Fine-grained Localization

``        d5 = self.decoder5(center)        d4 = self.decoder4(d5, e4)         d3 = self.decoder3(d4, e3)         d2 = self.decoder2(d3, e2)         d1 = self.decoder1(d2, e1)        f = torch.cat((            d1,            F.interpolate(d2, scale_factor=2, mode=‘bilinear‘, align_corners=False),            F.interpolate(d3, scale_factor=4, mode=‘bilinear‘, align_corners=False),            F.interpolate(d4, scale_factor=8, mode=‘bilinear‘, align_corners=False),            F.interpolate(d5, scale_factor=16, mode=‘bilinear‘, align_corners=False),        ), 1)``

## Alibaba Cloud 10 Year Anniversary

With You, We are Shaping a Digital World, 2009-2019

## Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

## Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth \$300-1200 USD