image classification任务中的网络模型设计:
input image->stack of convolution-bn-relu-pooling->fully connected layers->output categories scores vector
计算机视觉中的经典任务(typical task):image classification,semantic segmentation(同一个类别的物体会被标注成相同的颜色标签),classification+localization(对于一幅输入图像中只有一个instance,当然也只会有一个类别),object detection(一个input image有多个类别的多个instance),instance segmentation(不同于semantic segmentation,同一类别的不同实例也会被贴上不同颜色的标签)。
一、semantic segmentation
input an image,output a decision of category for each pixel in the image,对于输入图像的每个像素点进行分类,输出分类结果(pixel-level),
semantic segmentation与image classification任务的不同之处在于:semantic segmentation是对于输入图像的每个像素点分类(每个像素点都会输出一个类别标签),而image classification是对于整张图像输出一个类别标签。
对于input image中属于同一类别的不同instances,会标注上相同的类别标签,这是semantic segmentation的shortcomings,与之对应的改进是instances segmentation。
输入图像是3*H*W的tensor,经过a stack of convolutional layers,假设这些卷积层都是3*3的卷积操作,zero padding=1,则每一层卷积层的输出都和input image dimension相同(keep the same spatial size of the input image),最后一层卷积层的输出是H*W*C,其中C是semantic segmentation类别总数,则可以得到对于input image每个像素点的分类类别score。模型的损失函数是,对于每个pixel计算cross entropy,然后对于图像中所有的pixel计算得到的交叉熵进行平均,最后对于整个mini-batch 的训练图像计算得到的损失函数值进行平均,得到损失函数值。训练图像的ground truth是correct category label for each pixel in image。但是结构有个很大的缺点:convolutional filter的channel num通常设置为64,128,256,512,而每次卷积的输出特征图都是与input image dimension相同,则每一层输出特征图都具有high resolution,则卷积操作将会带来expensive computation计算量大,且会占用巨大的内存空间,故而semantic segmentation问题中并不用这种架构的网络模型。
先对特征图进行down-sampling:
实现down-sampling的操作有两种:
①strided convolution
②pooling(max pooling or average pooling)
pooling is a fixed function to do down sampling,strided convolution is learnable down sampling
再对low resolution feature map进行upsampling,(因为down sampling过程中由于最大池化操作损失了部分空间和细节信息)实现方式有:
①unpooling :eg.nearest neighbor unpooling
在一个receptive field中,用pooling后的一个element 数值复制(duplicate)填充
或者,在一个receptive field中,用pooling之后的数值填充到每个感受野的最左上角的像素值,其他像素点的数值用0填充
②max unpooling