论文阅读笔记(十六):SSD: Single Shot MultiBox Detector

时间:2021-06-02 06:32:23

We present a method for detecting objects in images using a single deep neural network. Our approach, named SSD, discretizes the output space of bounding boxes into a set of default boxes over different aspect ratios and scales per feature map location. At prediction time, the network generates scores for the presence of each object category in each default box and produces adjustments to the box to better match the object shape. Additionally, the network combines predictions from multiple feature maps with different resolutions to naturally handle objects of various sizes. SSD is simple relative to methods that require object proposals because it completely eliminates proposal generation and subsequent pixel or feature resampling stages and encapsulates all computation in a single network. This makes SSD easy to train and straightforward to integrate into systems that require a detection component.

我们提出了一种使用单个深度神经网络来检测图像中的目标的方法。我们的方法命名为SSD,将边界框的输出空间离散化为不同长宽比的一组默认框和并缩放每个特征映射的位置。在预测时,网络会在每个默认框中为每个目标类别的出现生成分数,并对框进行调整以更好地匹配目标形状。此外,网络还结合了不同分辨率的多个特征映射的预测,自然地处理各种尺寸的目标。相对于需要目标提出的方法,SSD非常简单,因为它完全消除了提出生成和随后的像素或特征重新采样阶段,并将所有计算封装到单个网络中。这使得SSD易于训练和直接集成到需要检测组件的系统中。

Current state-of-the-art object detection systems are variants of the following approach: hypothesize bounding boxes, resample pixels or features for each box, and apply a high-quality classifier. This pipeline has prevailed on detection benchmarks since the Selective Search work [1] through the current leading results on PASCAL VOC, COCO, and ILSVRC detection all based on Faster R-CNN[2] albeit with deeper features such as [3]. While accurate, these approaches have been too computationally intensive for embedded systems and, even with high-end hardware, too slow for real-time applications.Often detection speed for these approaches is measured in seconds per frame (SPF), and even the fastest high-accuracy detector, Faster R-CNN, operates at only 7 frames per second (FPS). There have been many attempts to build faster detectors by attacking each stage of the detection pipeline (see related work in Sec. 4), but so far, significantly increased speed comes only at the cost of significantly decreased detection accuracy.

目前最先进的目标检测系统是以下方法的变种:假设边界框,每个框重采样像素或特征,并应用一个高质量的分类器。自从选择性搜索[1]通过在PASCAL VOC,COCO和ILSVRC上所有基于Faster R-CNN[2]的检测都取得了当前领先的结果(尽管具有更深的特征如[3]),这种流程在检测基准数据上流行开来。尽管这些方法准确,但对于嵌入式系统而言,这些方法的计算量过大,即使是高端硬件,对于实时应用而言也太慢。通常,这些方法的检测速度是以每帧秒(SPF)度量,甚至最快的高精度检测器,Faster R-CNN,仅以每秒7帧(FPS)的速度运行。已经有很多尝试通过处理检测流程中的每个阶段来构建更快的检测器(参见第4节中的相关工作),但是到目前为止,显著提高的速度仅以显著降低的检测精度为代价。

This paper presents the first deep network based object detector that does not resample pixels or features for bounding box hypotheses and and is as accurate as approaches that do. This results in a significant improvement in speed for high-accuracy detection (59 FPS with mAP 74.3% on VOC2007 test, vs. Faster R-CNN 7 FPS with mAP 73.2% or YOLO 45 FPS with mAP 63.4%). The fundamental improvement in speed comes from eliminating bounding box proposals and the subsequent pixel or feature resampling stage. We are not the first to do this (cf [4,5]), but by adding a series of improvements, we manage to increase the accuracy significantly over previous attempts. Our improvements include using a small convolutional filter to predict object categories and offsets in bounding box locations, using separate predictors (filters) for different aspect ratio detections, and applying these filters to multiple feature maps from the later stages of a network in order to perform detection at multiple scales. With these modifications——especially using multiple layers for prediction at different scales——we can achieve high-accuracy using relatively low resolution input, further increasing detection speed. While these contributions may seem small independently, we note that the resulting system improves accuracy on real-time detection for PASCAL VOC from 63.4% mAP for YOLO to 74.3% mAP for our SSD. This is a larger relative improvement in detection accuracy than that from the recent, very high-profile work on residual networks [3]. Furthermore, significantly improving the speed of high-quality detection can broaden the range of settings where computer vision is useful.

