【增量目标检测笔记】:1-Incremental Learning of Object Detectors without Catastrophic Forgetting

无灾难性遗忘的增量学习目标检测器

论文地址:https://arxiv.org/abs/1708.06977
代码地址:https://github.com/kshmelkov/incremental_detectors

前言

个人需要做增量目标检测的工作,看这篇文章对味儿,就纪录一下,看的是网站上相应的博客(其实就一篇博客),就是个自己的笔记
可以去看原博客,地址:https://blog.csdn.net/qq_38701106/article/details/121294158
论文是17年的老文章了

论文介绍

使用迁移学习方法 :

  1. 首先训练一个fast-rcnn的网络结构使其能够检测原本的数据集CA,这个网络结构记为A(CA)。
  2. 对先前训练得到的网络A(CA)做两份copies:一个冻结的网络通过蒸馏loss对原来的CA进行检测识别;另外一个B(CB)被扩充用来检测新的分类CB(在元数据中未出现或未被标注)。
  3. 创建一个新的FC层用来只对新的分类检测,然后将其输出和原来的输出做concat,即:根据新增加的类别数对网络A进行扩展,即增加全连接层的输出个数,得到初始化的Network B网络。新的层是采用和先前的网络A一样的初始化方式进行随机初始化的。最终目标就是:训练一个网络能够仅仅使用新的数据,最后能够识别出新增分类和旧分类的网络

Alt

论文正文

摘要

Despite their success for object detection, convolutional neural networks are ill-equipped for incremental learning, mi.e., adapting the original model trained on a set of classes to additionally detect objects of new classes, in the absence of the initial training data. They suffer from “catastrophic forgetting”—an abrupt degradation of performance on the original set of classes, when the training objective is adapted to the new classes. We present a method to address this issue, and learn object detectors incrementally, when neither the original training data nor annotations for the original classes in the new training set are available. The core of our proposed solution is a loss function to balance the interplay between predictions on the new classes and a new distillation loss which minimizes the discrepancy between responses for old classes from the original and the updated networks. **This incremental learning can be performed multiple times, for a new set of classes in each step, with a moderate drop in performance compared to the baseline network trained on the ensemble of data. ** We present object detection results on the PASCAL VOC 2007 and COCO datasets, along with a detailed empirical analysis of the approach.

尽管卷积神经网络在目标检测方面取得了成功,但它在增量学习方面的能力却很差,例如,在缺乏初始训练数据的情况下,调整在一组类上训练的原始模型,以额外检测新类的目标。他们会遇到“灾难性遗忘”问题——当训练目标适应新类时,原有类的表现突然下降。我们提出了一种方法来解决这个问题,当新训练集中的原始训练数据和原始类的标注都不可用时,我们可以增量地学习目标检测器。**我们提出的解决方案的核心是一个损失函数,用于平衡新类别预测和新蒸馏损失之间的相互作用,从而最小化原始网络和更新网络中旧类别响应之间的差异。这种增量学习可以在每个步骤中对一组新的类执行多次,与在数据集合上训练的基线网络相比,性能略有下降。**我们展示了PASCAL VOC 2007和COCO数据集上的目标检测结果,并对该方法进行了详细的实证分析。

札记:目标检测在处理增量任务的时候表现差(灾难性遗忘的问题),针对OD的这个问题,解决方案是新增一个损失函数,能够实现最小化原始网络和更新网络中旧类别响应之间的差异。

介绍

细致的原文就不再粘了,单挑我觉得重要的记,颜色我随意调的

基于卷积神经网络的现代检测方法,在公共数据集上有最先进的结果。但是模型训练时间太久

A popular way to mitigate this is to use CNNs pretrained on a certain dataset for a task, and adapt them to new datasets or tasks, rather than train the entire network from scratch.

微调针对新任务在原始网络结构的基础上重新在调整模型参数重新训练的结果,但是需要在所有类的基础上联合训练,才能保证微调的有效性。如若不然,就会发生灾难性干扰或遗忘。

While this framework is very successful on the new classes, its performance on the old ones suffers dramatically, if the network is not trained on all the classes jointly. This issue, where a neural network forgets previously learned knowledge when adapted to a new task, is referred to as catastrophic interference or forgetting.

在这里插入图片描述

这个图像就是灾难性遗忘的简单举例,没什么好解释的,原文这里说:第一个CNN(上图)在三个类接受训练,包括person,并在图像中定位骑手。第二个CNN(下图)是第一个类别马的增量训练版本。

This adapted network localizes the horse in the image, but fails to detect the rider, which it was capable of originally, and despite the fact that the person class was not updated.

