南京市高淳区城乡建设局网站,南京建设工程网站,如何制作简单网站,西安网站建设成功建设本文主要转载自#xff1a;https://zhuanlan.zhihu.com/p/73024408
1、为什么需要anchor机制
anchor机制由Faster-RCNN提出#xff0c;而后成为主流目标检测器的标配#xff0c;例如SSD、Yolov2、RetinaNet等等。
Faster-RCNN中使用anchor机制的motivation如下#xff1…本文主要转载自https://zhuanlan.zhihu.com/p/73024408
1、为什么需要anchor机制
anchor机制由Faster-RCNN提出而后成为主流目标检测器的标配例如SSD、Yolov2、RetinaNet等等。
Faster-RCNN中使用anchor机制的motivation如下
In contrast to prevalent methods [8], [9], [1], [2] that use pyramids of images (Figure 1, a) or pyramids of filters (Figure 1, b), we introduce novel “anchor” boxes that serve as references at multiple scales and aspect ratios. Our scheme can be thought of as a pyramid of regression references (Figure 1, c), which avoids enumerating images or filters of multiple scales or aspect ratios. 即anchor机制要解决的问题是scale和aspect ratio变化范围大之前的解决方法是pyramids of images或者pyramids of filters。pyramids of images耗时而pyramids of filters是传统CV的做法当时CNN-based的CV还没有一种对应pyramids of filters的方案对应的方案得等到2016年底的FPN即pyramids of features。
所以作者提出了一种新的解决方案——anchor机制。 图1.1 目标检测简史 图1.2 两个gt boxbox落到同一个cell
虽然作者解释anchor机制是为了解决scale和aspect ratio变化范围大的问题但anchor机制还顺便解决了另外一个重要的问题——gtground truthbox与gt box之间overlap过大会导致多个gt box映射到一个cell即检测head上的一个特征点从而导致gt box丢失如图1.2所示人体框和球拍框中心点相同会落到统一个cell里。有了anchor机制之后一个cell里会有多个anchor不同anchor负责不同scale和aspect ratio的gt box即使有多个框会映射到同一个cell也不会导致gt box丢失。具体地在训练阶段gt box丢失会导致模型不能见到全量gt在测试阶段gt box丢失会导致recall降低。
简而言之anchor机制有两个作用分而治之将scale和aspect ratio空间划分为几个子空间降低问题难度降低模型学习难度和解决gt box与gt box之间overlap过大导致gt box丢失问题。同理pyramids of images和pyramids of features也有上述两个作用。
2、八仙过海各显神通
上面已经说了anchor机制是pyramids of images和pyramids of features的替代方案。换一句话说pyramids of images、pyramids of features和anchor机制是解决同一个问题的三种思路。
比如DenseBoxMTCNN使用的是pyramids of images机制而FCOS、FoveaBox使用的是pyramids of features机制Faster-RCNN、Yolov2使用的是anchor机制SSD、RetinaNet、Yolov3糅合了anchor机制和pyramids of features机制。
3、anchor free一定更好吗
最近几个月anchor free的相关文章喷涌而出大有革掉anchor based检测器命的势头那么问题来了anchor free就一定比anchor based的方法更好吗
anchor free和anchor based方法各有优劣。例如anchor free的前提是基于图像金字塔或者特征金字塔这个前提但是无论哪种金字塔都会增加计算降低检测速度而anchor机制可以减少金字塔层数进而提高检测速度。
就如同pyramids of images和pyramids of features两种方法各有优劣一样。基于pyramids of features的FPN大火的同时基于pyramids of images的MTCNN方法依然有自己的一片天地。
无论是pyramids of images、pyramids of features还是anchor机制没有孰优孰劣它们有各自的优缺点应该按需使用甚至糅合到一起使用取每种方法的长处规避每种方法的短处。
例如ACNAnchor Cascade for Efficient Face Detection结合了pyramids of images和anchor机制从而在速度和效果上取得了一个不错的折中。
技术是螺旋前进的一个技术领域往往有多个演进路线而每个时代由于硬件或者理论基础等等的限制总会有一个当前最优的演进路线但是没有一个技术演进路线在任何时代都是最优的。就跟机器学习里的no free lunch理论一样没有一个模型能在所有任务上都表现最优同理没有一个技术路线能在任何时代都代表最先进方向。 对于pyramids of images、pyramids of features及anchor free的详细解释待补充