本文提出了第一个基于深度网络的目标检测器,它不对边界框假设的像素或特征进行重采样,并且与其它方法有一样精确度。这对高精度检测在速度上有显著提高(在VOC2007测试中,59FPS和74.3%的mAP,与Faster R-CNN 7FPS和73.2%的mAP或者YOLO 45 FPS和63.4%的mAP相比)。速度的根本改进来自消除边界框提出和随后的像素或特征重采样阶段。我们并不是第一个这样做的人(查阅[4,5]),但是通过增加一系列改进,我们设法比以前的尝试显著提高了准确性。我们的改进包括使用小型卷积滤波器来预测边界框位置中的目标类别和偏移量,使用不同长宽比检测的单独预测器(滤波器),并将这些滤波器应用于网络后期的多个特征映射中,以执行多尺度检测。通过这些修改——特别是使用多层进行不同尺度的预测——我们可以使用相对较低的分辨率输入实现高精度,进一步提高检测速度。虽然这些贡献可能单独看起来很小,但是我们注意到由此产生的系统将PASCAL VOC实时检测的准确度从YOLO的63.4%的mAP提高到我们的SSD的74.3%的mAP。相比于最近备受瞩目的残差网络方面的工作[3],在检测精度上这是相对更大的提高。而且,显著提高的高质量检测速度可以扩大计算机视觉使用的设置范围。

We summarize our contributions as follows:

We introduce SSD, a single-shot detector for multiple categories that is faster than the previous state-of-the-art for single shot detectors (YOLO), and significantly more accurate, in fact as accurate as slower techniques that perform explicit region proposals and pooling (including Faster R-CNN).

The core of SSD is predicting category scores and box offsets for a fixed set of default bounding boxes using small convolutional filters applied to feature maps.

To achieve high detection accuracy we produce predictions of different scales from feature maps of different scales, and explicitly separate predictions by aspect ratio.

These design features lead to simple end-to-end training and high accuracy, even on low resolution input images, further improving the speed vs accuracy trade-off.

Experiments include timing and accuracy analysis on models with varying input size evaluated on PASCAL VOC, COCO, and ILSVRC and are compared to a range of recent state-of-the-art approaches.

我们总结我们的贡献如下:

我们引入了SSD,这是一种针对多个类别的单次检测器,比先前的先进的单次检测器(YOLO)更快,并且准确得多,事实上,与执行显式区域提出和池化的更慢的技术具有相同的精度(包括Faster R-CNN)。

SSD的核心是预测固定的一系列默认边界框的类别分数和边界框偏移,使用更小的卷积滤波器应用到特征映射上。

为了实现高检测精度,我们根据不同尺度的特征映射生成不同尺度的预测,并通过纵横比明确分开预测。

这些设计功能使得即使在低分辨率输入图像上也能实现简单的端到端训练和高精度,从而进一步提高速度与精度之间的权衡。

实验包括在PASCAL VOC,COCO和ILSVRC上评估具有不同输入大小的模型的时间和精度分析,并与最近的一系列最新方法进行比较。

The SSD approach is based on a feed-forward convolutional network that produces a fixed-size collection of bounding boxes and scores for the presence of object class instances in those boxes, followed by a non-maximum suppression step to produce the final detections. The early network layers are based on a standard architecture used for high quality image classification (truncated before any classification layers), which we will call the base network. We then add auxiliary structure to the network to produce detections with the following key features:

SSD方法基于前馈卷积网络,该网络产生固定大小的边界框集合,并对这些边界框中存在的目标类别实例进行评分,然后进行非极大值抑制步骤来产生最终的检测结果。早期的网络层基于用于高质量图像分类的标准架构(在任何分类层之前被截断),我们将其称为基础网络。然后,我们将辅助结构添加到网络中以产生具有以下关键特征的检测:

Multi-scale feature maps for detection We add convolutional feature layers to the end of the truncated base network. These layers decrease in size progressively and allow predictions of detections at multiple scales. The convolutional model for predicting detections is different for each feature layer (cf Overfeat[4] and YOLO[5] that operate on a single scale feature map).

用于检测的多尺度特征映射。我们将卷积特征层添加到截取的基础网络的末端。这些层在尺寸上逐渐减小,并允许在多个尺度上对检测结果进行预测。用于预测检测的卷积模型对于每个特征层都是不同的(查阅Overfeat[4]和YOLO[5]在单尺度特征映射上的操作)。