然后,这篇文章就开始介绍他们的创新,核心是一个损失函数,这个损失平衡了新类别预测之间的相互作用,即交叉熵损失,还有一个能够最小化原始网络与新网络二者对旧类别的相应差异的蒸馏损失。

Figure2

Figure 2. Overview of our framework for learning object detectors incrementally. It is composed of a frozen copy of the detector (Network A) and the detector (Network B) adapted for the new class(es). See text for details.增量学习目标检测器的框架概述。它由检测器的冻结副本(网络a)和适用于新类别的检测器(网络B)组成。有关详细信息,请参阅文本。

原文:We use a frozen copy of the original detection network to compute the distillation loss. This loss is related to the concept of “knowledge distillation” proposed in [19], but our application of it is significantly different from this previous work, as discussed in Section 3.2. We specifically target the problem of object detection, which has the additional challenge of localizing objects with bounding boxes, unlike other attempts [23,31] limited to the image classification task. We demonstrate experimental results on the PASCAL VOC and COCO datasets using Fast R-CNN [14] as the network. Our results show that we can add new classes incrementally to an existing network without forgetting the original classes, and with no access to the original trainingdata. We also evaluate variants of our method empirically, and show the influence of distillation and the loss function. Note that our framework is general and can be applied to any other CNN-based object detectors where proposals are computed externally, or static sliding windows are used.

这段就介绍了一下工作的效果,说明了这个模型可以在不忘记原始类的情况下,向现有网络中增量添加新类,并且不需要访问原始训练数据。

相关工作

The problem of incremental learning has a long history in machine learning and artificial intelligence [6,29,36,37]. Some of the more recent work, e.g., [8, 9], focuses on continuously updating the training set with data acquired from the Internet. They are: (i) restricted to learning with a fixeddata representation [9], or (ii) keep all the collected data to retrain the model [8]. Other work partially addresses these issues by learning classifiers without access to the ensemble of data [26, 33], but uses a fixed image representation. Unlike these methods, our approach is aimed at learning the representation and classifiers jointly, without storing all the training examples. To this end, we use neural networks to model the task in an end-to-end fashion.[^1]
Our work is also topically related to transfer learning and domain adaptation methods. Transfer learning uses knowledge acquired from one task to help learn another. Domain adaptation transfers the knowledge acquired for a task from a data distribution to other (but related) data. These paradigms, and in particular fine-tuning, a special case of transfer learning, are very popular in computer vision. CNNs learned for image classification [21] are often used to train other vision tasks such as object detection [28,40] and semantic segmentation [7].
An alternative to transfer knowledge from one network to another is distillation [5, 19]. This was originally proposed to transfer knowledge between different neural networks—from a large network to a smaller one for efficient deployment. The method in [19] encouraged the large (old) and the small (new) networks to produce similar responses. It has found several applications in domain adaptation and model compression [17, 34, 39]. Overall, transfer learning and domain adaptation methods require at least unlabeled data for both the tasks or domains, and in its absence, the new network quickly forgets all the knowledge acquired in the source domain [12, 16, 25, 30]. In contrast, our approach addresses the challenging case where no training data is available for the original task (i.e., detecting objects belonging to the original classes), by building on the concept of knowledge distillation [19].[^2]
This phenomenon of forgetting is believed to be caused by two factors [11, 22]. First, the internal representations in hidden layers are often overlapping, and a small change in a single neuron can affect multiple representations at the same time [11]. Second, all the parameters in feedforward networks are involved in computations for every data point, and a backpropagation update affects all of them in each training step [22].[^3] The problem of addressing these issues in neural networks has its origin in classical connectionist networks several years ago [2, 11–13, 25], but needs to beadapted to today’s large deep neural network architectures for vision tasks [23,31].
Li and Hoiem [23] use knowledge distillation for one of the classical vision tasks, image classification, formulated in a deep learning framework. However, their evaluation is limited to the case where the old network is trained on a dataset, while the new network is trained on a different one, e.g., Places365 for the old and PASCAL VOC for the new, ImageNet for the old and PASCAL VOC for the new, etc. While this is interesting, it is a simpler task, because: (i) different datasets often contain dissimilar classes, (ii) there is little confusion between datasets—it is in fact possible to identify a dataset simply from an image [38].
Our method is significantly different from [23] in two ways. First, we deal with the more difficult problem of learning incrementally on the same dataset, i.e., the addition of classes to the network. As shown in [31], [23] fails in a similar setting of learning image classifiers incrementally. Second, we address the object detection task, where it is very common for the old and the new classes to co-occur, unlike the classification task.
Very recently, Rebuffi et al. [31] address some of the drawbacks in [23] with their incremental learning approach for image classification. They also use knowledge distillation, but decouple the classifier and the representation learning. Additionally, they rely on a subset of the original training data to preserve the performance on the old classes. In comparison, our approach is an end-to-end learning framework, where the representation and the classifier are learned jointly, and we do not use any of the original training samples to avoid catastrophic forgetting.[^4]
Alternatives to distillation are: growing the capacity of the network with new layers [35], applying strong per-parameter regularization selectively [20]. The downside to these methods is the rapid increase in the number of new parameters to be learned [35], and their limited evaluation on the easier task of image classification [20].[^5]
In summary, none of the previous work addresses the problem of learning classifiers for object detection incrementally, without using previously seen training samples.

