UNet
网络框架
😺
2015 年,OlafRonneberger 等人提出了 U-net 网络结构,U-net 网络是基于 FCN 的一种语义分割网络,适用于做医学图像的分割
U-net 网络结构与 FCN 网络结构相似,也是分为下采样阶段和上采样阶段,网络结构中只有卷积层和池化层,没有全连接层,网络中较浅的高分辨率层用来解决像素定位的问题,较深的层用来解决像素分类的问题,从而可以实现图像语义级别的分割,与 FCN 网络不同的是,U-net 的上采样阶段与下采样阶段采用了相同数量层次的卷积操作,且使用 skip connection 结构将下采样层与上采样层相连,使得下采样层提取道的特征可以直接传递到上采样层,这使得 U-net 网络的像素定位更加准确,分割精度更高。此外在训练过程中,U-net 只需要一次训练,FCN 为达到较精确的 FCN-8s 结构需要三次训练,故 U-net 网络的训练效率也高于 FCN 网络。
U-net 网络的结构如图所示,蓝色箭头代表卷积和激活函数,灰色箭头代表复制剪切操作,红色箭头代表下采样,绿色箭头代表反卷积,conv1X1 代表卷积核为 1X1 的卷积操作。U-net 网络没有全连接层,只有卷积和下采样。U-net 可以对像素进行端到端的分割,即输入是一幅图像,输出也是一幅图像。
下采样(编码)
😽
编码层由 N 个结构相同的卷积层 L (i) 级联组成,L (i) 包含两个 3x3 卷积层和一个 2x2 最大池化层,经过 L (i) 后图像通道数加倍。
其中卷积和池化的 padding 都是‘valid’(不补 0),即只对图像的有效部分进行窄卷积,得到图像的有效特征,因此得到的输出图像会比输入图像小。解决这个问题的方法是根据输出图像的大小应该等于原图像大小(out_size=img_size),沿着网络逆向计算出输入图像的大小 in_size,对原图像沿着四条边进行镜像扩大,作为输入图像。图中,输出分割图像的黄框与输入图像的黄框对应,输入图像中蓝框的边缘部分由于窄卷积丢失,最后的到输出图像中的黄框,因此输出的分割图像对应输入图像中原图 img 的位置。
上采样(解码)
😻
解码层由 N 个结构相同的反卷积层 L (i) 级联组成,L (i) 包含一个 2x2 反卷积层和两个 3x3 卷积层,经过 L (i) 后图像通道减半。
每层解码层会将反卷积恢复的特征,与同层编码层提取的特征连接(concatenate),再进行卷积,实现了编码层和解码层的特征融合,有助于特征恢复过程中保留图像的更多细节,使得到的分割图像轮廓更清晰。如图,在训练左心室内外膜分割的 UNet 网络时,c 得到的特征比 b 更接近标签。
最后,解码层连接一个 1x1 全卷积网络,逐像素二分类,得到 2 个通道的输出图像。
视频
思考 1
🤔
UNet 的跳连接结构好在哪?跟 Resnet 相比有什么异同?
思考 2
🐒
有很多的论文是基于 Unet 的改进,包括但不限于
Unet++
U2net
甚至其结构也被视为 EN-DE 结构的一个经典案例,你能否通过这些论文感受一下神经网络整体的发展脉络。