Convolutional predictors for detection Each added feature layer (or optionally an existing feature layer from the base network) can produce a fixed set of detection predictions using a set of convolutional filters. These are indicated on top of the SSD network architecture in Fig. 2. For a feature layer of size m×n channels, the basic element for predicting parameters of a potential detection is a 3×3×p small kernel that produces either a score for a category, or a shape offset relative to the default box coordinates. At each of the m×n locations where the kernel is applied, it produces an output value. The bounding box offset output values are measured relative to a default box position relative to each feature map location (cf the architecture of YOLO[5] that uses an intermediate fully connected layer instead of a convolutional filter for this step).

用于检测的卷积预测器。每个添加的特征层(或者任选的来自基础网络的现有特征层)可以使用一组卷积滤波器产生固定的检测预测集合。这些在图2中的SSD网络架构的上部指出。对于具有p通道的大小为m×n的特征层,潜在检测的预测参数的基本元素是3×3×p的小核得到某个类别的分数,或者相对于默认框坐标的形状偏移。在应用卷积核的m×n的每个位置,它会产生一个输出值。边界框偏移输出值是相对每个特征映射位置的相对默认框位置来度量的(查阅YOLO[5]的架构,该步骤使用中间全连接层而不是卷积滤波器)。

Fig. 2: A comparison between two single shot detection models: SSD and YOLO [5]. Our SSD model adds several feature layers to the end of a base network, which predict the offsets to default boxes of different scales and aspect ratios and their associated confidences. SSD with a 300 × 300 input size significantly outperforms its 448 × 448 YOLO counterpart in accuracy on VOC2007 test while also improving the speed.

图2:两个单次检测模型的比较:SSD和YOLO[5]。我们的SSD模型在基础网络的末端添加了几个特征层,它预测了不同尺度和长宽比的默认边界框的偏移量及其相关的置信度。300×300输入尺寸的SSD在VOC2007 test上的准确度上明显优于448×448的YOLO的准确度,同时也提高了速度。

Default boxes and aspect ratios We associate a set of default bounding boxes with each feature map cell, for multiple feature maps at the top of the network. The default boxes tile the feature map in a convolutional manner, so that the position of each box relative to its corresponding cell is fixed. At each feature map cell, we predict the offsets relative to the default box shapes in the cell, as well as the per-class scores that indicate the presence of a class instance in each of those boxes. Specifically, for each box out of k at a given location, we compute c class scores and the 4 offsets relative to the original default box shape. This results in a total of (c+4)k filters that are applied around each location in the feature map, yielding (c+4)kmn outputs for a m×n feature map. For an illustration of default boxes, please refer to Fig.1. Our default boxes are similar to the anchor boxes used in Faster R-CNN[2], however we apply them to several feature maps of different resolutions. Allowing different default box shapes in several feature maps let us efficiently discretize the space of possible output box shapes.

默认边界框和长宽比。对于网络顶部的多个特征映射,我们将一组默认边界框与每个特征映射单元相关联。默认边界框以卷积的方式平铺特征映射,以便每个边界框相对于其对应单元的位置是固定的。在每个特征映射单元中,我们预测单元中相对于默认边界框形状的偏移量,以及指出每个边界框中存在的每个类别实例的类别分数。具体而言,对于给定位置处的k个边界框中的每一个,我们计算c个类别分数和相对于原始默认边界框形状的4个偏移量。这导致在特征映射中的每个位置周围应用总共(c+4)k个滤波器,对于m×n的特征映射取得(c+4)kmn个输出。有关默认边界框的说明,请参见图1。我们的默认边界框与Faster R-CNN[2]中使用的锚边界框相似,但是我们将它们应用到不同分辨率的几个特征映射上。在几个特征映射中允许不同的默认边界框形状让我们有效地离散可能的输出框形状的空间。

Fig. 1: SSD framework. (a) SSD only needs an input image and ground truth boxes for each object during training. In a convolutional fashion, we evaluate a small set (e.g. 4) of default boxes of different aspect ratios at each location in several feature maps with different scales (e.g. 8 × 8 and 4 × 4 in (b) and (c)). For each default box, we predict both the shape offsets and the confidences for all object categories ((c1,c2,…,cp)). At training time, we first match these default boxes to the ground truth boxes. For example, we have matched two default boxes with the cat and one with the dog, which are treated as positives and the rest as negatives. The model loss is a weighted sum between localization loss (e.g. Smooth L1 [6]) and confidence loss (e.g. Softmax).