与这些方法不同,我们的方法旨在联合学习表示和分类器,而不存储所有训练示例。为此,我们使用神经网络以端到端的方式对任务进行建模。
将知识从一个网络转移到另一个网络的另一种方法是蒸馏,这最初是为了在不同的神经网络之间传递知识,从一个大的网络到一个小的网络,以便有效地部署。
遗忘现象被认为是由两个因素引起的: 首先,隐藏层中的内部表示通常是重叠的,单个神经元的微小变化可能同时影响多个表示[11]。其次,前馈网络中的所有参数都涉及到每个数据点的计算,而反向传播更新会在每个训练步骤中影响所有参数[22]。
最近,Rebuffi et al.[31]利用其用于图像分类的增量学习方法解决了[23]中的一些缺点。它们还使用知识蒸馏,但将分类器和表示学习解耦。此外,它们依赖于原始训练数据的子集来保持旧类的性能。相比之下,我们的方法是端到端学习框架,其中表示和分类器是联合学习的,并且我们不使用任何原始训练样本来避免灾难性遗忘。
蒸馏的替代方法是:增加新层的网络容量[35],选择性地应用强的参数正则化[20]。这些方法的缺点是需要学习的新参数数量迅速增加[35],且对更简单的图像分类任务的评估有限[20]。

3. Incremental learning of new classes

3.1 Object detection network

net
文章中,原始检测器的冻结副本(图中由网络a表示),用于:
(i). 选择与旧类相对应的方案,即蒸馏方案,
(ii). 计算蒸馏损失。图中的网络B是新类的适应网络。它是通过增加原始网络最后一层的输出数量来实现的,这样新的输出层既包括旧的类,也包括新的类。
In order to avoid catastrophic forgetting——对自适应网络的学习过程进行了约束,加入蒸馏损失来实现这一点,以保持旧类别的性能,作为标准交叉熵损失函数中的附加项

具体一点就是:
评估冻结副本(网络A)上的每个新训练样本,以选择一组不同的建议框(图2中的蒸馏建议框),并记录其数据。有了这些数据,我们计算了一个蒸馏损失,用于测量蒸馏方案的两个网络之间的差异。该损失被添加到新类的交叉熵损失中,以弥补用于训练自适应检测网络的损失函数。

主干网络:选择ResNet-50替换VGG-16,

在最后一个卷积层之前,我们插入一个RoI池层,该层在不同大小的区域(即建议框)上进行最大池化,并将其插入到7×7的特征图中。然后,我们添加剩余的残差网络、一个用于空间维度平均池的层和两个完全连接的层:一个用于分类的softmax层(例如,PASCAL或COCO类以及背景类)和一个用于边界框细化的回归层,每个类都有独立的校正。

Fast RCNN损失函数

3.2 Dual-network learning

第一个网络,使用原始类别CA,将这个网络成为(CA)
目标:在(CA)的基础上添加一组CB
制作两份(CA):

  1. 一份被冻结以通过蒸馏损失识别类别CA,通过将A(CA)的冻结副本应用于任何新图像来计算蒸馏损失。即使A(CA)未检测到任何目标,非规范化的logit(softmax输入)也会携带足够的信息,以便将旧类的知识从A(CA)提取到B(CB)。
  2. 另一份被扩展以检测新类别CB,这些类别CB在源图像中不存在或没有注释。这些类别CB在源图像中不存在或没有注释。扩展仅在最后一个完全连接的层中进行,即分类和边界框回归。
  3. 仅为新类创建全连接层[15],并将其输出与原始类连接起来。新层以与Fast R-CNN中相应层相同的方式随机初始化。我们的目标是训练B(CB)识别CA∪ CB仅使用CB的新数据和注释。

