2019 CVPR的一篇SOTA,文章提出了金字塔模型pyramid model和多loss动态训练的方法Multi-Loss Dynamic Training。pyramid model主要解决粗粒度到细粒度的全面feature切片提取,Multi-Loss Dynamic Training主要解决triplet loss难样本采样均衡和动态学习weighting loss parameter的问题。文章在多个benchmark上刷新当时的SOTA。
论文一览(背景护眼色青苹果绿):
痛点
1、Re-ID的基本假设是检测模型可以提供精确且高度对齐的边界框。由于应用场景很复杂,现在的检测模型经常采集处不对齐,不准确的bounding boxes,这使得ReID算法的表现下降。
2、由于基于局部的模型存在问题并且训练困难,因此现有方法的性能改进空间有限。其主要存在但不仅限于两个缺陷:1)其模型表现依赖于一个强大鲁棒的行人检测模型输出一个精准的bounding box(否则无法对齐),然而恰恰现实情况下我们很难获得精准对其的bounding box。2)在此类模型中,全局信息被完全忽略,而全局功能通常对于微妙的视图更改和内部变化具有鲁棒性,如下图1可以看出,被切分的局部对图像的匹配也同样重要。
如上图为图片在不同切片尺度上的匹配。两个切片提供的大多数细节都不一样,靠左边的细条纹往往无法很好的匹配,而靠右边的从更global的视角得到的图像对,能够拥有更多的相似细节。
3、基于多loss/多任务的训练尽管有时候确实能够帮助提高ReID表现,但也仍存在一些困难:1)其表现高度依赖多个loss之间选择好一个合适的比重,而这个比重往往是人手动调节的。2)随着模型的逐步更新,不同任务的难度实际上会发生变化,从而导致针对不同迭代的适用权重会发生了变化。3)由于一些特殊考虑,采样策略在不同的loss下常常呈现多样性。
模型
pyramid model
假设输入为(c,h,w)的tensor,将输入切分为n份,每个切片为(c,h/n,w)。以n=6为实例,由如下图2的模型结构。
在Pyramid model中根据将tensor等分成6份图块的原则,逐步进行由粗粒度到细粒度的切片分branch,假设给这些图块从上到下标号1 2 3 4 5 6。
第一级(粗粒度)的branch是完整的一整个tensor,6块图块。
第二级则被分为两个branch,每个branch分别有5个图块,第一个branch有1 2 3 4 5,而第二个branch有2 3 4 5 6。
第三级被分为三个branch,以此类推。
最末级被分为6个branch,每个branch只有一个图块。第l级的第k子图有:
因此总共有1+2+…+n个branch。
其中单个branch的结构如下图3:
feature经过两个并行的global average pooling和global max pooling,堆叠后经过一个Conv+bn+relu,得到的feature一路经过FC layer + softmax求id loss。一路导出,和其他branch的output堆叠成一个feature,求triplet loss。
Multi-Loss Dynamic Training
作者认为有效的triplet loss是比较少的,这是由于id很多,但是每个id包含的样本比较少。为了解决这个问题,文章提出了ID平衡采样策略来保证三元组出现在batch中,但这种策略会抑制id loss,因为每一个batch中会有更少的id被用到,使用该策略使得直接weighting loss很难收敛,因而动态weighting的解决方案。
文章随机为每个batch选择8个id,每个id有8张图片,但是这种采样方式会导致另外一种偏见——id包含图片少于8的永远不会被选择到。
作者定义了一个表现度量来估计loss减少的可能性。假设 L τ t L^{t}_ {\tau} Lτt为当前第 τ \tau τ次迭代训练的平均loss,可以根据指数移动平均线计算:
其中α是折损系数,且 k − 1 t = L 0 t k^{t}_ {-1}=L^{t}_ {0} k−1t=L0t,则此时可以定义一个概率来描述loss减少可能性的可能性:
这时候 p τ t = 1 p^{t}_ {\tau}=1 pτt=1意味着当前训练并未衰减loss,该值越大,task t找到局部极小值的可能性越大,类似于Focal loss,它可以对较容易的样本进行权重处理,而将注意力集中在难样本上,文章定义了一种对损失进行加权的度量
γ为专注强度。则总体loss有:
当式(7)在优化中占主导地位时,因为ID平衡采样不会影响ID loss的使用,所以将直接优化id loss和triplet loss。这种优化成功地避免了曲折的参数调整,并无缝结合了ID平衡的triplet loss采样和课程学习的思想,从而进一步提高了性能,流图如下图4。
伪代码如下:
实验
market1501上的SOTA实验如下:
Duke的SOTA实验如下:
CUHK03的SOTA实验如下:
分离实验如下:
Pyramid-000001的0和1为pyramid model在当前level的不使用,和当前level的使用。feature-64表示这个branch的feature维数为64。
写作
本文的写作一言难尽,不建议学习
问题
Introduction倒数第三段最后一句:
“For example, hard sample sampling for triplet loss would suppress the role of another task of identification loss.”
“triplet hard loss 会抑制另一个任务的id loss”,吗?这是什么道理?作者没有讲明。或者这个结论是哪来的?作者也没有引用。
Introduction倒数第二段:
“To address above problems, in this paper, we specifically propose a novel coarse-to-fine pyramidal model based on the feature map extracted by a backbone network for person
re-identification. First, the pyramid is actually a set of 3-dimensional sub-maps with a specific coarse-to-fine architecture, in which each member captures the discriminative information of different spatial scales. Then, a convolutional layer is used to reduce the dimension of features for each separated branch in the pyramid. Third, for each branch, the identification loss of a softmax function is independently applied to a fully connected layer which considers the features as the input. Furthermore…”
Introduction说完存在的痛点之后,一般就要开始讲本文的work具有什么能力和优势,能够解决这些痛点,能够带来什么样的意义之类的,结果文章居然话锋一转,开始大段地介绍模型的结构…我不知道写文章的人是怎么想的,前面铺垫的东西为什么不接下去?模型结构为啥不等到第三个板块再结合图片一起讲,而是在这纯文字干讲?反正我自己读到这里,觉得特别突兀。
参考文献
[1] Zheng F, Deng C, Sun X, et al. Pyramidal Person Re-IDentification via Multi-Loss Dynamic Training[C]. computer vision and pattern recognition, 2019: 8514-8522.