图1:SSD框架。(a)在训练期间,SSD仅需要每个目标的输入图像和真实边界框。以卷积方式,我们评估具有不同尺度(例如(b)和(c)中的8×8和4×4)的几个特征映射中每个位置处不同长宽比的默认框的小集合(例如4个)。对于每个默认边界框,我们预测所有目标类别((c1,c2,…,cp))的形状偏移量和置信度。在训练时,我们首先将这些默认边界框与实际的边界框进行匹配。例如,我们已经与猫匹配两个默认边界框,与狗匹配了一个,这被视为积极的,其余的是消极的。模型损失是定位损失(例如,Smooth L1[6])和置信度损失(例如Softmax)之间的加权和。

There are two established classes of methods for object detection in images, one based on sliding windows and the other based on region proposal classification. Before the advent of convolutional neural networks, the state of the art for those two approaches —— Deformable Part Model (DPM) [26] and Selective Search [1] —— had comparable performance. However, after the dramatic improvement brought on by R-CNN [22], which combines selective search region proposals and convolutional network based post-classification, region proposal object detection methods became prevalent.

在图像中有两种建立的用于目标检测的方法,一种基于滑动窗口,另一种基于区域提出分类。在卷积神经网络出现之前,这两种方法的最新技术——可变形部件模型(DPM)[26]和选择性搜索[1]——具有相当的性能。然而,在R-CNN[22]结合选择性搜索区域提出和基于后分类的卷积网络带来的显著改进后,区域提出目标检测方法变得流行。

The original R-CNN approach has been improved in a variety of ways. The first set of approaches improve the quality and speed of post-classification, since it requires the classification of thousands of image crops, which is expensive and time-consuming. SPPnet [9] speeds up the original R-CNN approach significantly. It introduces a spatial pyramid pooling layer that is more robust to region size and scale and allows the classification layers to reuse features computed over feature maps generated at several image resolutions. Fast R-CNN [6] extends SPPnet so that it can fine-tune all layers end-to-end by minimizing a loss for both confidences and bounding box regression, which was first introduced in MultiBox [7] for learning objectness.

最初的R-CNN方法已经以各种方式进行了改进。第一套方法提高了后分类的质量和速度,因为它需要对成千上万的裁剪图像进行分类,这是昂贵和耗时的。SPPnet[9]显著加快了原有的R-CNN方法。它引入了一个空间金字塔池化层,该层对区域大小和尺度更鲁棒,并允许分类层重用多个图像分辨率下生成的特征映射上计算的特征。Fast R-CNN[6]扩展了SPPnet,使得它可以通过最小化置信度和边界框回归的损失来对所有层进行端到端的微调,最初在MultiBox[7]中引入用于学习目标。

The second set of approaches improve the quality of proposal generation using deep neural networks. In the most recent works like MultiBox [7,8], the Selective Search region proposals, which are based on low-level image features, are replaced by proposals generated directly from a separate deep neural network. This further improves the detection accuracy but results in a somewhat complex setup, requiring the training of two neural networks with a dependency between them. Faster R-CNN [2] replaces selective search proposals by ones learned from a region proposal network (RPN), and introduces a method to integrate the RPN with Fast R-CNN by alternating between fine-tuning shared convolutional layers and prediction layers for these two networks. This way region proposals are used to pool mid-level features and the final classification step is less expensive. Our SSD is very similar to the region proposal network (RPN) in Faster R-CNN in that we also use a fixed set of (default) boxes for prediction, similar to the anchor boxes in the RPN. But instead of using these to pool features and evaluate another classifier, we simultaneously produce a score for each object category in each box. Thus, our approach avoids the complication of merging RPN with Fast R-CNN and is easier to train, faster, and straightforward to integrate in other tasks.

第二套方法使用深度神经网络提高了提出生成的质量。在最近的工作MultiBox[7,8]中,基于低级图像特征的选择性搜索区域提出直接被单独的深度神经网络生成的提出所取代。这进一步提高了检测精度,但是导致了一些复杂的设置,需要训练两个具有依赖关系的神经网络。Faster R-CNN[2]将选择性搜索提出替换为区域提出网络(RPN)学习到的区域提出,并引入了一种方法,通过交替两个网络之间的微调共享卷积层和预测层将RPN和Fast R-CNN结合在一起。通过这种方式,使用区域提出池化中级特征,并且最后的分类步骤比较便宜。我们的SSD与Faster R-CNN中的区域提出网络(RPN)非常相似,因为我们也使用一组固定的(默认)边界框进行预测,类似于RPN中的锚边界框。但是,我们不是使用这些来池化特征并评估另一个分类器,而是为每个目标类别在每个边界框中同时生成一个分数。因此,我们的方法避免了将RPN与Fast R-CNN合并的复杂性,并且更容易训练,更快且更直接地集成到其它任务中。