文中加入蒸馏的目的是希望 “保持网络的所有答案相同或尽可能接近” ,在没有蒸馏的情况下训练B(CB),在几百次SGD迭代之后,旧类的平均精度将迅速降低。这是灾难性遗忘的表现。

每幅图像的处理方式
  • 对于每幅图像,你有128个RoI,每个RoI有一个与背景相关的得分。为了训练模型,你从中随机选择64个背景得分最小的RoI。背景得分小意味着这些区域更有可能包含目标,而不是背景。

  • A(CA)的logits作为旧类别的目标,用作新模型“靠近旧类别参数”的参考目标,每个RoI的logits中减去类别维度上的均值。这样做是为了消除某些类别可能比其他类别有更高的初始分数,确保训练更稳定。

  • B(CB)的logits作为新类别,在蒸馏损失中不被考虑。

  • L2损失是一种测量预测与目标值差异的方式,比交叉熵损失更适合回归问题(比如边界框预测),因为它能提供更稳定的训练过程和更好的性能。所以,对于回归输出,选择使用L2损失而不是交叉熵损失。
    L d i s t ( y A , t A , y B , t B ) = 1 N ∣ C A ∣ ∑ [ ( y ˉ A − y ˉ B ) 2 + ( t A − t B ) 2 ]   \mathcal{L}_{dist}(y_A,t_A,y_B,t_B) = \frac{1}{N|C_A|}\sum[(\bar y_A - \bar y_B)^2 + (t_A - t_B)^2] \, Ldist(yA,tA,yB,tB)=NCA1[(yˉAyˉB)2+(tAtB)2]

    • 其中,N是为蒸馏取样的ROI数量(即,在本例中为64),|CA |是旧类别的数量,总和是旧类别的所有ROI的总和。与[19]不同,我们在没有任何平滑的情况下提取Logit,因为大多数建议框已经产生了平滑的分数分布。此外,在我们的例子中,旧的和新的网络都是相似的,具有几乎相同的参数(在开始时),因此平滑logits分布对于稳定学习是不必要的。
  • The values of the bounding box regression are also distilled because we update all the layers, and any update of the convolutional layers will affect them indirectly. As box refinements are important to detect objects accurately, their values should be conserved as well. This is an easier task than keeping the classification scores because bounding box refinements for each class are independent, and are not linked by the softmax.

    这段是说,边界框回归的值也被蒸馏提取了,因为新的模型所有层都被更新了,卷积层的任何更新都将影响这些层,所以As box refinements are important to detect objects accurately, their values should be conserved as well.(这段感觉贴出原文会好一点)

  • 重头戏,这篇文章的总损失:
    L = L r c n n + λ L d i s t \mathcal{L}_{} = \mathcal{L}_{rcnn} + \lambda\mathcal{L}_{dist} L=Lrcnn+λLdist

    • 蒸馏损失 L r c n n \mathcal{L}_{rcnn} \quad Lrcnn
    • 仅适用于新类别CB的标准快速R-CNN损失的加权和 L d i s t   \mathcal{L}_{dist} \, Ldist
    • 其中超参数λ平衡两个损失。在所有交叉验证实验中,我们将λ设置为1
    • 用A(CA)模型冻结参数后以防止在缺乏A(CA)使用的原始训练数据的情况下发生灾难性遗忘。
    • 在B(CB)的训练完成后,我们可以通过冻结新训练的网络并将其用于蒸馏来添加更多的类。

    因此,可以按顺序添加新类。因为B(CB)在结构上与A相同(CA∪ CB),可以重复扩展以添加更多类。

3.3 Sampling strategy

As mentioned before, we choose 64 proposals out of 128 with the lowest background score, thus biasing the distillation to non-background proposals. We noticed that proposals recognized as confident background do not provide strong learning cues to conserve the original classes. One possibility is using an unbiased distillation that randomly samples 64 proposals out of the whole set of 2000 proposals. However, when doing so, the detection performance on old classes is noticeably worse because most of the distillation proposals are now background, and carry no strong signal about the object categories. Therefore, it is advantageous to select non-background proposals. We demonstrate this empirically in Section 4.5.

这里我就不翻译了,直接说拙见吧

  • 这里的背景指的是区别于CA中所有类别的数据,CB中的新类别对于A(CA)来讲,也是背景。
  • 这里的背景和前景是相对于冻结模型A(CA)而言的,所以,A(简称A)认为这128个提案(RoI)中背景得分最低的64个,意味着它们更可能包含实际对象而不是背景,这64个ROI,也就是我们说的旧样本的softlabel。这种选取背景得分最低的ROI的方式就叫做有偏采样
  • 作者通过实验发现,偏向选择非背景提案在保留旧类别的检测性能方面更为有效。因此,从128个背景得分最低的提案中选择64个,是一种更有利的蒸馏策略。因为我们的目的是希望通过蒸馏使新训练出来的网络对旧类别保持记忆

