【摘要】 本文将介绍如何基于ProxylessNAS搜索semantic segmentation模型,最终搜索得到的模型结构可在CPU上达到36 fps的测试结果,展示自动网络搜索(NAS)在语义分割上的应用。
随着自动网络搜索(Neural Architecture Search)技术的问世,深度学习已慢慢发展到自动化设计网络结构以及超参数配置的阶段。尤其在AI落地的背景下,许多模型需要部署在移动端设备。
依据不同设备(GPU, CPU,芯片等),不同的模型需求(latency, 模型大小,FLOPs),使用NAS自动搜索最佳网络结构将会是一个很有潜力的方向。上文介绍了NAS的基本框架和入门必读DARTS [1],以及在semantic segmentation领域的应用 https://bbs.huaweicloud.com/blogs/136468 。距离现在才不过几个月,NAS论文数量明显增长:在理论研究方面,search strategy,evaluation performance的方法看似趋于稳定,不得不提到最近FAIR团队的RegNet [2]探讨了搜索空间的设计,通过大量实验把常见的设计模型的理论一一验证,我们可以根据它的结论缩小搜索空间从而提高搜索效率;在应用方面以还是object detection为主,也有segmentation, reID, GAN等领域。
NAS算是一项新技术,但是语义分割semantic segmentation却是老生常谈。自FCN的问世起,SegNet, UNet这种简单粗暴的encoder-decoder结构在多种图像上都能达到可以接受的结果,deeplab系列之后更是在开源数据集达到巅峰。从学术角度看semantic segmentation似乎已达到瓶颈,于是researcher们纷纷转向小样本,semi-supervised,domain adaption, cloud point等方向另辟蹊径。但是semantic segmentation落地却非常困难。在实际落地场景中,使用常见的backbone (resnet或yolo系列) 就能够完成各种object detection任务,但是在segmentation上效果却不好:
Semantic segmentation落地必须要平衡模型的准确度和速度,而设计这样的网络结构又十分困难。尝试了BiSeNet [3],ShuffleNetv2 [4],MobileNetv3 [5]等一系列小模型,但是准确度和速度都没达到要求。正所谓万丈高楼平地起,成功只能靠自己,最终还是要寄希望于NAS自动搜索出满足条件的模型。上篇介绍的NAS用在语义分割还在探索阶段,在GPU上运行并且尝试减小FLOPs或Params。但是FLOPs或者参数量与模型推理速度并不是正相关,只减少参数量不能满足实时推理的要求。后来的FasterSeg [6]看似速度惊人,其实也用了TensorRT来加速。本文将尝试在CPU上完成实时的人形分割的任务,选择ProxylessNAS作为baseline来搜索模型结构。实验结果证明了ProxylessNAS [7]还是经得起考验的,业界良心。
选择ProxylessNAS [7]的原因不仅仅是它出自名门,代码开源,在Cifar10和ImageNet数据集的准确度能从一众NAS模型中脱颖而出, 而且它也是比较早的考虑到了模型性能的work(如速度,模型大小,参数量)。 除此之外,与DARTS [1]系列搜索的DAG cell不同,ProxylessNAS [7]的主干网络采用简单的链状结构。这种链状结构(chained-structure)比DAG cell有明显的速度优势,因为它的算子之间的连接方式比较简单。
1.1 Super-net setting
我们还是用NAS的基本框架来解析ProxylessNAS [7]。
Figure 1 NAS framework
1.2 Super-net training
Super-net的参数包含两部分:operation本身的参数和每个operation的权重(在Figure2中记为{alpha,beta,sigma … })。将训练数据分成两部分,一部分用来训练super-net里面operations的weight,另一部分用来更新ops的权重。
Figure 2 illustrates the architecture of the super-net: the chained-structure searchable backbone (left) and each layer of the searchable backbone (right).
Figure 2所表达的ProxylessNAS的流程,其实就是一边训练operation参数,一边更新operation的权重alpha,最后用Softmax选择每一层中拥有最大probability的operation即可。读过paper之后确实发现有许多值得借鉴之处,但是同样也有一些疑问 (c.f. Table 1)。
Table 1 discusses the advantages and remaining issues of ProxylessNAS
尽管对ProxylessNAS还有很多没有解决的问题,奈何单卡搜索训练省时省力瑕不掩瑜。本文尝试用ProxylessNAS搜索可运行在CPU(x86)上的real-time semantic segmentation模型做人形分割,下面会详细介绍对算法的改进和实验结果。
2.1 Super-net setting
Figure 3 illustrates the macro-architecture of our super-net (top) and the searchable backbone (bottom)
2.2 Improvement from ProxylessNAS
2.3 Experiments
Experiment setting:
Experimental results:
在同一网络结构下,我们用MobileNetv3 [5]作为backbone进行对比,对比结果见Table 2。
Table 2 illustrates the experimental results
从实验数据来看,MobileNetv3 [5]的参数量和FLOPs都比我们搜索出来的小一倍,但是在K80上的推理速度很相近,准确度mIoU差别较大。如果综合考量准确度和速度的话,我们用ProxylessNAS [7]搜索出来的backbone要明显优于MobileNetv3 [5]的backbone。 Figure 4的实验结果可以看出当feature复杂一些的时候,MobileNetv3 [5]的结果要差很多。
Figure 4 compares the segmentation results of our searched network and MobileNetv3
将模型转化成CPU可支持模式,运行速度在27ms每帧左右(FPS=36),结果如Figure 5。
Figure 5 shows the segmentation results in real application scenario
是时候展示一下搜索出来的backbone了,长这样~ (c.f. Figure 6)
Figure 6 illustrates the searched backbone structure
通过实验我们看到ProxylessNAS搜索策略可以从classification迁移到segmentation,在速度相仿的情况下,搜索出来的网络要比原本MobileNetv3 [5]准确度提高很多。但是只限于当前的场景,不能说人工设计出来的模型就不好或一定会被取代(虽然MobileNetv3也是NAS搜出来的)。在特定场景和有特定需求的时候,用NAS设计网络结构确实比人工设计加上大量调参实验要更高效,在AI落地方面更有发展前景。本文只是初探ProxylessNAS,后续还会有以下几个方面的探索。
Figure 7 shows the demo of background matting
[1] Liu, Hanxiao, Karen Simonyan, and Yiming Yang. "Darts: Differentiable architecture search." ICLR (2019).
[2] Radosavovic, Ilija, et al. "Designing Network Design Spaces." arXiv preprint arXiv:2003.13678 (2020).
[3] Yu, Changqian, et al. "Bisenet: Bilateral segmentation network for real-time semantic segmentation." Proceedings of the European conference on computer vision (ECCV). 2018.
[4] Zhang, Xiangyu, et al. "Shufflenet: An extremely efficient convolutional neural network for mobile devices." Proceedings of the IEEE conference on computer vision and pattern recognition (CVPR). 2018.
[5] Howard, Andrew, et al. "Searching for mobilenetv3." Proceedings of the IEEE International Conference on Computer Vision (ICCV). 2019.
[6] Chen, Wuyang, et al. "FasterSeg: Searching for Faster Real-time Semantic Segmentation." ICLR (2020).
[7] Cai, Han, Ligeng Zhu, and Song Han. "Proxylessnas: Direct neural architecture search on target task and hardware." ICLR (2019).
[8] Sandler, Mark, et al. "Mobilenetv2: Inverted residuals and linear bottlenecks." Proceedings of the IEEE conference on computer vision and pattern recognition (CVPR). 2018.
[9] Chen, Liang-Chieh, et al. "Encoder-decoder with atrous separable convolution for semantic image segmentation." Proceedings of the European conference on computer vision (ECCV). 2018.
| 留言与评论(共有 0 条评论) “” |