How to play new tricks on a standard machine learning process?

https://www.toutiao.com/a6709031112284307980/

 

How to play new tricks on a standard machine learning process?

 

 

Speakers | Shady, Hikvision, head of Institute of cutting-edge technology

Finishing | yugao

REVIEW: Recently, CSDN and the Digital Economy Development Center jointly organized the first session of the CTA core technologies and application Summit opened in Hangzhou. The first CTA core technologies and application of artificial intelligence around the summit, invited the leader in technology, and developers to discuss cutting-edge research and application of machine learning and knowledge map. In this special machine learning, the person in charge of Research and Technology Institute ago from Hikvision Shady brought us entitled "How to Explore in Machine Learning Pipeline" (Machine Learning Process Research) wonderful speech.

In the era of machine learning, AI-related work is focused on specific processes, such as data collection, model training, model configuration. AI practitioners / staff engaged in numerous, but we do a lot of things are similar, in fact, it can be summed up as a standard pipeline. However, others do not like to make and work on the assembly line in the machine how to learn, still need a lot of skill. This time, Shady will be how to share on a standard machine learning lines, obtained by insights accumulated over the years, to raise awareness for the specific application.

Standard Machine Learning Pipeline

 

How to play new tricks on a standard machine learning process?

 

As shown, this is a standard machine learning pipeline, we can collect data, feature extraction, trained classifiers. A few years ago, when the depth of learning not fire, we rely on manual extraction operator, after training, the model finally get what we want, to solve specific problems.

With depth study of the rise of the middle of the two has been unified neural network, but we believe in the industry, to get a real job machine learning pipeline, there are two areas we need to pay special attention to. These include aspects of the data because the data is not ready, in fact, now the further development of artificial intelligence, the company is very much of the work is concentrated on the calibration data can be trained after the data has been calibrated, and finally get a model. In Hikvision, many applications previously placed on the back-end, but now are gradually transferred yearning edge end, so we have to work a considerable portion is configured in depth on the edge of the end of the neural model, and industrial robots.

Machine Learning pipeline practice

 

How to play new tricks on a standard machine learning process?

 

 

 

今天,我将和大家分享三个方面的工作,聚焦于标注、训练和部署,这三个环节分别代表了信息的生成、提炼、重新整合以及信息的去冗余。

▌1. 标注

通用函数近似器

 

How to play new tricks on a standard machine learning process?

 

 

这是第一项工作。我们知道,深度神经网络相比于传统的 SVM 或其他的线性模型,更类似于全局函数近似器,即输入 ground truth,它就能输出你想要的结果。

 

我们可以给定一个标注,输入更多信息量,比如一个人在图中的位置、关键点集合,甚至是一个非常稠密的网格。这是一个信息从少到多的过程,无论信息多复杂,在神经网络下都可以输出你想要的结果。换一个角度理解,神经网络对数据是非常敏感的。

 

多尺度对GT的影响

 

How to play new tricks on a standard machine learning process?

 

 

在安防场景中,我们最关心的是人和车。以行人检测为例,在一个场景中,我们会关心各个尺度的行人,但是神经网络对不同对象比较敏感,我们现在检测的框架是基于边界框的,对于大尺度的行人来说,红框标定行人没有问题,但是小尺度的行人标定存在两个问题,第一个问题是小尺度的对象本身提供的信息非常有限,第二个是小尺度对象的真值框差异非常大。

 

如右图所示,我们做了一个实验,让10个标定人员进行标定,蓝色表示 Bounding-box (边界框)标定方法,黄色是基于线段的标定方法,对于大尺度对象和小尺度对象,ground truth 的平均 IOU显示如图所示。可以看到,大尺度对象明显优于小尺度对象。基于神经网络对信息产生的方式非常敏感的前提来说,我们认为影响小目标检测的问题之一,可能是在于信息生成方式的歧义性。

TLL小尺度行人检测

 

How to play new tricks on a standard machine learning process?

 

 

为此我们提出了TLL。它的核心想法非常简单,即 Bounding-box 表示方法会影响极小目标的检出率,所以我们需要为小目标单独设计一种生成信息的方式,我们通过 Bounding-box 上下两点中心,做了一个连线,即把原来用一个 Bounding-box 表示一个物体的表示方式,变成了用一个线段表示一个人体,上端表示头,下端表示人与头之间的中心。

 