4 实验

4.1 Datasets and evaluation

We evaluate our method on the PASCAL VOC 2007 detection benchmark and the Microsoft COCO challenge dataset. VOC 2007 consists of 5K images in the trainval split and 5K images in the test split for 20 object classes. COCO on the other hand has 80K images in the training set and 40K images in the validation set for 80 object classes (which includes all the classes from VOC). We use the standard mean average precision (mAP) at 0.5 IoU threshold as the evaluation metric. We also report mAP weighted across different IoU from 0.5 to 0.95 on COCO, as recommended in the COCO challenge guidelines. Evaluation of the VOC 2007 experiments is done on the test split, while for COCO, we use the first 5000 images from the validation set.

作者在两个数据集上评估了他们的方法。PASCAL VOC 2007用于评估20个对象类别的检测性能,而COCO则用于评估80个对象类别的检测性能,采用更严格和全面的mAP评估标准。

4.2 Implementation details

We use SGD with Nesterov momentum [27] to train the network in all the experiments. We set the learning rate to 0.001, decay to 0.0001 after 30K iterations, and momentum to 0.9. In the second stage of training, i.e., learning the extended network with new classes, we used a learning rate of 0.0001. The A(CA) network is trained for 40K iterations on PASCAL VOC 2007 and for 400K iterations on COCO. The B(CB) network is trained for 3K-5K iterations when only one class is added, and for the same number of iterations as A(CA) when many classes are added at once. Following Fast R-CNN [14], we regularize with weight decay of 0.00005 and take batches of two images each. All the layers of A(CA) and B(CB) networks are finetuned unless stated otherwise.

训练方法

  1. 优化算法:
    使用了随机梯度下降(SGD)结合Nesterov动量来训练网络。这是一种常用的优化方法,有助于加速收敛并避免陷入局部最优。
  2. 学习率设置:
  • 初始学习率设置为 0.001,这是一个常见的选择,能够让模型开始有效学习。
  • 在30,000次迭代后,学习率会衰减到 0.0001,这一策略能够让模型在训练后期稳定下来,避免过度调整权重。
  • 动量(momentum)设置为 0.9,这有助于缓解训练过程中的抖动,促进更平滑的收敛。
  1. 第二阶段训练:
    在训练过程中,当模型扩展到学习新的类别时,采用了更低的学习率 0.0001。这通常是为了防止新类别的学习对已经学到的旧类别产生过大的干扰。
  2. A(CA)和B(CB)网络的训练轮数:
  • A(CA)网络(旧类别网络):
    在 PASCAL VOC 2007 数据集上训练 40,000次迭代。
    在 COCO 数据集上训练 400,000次迭代。
  • B(CB)网络(扩展类别网络):
    当只添加一个新类别时,训练 3,000到5,000次迭代。
    当一次性添加多个类别时,训练次数与A(CA)网络相同,保持一致。
  1. 正则化和批次设置:
    采用 权重衰减(weight decay)作为正则化手段,系数为 0.00005,用于防止模型过拟合。
    每个批次(batch)处理 两张图片,这一设置符合 Fast R-CNN 的训练流程。
  2. 网络微调:
    A(CA)和B(CB)网络的所有层都进行了微调,除非特别说明。这意味着模型的各个层都会在新数据上重新训练,以适应新的任务需求。

网络结构调整

  1. ResNet与Fast R-CNN的集成:
  • 在将ResNet集成到Fast R-CNN时,添加了一个RoI池化层,该层位于 conv5 1层 之前。RoI池化层的作用是将候选区域(RoI)统一成固定尺寸,以便后续的卷积操作。
  • 替换了ResNet的最终分类层,改为两个并行的全连接层。一个用于分类,另一个用于边界框回归。
  1. 批归一化层的冻结:
  • 批归一化层(Batch Normalization)在训练过程中被冻结,也就是说,这些层的参数不再更新。这样做的目的是保持模型在训练新数据时的稳定性,避免批归一化层因小批量数据而产生较大的波动。
  • 与Fast R-CNN类似,没有使用dropout。dropout是一种防止过拟合的技术,但在这里被禁用了,可能是因为ResNet已经包含了足够的正则化策略。