Another set of methods, which are directly related to our approach, skip the proposal step altogether and predict bounding boxes and confidences for multiple categories directly. OverFeat [4], a deep version of the sliding window method, predicts a bounding box directly from each location of the topmost feature map after knowing the confidences of the underlying object categories. YOLO [5] uses the whole topmost feature map to predict both confidences for multiple categories and bounding boxes (which are shared for these categories). Our SSD method falls in this category because we do not have the proposal step but use the default boxes. However, our approach is more flexible than the existing methods because we can use default boxes of different aspect ratios on each feature location from multiple feature maps at different scales. If we only use one default box per location from the topmost feature map, our SSD would have similar architecture to OverFeat [4]; if we use the whole topmost feature map and add a fully connected layer for predictions instead of our convolutional predictors, and do not explicitly consider multiple aspect ratios, we can approximately reproduce YOLO [5].

与我们的方法直接相关的另一组方法,完全跳过提出步骤,直接预测多个类别的边界框和置信度。OverFeat[4]是滑动窗口方法的深度版本,在知道了底层目标类别的置信度之后,直接从最顶层的特征映射的每个位置预测边界框。YOLO[5]使用整个最顶层的特征映射来预测多个类别和边界框(这些类别共享)的置信度。我们的SSD方法属于这一类,因为我们没有提出步骤,但使用默认边界框。然而,我们的方法比现有方法更灵活,因为我们可以在不同尺度的多个特征映射的每个特征位置上使用不同长宽比的默认边界框。如果我们只从最顶层的特征映射的每个位置使用一个默认框,我们的SSD将具有与OverFeat[4]相似的架构;如果我们使用整个最顶层的特征映射,并添加一个全连接层进行预测来代替我们的卷积预测器,并且没有明确地考虑多个长宽比,我们可以近似地再现YOLO[5]。

This paper introduces SSD, a fast single-shot object detector for multiple categories. A key feature of our model is the use of multi-scale convolutional bounding box outputs attached to multiple feature maps at the top of the network. This representation allows us to efficiently model the space of possible box shapes. We experimentally validate that given appropriate training strategies, a larger number of carefully chosen default bounding boxes results in improved performance. We build SSD models with at least an order of magnitude more box predictions sampling location, scale, and aspect ratio, than existing methods [5,7]. We demonstrate that given the same VGG-16 base architecture, SSD compares favorably to its state-of-the-art object detector counterparts in terms of both accuracy and speed. Our SSD512 model significantly outperforms the state-of-the-art Faster R-CNN [2] in terms of accuracy on PASCAL VOC and COCO, while being 3× faster. Our real time SSD300 model runs at 59 FPS, which is faster than the current real time YOLO [5] alternative, while producing markedly superior detection accuracy.

本文介绍了SSD,一种快速的单次多类别目标检测器。我们模型的一个关键特性是使用网络顶部多个特征映射的多尺度卷积边界框输出。这种表示使我们能够高效地建模可能的边界框形状空间。我们通过实验验证,在给定合适训练策略的情况下,大量仔细选择的默认边界框会提高性能。我们构建的SSD模型比现有的方法至少要多一个数量级的边界框预测采样位置,尺度和长宽比[5,7]。我们证明了给定相同的VGG-16基础架构,SSD在准确性和速度方面与其对应的最先进的目标检测器相比毫不逊色。在PASCAL VOC和COCO上,我们的SSD512模型的性能明显优于最先进的Faster R-CNN[2],而速度提高了3倍。我们的实时SSD300模型运行速度为59FPS,比目前的实时YOLO[5]更快,同时显著提高了检测精度。

Apart from its standalone utility, we believe that our monolithic and relatively simple SSD model provides a useful building block for larger systems that employ an object detection component. A promising future direction is to explore its use as part of a system using recurrent neural networks to detect and track objects in video simultaneously.

除了单独使用之外,我们相信我们的整体和相对简单的SSD模型为采用目标检测组件的大型系统提供了有用的构建模块。一个有前景的未来方向是探索它作为系统的一部分,使用循环神经网络来同时检测和跟踪视频中的目标。

相关参考