网络结构我们使用了 Hourglass 的沙漏结构。当然,多尺度是影响目标检测的原因,所以我们也是使用了多尺度信息聚合的方式。

 

How to play new tricks on a standard machine learning process?

 

 

我们的网络输出是三个特征图,分别表示人头、两脚和人体的分图。最后,我们用后处理的方法,通过二分图匹配得到最终的匹配结果,即图中虚线所示直线。

 

但在实际场景中,我们发现当人群密度比较密的时候,使用二分图匹配会出现如图所示的交叉结果,所以我们引入了马尔科夫随机场,不鼓励交叉情况的产生,这样就可以获得更好的结果,有效地避免了交叉产生。

 

在测试中,我们希望小目标的分辨率能够在10像素以下,越小越好,因为越小越能体现算法的优势,而对于检测过程中的帧漏检,相比基于光流的显示聚合方法,隐式的信息聚合方法可以进一步的提高检出率。

 

How to play new tricks on a standard machine learning process?

 

 

这是量化的结果,显示性能非常好。有个非常有趣的现象,我们仅仅是简单地改变了标注的方式,本质上即信息生成的方式,在严重遮挡的情况下,依然取得了更好的性能。

 

How to play new tricks on a standard machine learning process?

 

 

可以看到,无论在严重遮挡、远景,还是不规则的长宽比的配置下,这个方法还是有一定的优势。

 

How to play new tricks on a standard machine learning process?

 

 

这是定性的一些结果,像图中这样检测难度非常大的情况也可以检测出,稠密的行人也没有漏检。我们在一些目标项目中落地了这一方法,如在上海陆家嘴的环形天桥上,摄像头能够精确地统计天桥上行人的数量。

 

How to play new tricks on a standard machine learning process?

 

 

 

这个工作我们从 2017 年开始做,最初的目标检测用到了两阶段的方法,代表有 FastCNN。一步检测的代表框架有 SSD 和 YOLO,现在甚至有人在关注 Anchor-free 的方法,包括 FCOS、ReqPoints 等。这都是大家尝试找到一种不一样的边界框产生方式,能够更好地指导网络进行训练,并挖掘出原始数据中有价值的信息并用到具体的应用中。

▌2. 训练

神经网络训练洞见

 

How to play new tricks on a standard machine learning process?

 

 

 

我分享的第二个工作是如何训练神经网络,或者神经网络的本质是什么。训练神经网络有很多初始化方法和优化器,在训练中对信息进行归一化。

 

从信息传播的角度看,我们认为这些方法本质上是保持训练过程中或训练初始阶段的恒常性。恒常性可以分为两种,一种是静态恒常性,一种是动态恒常性。静态恒常性一般用在初始阶段,也就是初始化即可;动态恒常性就是优化的过程中,每一轮迭代都让信息的某种统计量保持不变。大家比较熟悉的初始化方法,包括Xavier、MSra、LSUV都属于静态恒常性,所有层保持在固定的数量级上,让初始权重的某些统计量保持在统一数量级上;动态恒常性包括 WN、BN、LN 等。但无论是哪种方式,无非就是设计某种规划,能够让信息的量级在某一个传播方向上保持不变,当然不是数字上的不变,而是统计量上的不变,因为神经网络的训练有点类似于蝴蝶效应,所以恒常性非常重要。

 

四个观点

 

How to play new tricks on a standard machine learning process?

 

 

先讲我们的四个观点:

  • 第一,我们训练一个真正深的网络,批归一化是一个必要条件;
  • 第二,相较于静态恒常性,动态恒常性更加重要;
  • 第三,相较于单个方向保持动态恒常性,在训练时保持两个方向,同时保持动态的恒常性,才是解决这个问题的关键;
  • 最后,如果模型非常深,可能还需要显示对传播的信号进行调控。

 

退化问题

 

How to play new tricks on a standard machine learning process?

 

 

大家可能说,用了ResNet 好像没有发生很难训练的情况,但是康奈尔大学的一篇文章指出,ResNet 本质上是指数级浅网络的聚合,如左图所示,我们的工作是对没有任何残差结构网络的训练方法。这种方法训练过程中会产生退化问题,即当以网络的层数作为横坐标、性能作为纵坐标,结果会如右图所示,网络层数小于等于20层时,简单堆叠网络层数会产生增益性能,但层数超过20,收敛率会大大下降,性能变差,这就是著名的深度神经网络训练退化的问题。我们的工作其实没有解决这个问题,只是缓解了这一问题,但希望可以给从业人员一些启发。

 