训练与后处理

  1. RoI的检测标准
    -· 一个RoI在对任一类别的置信度分数(得分)必须超过0.5,才会被认为是detection
  2. 每类的NMS:
    • 采用每类NMS,分别对每个类别使用NMS,IoU(交并比1)设为0.3,如果两个检测框的IoU超过0.3,则会去除得分较低的那个。
  1. 基于图像的训练:
    • 训练是以图像为中心进行的,这意味着每次训练都是针对一张图像的所有RoI进行的,而不是从整个数据集中随机抽取RoI。
    • 每个批次包含 64个RoI,其中 16个RoI 的IoU与真实目标框的重叠度至少为0.5。这样确保了批次中有足够的正样本进行有效训练。
  2. proposal的过滤:
    • 所有的提案(也就是RoI)在被处理之前,都会筛掉与真实目标框的IoU超过0.7的proposal——防止模型过度依赖高IoU的提案,从而增强模型的泛化能力。

这段话描述了如何使用TensorFlow开发增量学习框架,并详细说明了训练过程中如何选择和处理数据集的子集。以下是逐步解释:

增量学习框架的基本流程

增量学习框架中的两个主要步骤:首先训练网络以学习初始类别集合 CA,然后扩展网络以学习新类别集合 CB。在每个步骤中,仅使用包含相应类别对象的图像进行训练,而忽略其他类别的标注信息。为了提高效率,冻结了初始网络并预先计算其对训练数据的响应。

  1. 选择初始类别集合(CA)

    • 在每次实验开始时,首先从所有类别中选择一个子集,这个子集称为 CA(旧类别集合)。
    • 然后,网络在 CA 对应的训练集子集上进行学习。
  2. 训练初始网络

    • 初始训练集子集仅包含至少有一个对象属于 CA 的图像。也就是说,只有这些图像才会用于训练。
    • 对于这些图像中属于其他类别(非 CA 类别)的标注会被忽略,这意味着这些类别的对象不会对网络的学习产生影响。
  3. 选择新类别集合(CB)并扩展网络

    • 当需要扩展网络以学习新类别时,会选择另一个类别子集 CB(新类别集合)。
    • 接下来,网络会在包含至少一个 CB 对象的图像子集上进行学习。
    • 与前面的步骤类似,训练时会忽略所有其他类别(包括原始类别 CA 和其他未选择的类别)的标注信息。
  4. 冻结旧网络并预计算响应

    • 为了提高计算效率,冻结了初始网络 A(CA),即不再更新其参数。
    • 由于在训练过程中每张图像通常会被多次使用,因此在训练开始前,会预先计算并存储冻结网络 A(CA) 对训练数据的响应。这减少了重复计算的开销。
4.3 Addition of one class(单类别增量)

VOC 中19个类作为CA,剩下的一个作为唯一的新类CB

methodoldnewall
A(1-19)68.4--
+B(20) w/o distillation25.052.126.4
+B(20) w frozen trunk53.543.152.9
+B(20) w all layers frozen69.141.666.6
+B(20) w fozen trunk and distill.68.743.267.4
+B(20) w distillation68.358.367.8
+B(20) w cross-entropy distill.68.152.067.3
+B(20) w/o bbox distillation68.562.768.3
A(1-20)69.673.9 69.8

“妥协了,手敲太累眼了”

  • 添加新类的基线方法是将输出添加到最后一层,并冻结网络的其余部分。
  • 在网络卷积层的权重固定的情况下(表中的B(20)w frozen trunk),这种冻结会导致新类的性能降低,因为以前学习的表示法没有适用于它。此外,它不能防止旧类的性能下降,在旧类中,mAP下降了近15%。
  • 当我们冻结所有层,包括旧输出层(B(20)w all layers frozen)或应用蒸馏损失(B(20)w fozen trunk and distill.)时,旧级的性能保持不变,但新级的性能较差。这表明卷积层的微调对于学习新类是必要的。
  • 当网络B(20)在没有蒸馏损失的情况下(表中的“B(20)w/o distillation)进行训练时,它可以学习第20个类,但在其他(旧)类上性能会显著下降。如表6所示,“猫”、“人”类的AP下降了60%以上。使用蒸馏损失的相同训练过程(+B(20) w distillation )在很大程度上减轻了这种灾难性遗忘。在没有蒸馏的情况下,新网络在旧类上有25.0%的mAP,而在蒸馏的情况下有68.3%,在所有类上联合训练的基线快速R-CNN有69.6%的mAP(“A(1-20)”)。
  • 蒸馏的性能与旧网络A(1-19)相似,但某些类别的性能较低,例如“瓶”。第20个类别“tvmonitor”在有无蒸馏的情况下均未达到基线的全部性能(73.9%),且低于60%。这可能是由于训练集的大小。B(20)网络只训练了几百个包含此类实例的图像。因此,“tvmonitor”分类器看不到底片的完全多样性。
  • 还进行了“添加一类”实验,每个VOC类别都是新的类别。每个类的行为与上面描述的“tvmonitor”案例非常相似。地图范围从66.1%(对于新类别“绵羊”)到68.3%(tvmonitor),平均值为67.38%,标准偏差为0.6%。
    Tabe 6.
4.4 Addition of multiple classes(多类别增量)
  • 使用对应于这些类的VOC trainval子集,在前10个VOC类(按字母顺序)上训练网络A(1-10)。
  • 在第二阶段的培训中,我们使用剩余的10个类作为CB,只对包含新类的图像进行培训。
  • 表2显示了VOC测试集上这些网络的评估总结,完整结果见表7。
    list 2
    table 7
  • 在10个新类(旧类)上对网络B(11-20)进行蒸馏训练,获得63.1%的mAP(“表中的B(11-20)w distillation”),而在所有20个类(“A(1-20)”上训练的基线网络为69.8%。
  • 正如之前增加一个类别的实验一样,新类别的表现略差于所有类别的联合培训。例如,如表7所示,“人”的表现为73.2%对79.1%,而“火车”的表现为72.5%对76.8%。
  • 对于有蒸馏的网络,新类的映射为63.1%,而对于联合训练的模型,映射为71.3%。然而,在没有蒸馏的情况下,网络在旧类上仅实现12.8%的mAP(“+B(11-20)w/o distillation”)。请注意,没有边界框蒸馏的方法(“+B(11-20)w/o bbox distillation”)不如我们的完整方法(“+B(11-20)w distillation”)。

蒸馏与超参数

  • 对控制蒸馏相对重要性和快速R-CNN损失的超参数λ(3)的不同值进行了10级实验。
  • 图3所示的结果表明,当蒸馏较弱(λ=0.1)时,新类更容易学习,但旧类更容易忘记。当蒸馏很强(λ=10)时,它会破坏训练的稳定性并阻碍学习新类。将λ设置为1是学习新课程和防止灾难性遗忘之间的一个良好权衡。

Figure 3.

文章还将自己的方法与弹性权重整合(EWC)[20]进行了比较,后者是蒸馏的替代方法,并选择性地应用每参数正则化来缓解灾难性遗忘。重新实现了EWC,并验证其产生的结果与MNIST上[20]中报告的结果相当,然后将其应用于文中的目标检测任务。

通过在培训阶段使用快速R-CNN批次(如第4.2节所述),并用Fast R-CNN损失替换日志损失来实现这一点。在这种情况下,当一次添加10个类时,文中的方法优于EWC,如表2和表7所示。

新类别对增量学习的影响
文中表3总结了这些结果,列出了类别数量对增量结果的影响,表8显示了每类结果。
Table 3.
Table 8.

先学习一个15类的网络,然后再训练剩下的5类,在VOC上一次添加。

  • 网络B(16-20)比网络B(11-20)具有更好的整体性能:65.9%的mAP比63.1%的mAP。
  • 与10个类的实验一样,一些类(例如“table”、“horse”)的性能低于初始模型A(1-15)。
    新类的成绩低于联合训练的基线Fast R-CNN A(1-20)。

总体而言,B(16-20)的mAP低于基线Fast R-CNN(65.9%对69.8%)。

  • COCO的评估
    对COCO的评估是在初始设置的前40个类中进行的,剩余的40个类在新的第二阶段中进行。
    蒸馏训练方式:用蒸馏损失训练的网络B(41-80)在PASCALstyle度量中获得37.4%mAP,在COCO度量中获得21%mAP
    联合训练方式:在80个类别上训练的基线网络在性能上相似,mAP分别为38.1%22.6%。我们2观察到,我们提出的方法克服了灾难性遗忘,就像前面所看到的VOC一样。

在这里插入图片描述
还研究了蒸馏是否依赖于此损失中使用的图像分布

  1. 使用在VOC上训练的模型A(1-10)
  2. 在两种设置中执行第二阶段学习:B(11-20)像以前一样在VOC子集上学习,另一个模型为同一组类训练,但使用COCO子集。

在这里插入图片描述
这里总结:

  • 从表5中我们可以看出,当背景样本在两个训练阶段的分布完全相同时,蒸馏效果确实更好。但是,即使第二阶段中的数据集与第一阶段中使用的数据集不同,它仍然非常有效。
4.5 Sequential addition of multiple classes(多个类别的顺序添加)
  • 为了评估顺序添加类别的增量学习,我们使用在新类别上训练过的网络替换冻结的网络副本,然后再对另一个新类别重复这一过程。
  • 举个例子,我们先使用已经学习了VOC数据集中15个类别的网络,在仅包含第16个类别的子集上进行训练,然后将这个包含16个类别的网络作为冻结的副本,用来学习第17个类别。
  • 这个过程会一直持续到学习第20个类别。我们将这种增量扩展表示为B(16)(17)(18)(19)(20)。

逐步添加类别的结果如表8和表9所示。

  1. 添加5个类别后,我们获得了62.4%的mAP(表8第3行),低于一次性添加5个类别时获得的65.9%(表8第2行)。
    Table 8.
  2. 表9展示了在每次添加类别后的中间评估结果。我们观察到在大多数情况下,原始类别的性能在每一步都保持稳定,但对于某些类别,其性能在后续步骤中没有恢复。
  • 我们通过实验评估了使用带偏向的非背景提案的重要性(参见§3.3)。在此实验中,我们逐个添加了5个类别,但使用了无偏的蒸馏方法(即表3和表8中的“B(16)(17)(18)(19)(20) w unbiased distill.”),也就是说,随机采样的提案被用于蒸馏。结果整体性能显著下降(46% 对比 62.4%),且某些类别(如“person”,“chair”)的性能出现了10-20%的大幅下降。
  • 我们还进行了添加10个类别的逐步添加实验,结果展示在表10中。尽管mAP的下降比前一个添加5个类别的实验更为显著,但它远未达到灾难性遗忘的程度。

Table 9 & 10

4.6 Other alternatives
  • 学习多个网络。学习多个类的另一个解决方案是为每个类训练一个新的网络,然后结合它们的检测。这在测试时是一种昂贵的策略,因为每个网络都必须独立运行,包括特征提取。这似乎是一件合理的事情,因为每个类的目标检测评估都是独立完成的,然而,学习通常不是独立的。虽然我们可以为10个类学习一个像样的检测网络,但独立学习单个类时要困难得多。为了证明这一点,我们为1-15个类训练了一个网络,然后为16-20个类别中的每个类分别训练了一个网络。这导致总共有6个网络(表3中的“+A(16)+…+A(20)”行),相比之下,使用单个网络(“+B(16)(17)…(20)w distill. ”)实现的5个类的增量学习。结果证实,新类很难单独学习。
  • 不同的蒸馏损失。如[19]所述,知识蒸馏也可以表示为交叉熵损失。我们将其与单类扩展实验中基于L2的损失进行了比较(“表1和表6中的B(20)w cross-entropy distill.”)。交叉熵蒸馏与L2蒸馏一样工作,保持旧类的完整性(67.3%对67.8%),但在新类“tvmonitor”上的性能比L2差(52%对58.3%)。我们还观察到交叉熵对训练计划更为敏感。根据[19],两种配方应在高浓度范围内等效
  • logits的平滑因子(参见§3.2),但我们选择不平滑会导致这种不同的行为。
  • 边界框回归蒸馏。添加10个类别(表2)而不蒸馏边界框回归值的表现始终比完全蒸馏损失差。整体B(11-20)无蒸馏边界框回归得到60.9%,而完全蒸馏得到63.1%。然而,在一些新类别上,性能可能高于全蒸馏(表7)。无边界框蒸馏的B(20)也是如此(表6),其在“tvmonitor”上具有更好的性能(62.7%对58.3%)。当选择其他类别作为新类别时,情况并非如此。事实上,边界框蒸馏显示“sheep”类提高了2%。

5 结论

直接贴原文了

In this paper, we have presented an approach for incremental learning of object detectors for new classes, without access to the training data corresponding to the old classes. We address the problem of catastrophic forgetting in this context, with a loss function that optimizes the performance on the new classes, in addition to preserving the performance on the old classes. Our extensive experimental analysis demonstrates that our approach performs well, even in the extreme case of adding new classes one by one. Part of future work is adapting our method to learned proposals, e.g., from RPN for Faster R-CNN [32], by reformulating RPN as a single class detector that works on sliding window proposals. This requires adding another term for RPNbased knowledge distillation in the loss function.


  1. 我自己总是忘。这里再提一下中文。 ↩︎

  2. 我懒,不想改了 ↩︎

  • 20
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值