内在因素

 

How to play new tricks on a standard machine learning process?

 

 

我们认为原因可能有两个,第一是批归一化的伪归一化问题,前面的信号传递没有问题,在每一层卷积以后,信号虽然有时会被放大,有时会被缩小,但是经过批归一化以后,分布又能够被拉回来。但是如果推导反向评估显示,会发现当层数非常深时,误差累积的效应会让反向传播误差的分布越来越偏,造成训练出问题。

 

How to play new tricks on a standard machine learning process?

 

 

 

第二个原因可能更加深刻一点,我们知道反向传播的信号其实是和输出相对于输入息息相关。一般的工作可能推导到卷积层,我们还考虑了 BN 层,推导如图所示,在 MXM 层的方阵里面,左上角两个数值很有可能取到 0 或近似 0。底部的示意图表示一个信息量比较丰富的信号,在反向传播时,一层一层往回传会造成信号特定维度上的信息丢失。我们认为信息的丢失也会破坏动态恒常性,造成没有残差结构深度网络难以训练。

 

解决方案1:正规化

 

How to play new tricks on a standard machine learning process?

 

 

找到实用且有效的方法非常难,我们首先想到了一个数学公式,如果线性变化位于一个正交权上,就能获得输入和输出向量之间范数上的幅值等价性。但是我们发现,如果强制要求权重位于正交基上,很大程度会限制神经网络解空间的范围。我们用正交正则的思路替代 LR,去解决这个问题。

 

How to play new tricks on a standard machine learning process?

 

 

我们希望在反向传播时,信号的幅值能够位于比较稳定的范围内。由于各种应用不同,卷积神经网络会对应不同的超参数,输入和输出通道的不同等原因也会使得维度上出现一些问题。比如,在三维空间中找到四个相互正交的向量,在数学上是不可行的。对于输入维度小于输出的情况,需要要进行分组,让每个组的 din 大于等于 dout。

解决方案2:调制

 

How to play new tricks on a standard machine learning process?

 

 

第二个解决方案想法比较简单,就是对信号进行调制。在我们推导的公式中,为每一层设计一个符合该层的放大因子或缩小因子,该因子取值由该层的误差输出和输入的比值决定。此方法可以在训练一个没有残差的一百层网络的初始阶段使用。

实验结果

 

How to play new tricks on a standard machine learning process?

 

 

这是我们的一些实验的结果,最左图是每一层的 weights 相关度的曲线图,大家可以看到,绿色表示正交正则,蓝色表示权重衰减,用了正交正则以后,位置之间的夹角较大,夹角越大,相关度越低,此方法有效地保持了 weights 之间的低相关度。

 

右边的两幅图是反向传播的误差性浮值的曲线。同样地,蓝色是权重衰减的方法,绿色是正交正则方法,可以看到正交正则可以适当放大信号,有效保留反向传播中有用的信号,这些有用的部分,我们认为是能够让网络正常训练的关键因素。

 

How to play new tricks on a standard machine learning process?

 

 

我们对 SGD、正交正则和其他的一些自适应方法等进行比较,发现我们的方法能够获得较好的性能,当层数到达 110 层时,很多方法已经无法训练了,但我们的方法还是可以继续收敛,并可以用在残差网络里,但是对性能的提升不是很明显。

 

How to play new tricks on a standard machine learning process?

 

 

在其他人的工作中,我们也发现了类似的结论。BigGan 提到正交正则有利于 Gan 网络的稳定性。LARS 也提出了分层学习力的思想,只不过它使用了 weight 幅值与其梯度幅值的比值。

 

部署

 

▌模型压缩方法

 

How to play new tricks on a standard machine learning process?

 

 

以下的工作是模型部署。我们有很多摄像头产品,所以压缩方法是重中之重。

 

 

How to play new tricks on a standard machine learning process?

 

 

我今天要讲的是轻量级算子的相关工作,动机在于卷积是信息聚合的一种方式,可以分成两个阶段,一个是确定感受野,第二是确定两个向量之间的内积。3X3 的卷积既能满足感受野,也能兼顾 flops,所以大多数卷积是 3X3。

 

How to play new tricks on a standard machine learning process?

 

 

但是,我们是否能找到一个 1X1 的方式替代原来的卷积神经网络呢?答案是有的。那就是Shift操作,它可以把某一层的特征图进行平移,然后用 1X1 进行信息聚合,好处是没有额外的计算量。

 

How to play new tricks on a standard machine learning process?

 

 

因为最初的 shift CNN 需要人工确定平移的方向和大小,但我们想要通过自适应去学习平移方向,同时保持特征图不动,因为特征图移动会产生一定代价,所以我们用双向性插值,把平移的量切换为连续的浮点值,然后增加了一个鼓励稀疏的正则。

 

How to play new tricks on a standard machine learning process?

 

 

我们根据这个基本思想设计了一些基本模块,结合了下采样、多尺度融合等。

 

How to play new tricks on a standard machine learning process?

 

 

这是基于Unsigned Block做融合,用 4 领域的 shift 操作代替了 8 领域的 shift 操作。

 

How to play new tricks on a standard machine learning process?

 

 

我们还设计了兼顾效率的网络结构,以一种反规约的顺序进行 shift 卷积,增加了感受野的复杂度和聚合的复杂度,产生更好的效果,效率提升,跑得速度更快。

 

How to play new tricks on a standard machine learning process?

 

 

 

这是与 Mobilenet 和 ShuffleNet 性能比较。

 

How to play new tricks on a standard machine learning process?

 

 

 

这是我们对随机选取的六层网络进行可视化的结果,圈越大表示特征图越多,占比越高。统计显示,约 70% 的分类问题特征图是不需要移动的,这非常有趣。

 

How to play new tricks on a standard machine learning process?

 

 

 

How to play new tricks on a standard machine learning process?

 

 

这是上个月 MobileNetV3 的工作,我们的想法与之不谋而合:模块放置在深度滤波器的拓展之后,以将注意力应用于最大的表示......

 

How to play new tricks on a standard machine learning process?

 

 

最后是四点总结:

 

  • 第一点,我们认为现在的深度学习框架中,模型对信息生成的方式非常敏感,可以考虑在把信息“喂”给模型之前,如何让信息的呈现方式歧义变小,这样可以获得更好的结果。
  • 第二点,边界框可能已经过时了,我们需要想一些更加优雅、优美的表示方式。
  • 第三点,我们认为训练神经网络时,动态恒常性是一个关键因素。
  • 最后一点,对于芯片设计者来说,过多的算子会导致电路更复杂,就像检测框架会趋向于过程简化,我们认为算子也会进行收敛,以后的神经网络可能只有 1X1 的卷积,加上其他的操作就能够进行各种智能应用。

 

最后是我们发表的论文,大家有兴趣可以下载讨论,感谢大家的聆听,谢谢大家!

 

参考论文

 

  • Action Recognition:
  • HCN: https://arxiv.org/pdf/1804.06055
  • MV-CNN: https://arxiv.org/pdf/1903.01197
  • Model Compression:
  • Channel Pruning: https://arxiv.org/pdf/1812.06611
  • FENet: https://arxiv.org/pdf/1903.05285
  • FGA: https://arxiv.org/pdf/1807.11254
  • Detection:
  • TLL: https://arxiv.org/pdf/1807.01438
  • https://arxiv.org/pdf/1710.10749
  • ReID: https://arxiv.org/pdf/1812.06576
  • Optimization: https://arxiv.org/pdf/1703.01827

 

 

Guest Introduction:

 

Shady , Hikvision, head of Institute of cutting-edge technology in 2012 graduated from the School of Computer Science, Zhejiang University and a doctorate in computer vision direction. Hikvision is currently head of Institute of cutting-edge technology, a senior expert algorithm. Mainly responsible for the development of computer vision, incremental learning, the depth of network optimization technology roadmap and direction of the field, cutting-edge technology research and development and innovative algorithms and floor work. Continued to lead the team in computer vision and deep depth of field of study, each have a world-class competition in the field of visual evaluation and received a number of firsts, including KITTI, MOT Challenge, PASCAL VOC, LSVRC2016, Caltech and so on. During the company published around 20 papers in CVPR, ECCV, IJCAI, AAAI, ICIP and other top international meeting, which proposed a number of ideas and methods are widely used in the company's various platforms and products.

Guess you like

Origin blog.csdn.net/weixin_42137700/article/details/94543813