[水文]论文极简记录

分割

Pyramid vision transformer: A versatile backbone for dense prediction without convolutions

conditional positional encodings for vision transformers

[2021-CVPR]Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. CVPR, 2021.

[202105-NIPS]SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers

作者总结这个工作有两个很好的特性:SegFormer has two appealing features: 1) SegFormer comprises a novel hierarchically structured Transformer encoder which outputs multiscale features. It does not need positional encoding, thereby avoiding the interpolation of positional codes which leads to decreased performance when the testing resolution differs from training. 2) SegFormer avoids complex decoders. The proposed MLP decoder aggregates information from different layers, and thus combining both local attention and global attention to render powerful representations。

简要总结一下就是编码器用多级特征融合并且在位置编码上做了一个尺寸自适应的设计,另外解码器很轻。

Our best model, SegFormer-B5, achieves 84.0% mIoU on Cityscapes validation set and shows excellent zero-shot robustness on Cityscapes-C.
请添加图片描述
编码器

Hierarchical Feature Representation 如上图所示,多级的特征都会经过mlp融合起来

Overlapped Patch Merging:跟16*16那篇文章不一样,这个工作采用的patch类似于conv, 用kernel_size,stride,padding的形式构建In our experiments, we set K = 7, S = 4, P = 3 ,and K = 3, S = 2, P = 1 to perform overlapping patch merging to produces features with the same size as the non-overlapping process

Efficient Self-Attention:Q,K,V都是(N,C)维,N是H*W,因此在分割里面,特征图一般都很大,并且该工作用了多级的feature map,所以计算量会比较大。请添加图片描述
先做了个reduction
作者参考Pyramid vision transformer 对QKV进行了降维,但是没懂怎么恢复N的,因为还要和原来的特征图相加,可能是upsample?请添加图片描述
Mix-FFN 对position embedding的处理不太懂,估计得看下参考论文How much position information do convolutional neural networks encode请添加图片描述

[2021-CVPR] Rethinking BiSeNet For Real-time Semantic Segmentation

训练上是加了个detail loss, 有点类似于边缘检测任务中的问题。

backbone上是设计了一个独特的作者称之为short-term dense concatenate network,没有实际操作过,不太能理解精妙之处

On Cityscapes, we achieve 71.9% mIoU on the test set with a speed of 250.4 FPS on NVIDIA GTX 1080Ti, which is 45.2% faster than the latest methods, and achieve 76.8% mIoU with 97.0 FPS while inferring on higher resolution images
请添加图片描述
请添加图片描述

物体检测

[2021-综述-博客] https://bbs.cvmart.net/articles/4992
请添加图片描述
RetinaNet主要是用focal loss调整难易样本的权重, 有时间看一下anchor free的

focal loss

[2020-CVPR]Bridging the gap between anchor-based and anchor-free detection via adaptive training sample selection

[2020-CVPR]Revisiting the sibling head in object detector.

[2019-AAAI]Gradient Harmonized Single-stage Detector

[2021-arxiv]Efficient DETR: improving end-to-end object detector with dense prior

[202204-arxiv]Exploring Plain Vision Transformer Backbones for Object Detection

[2019-ICCV]FCOS: Fully Convolutional One-Stage Object Detection

1 anchor free直接去回归坐标,只要feature map的点逆映射回原图落在物体里面(还是跟物体有重叠)就认为需要去负责回归该物体,这样正样本就会有很多。

2 另外但是这里面有assign label的问题。如果feature map一个点需要负责regress两个物体,该怎么做?作者采用了mutlisscale的方式,在多个feature map上去回归,并且加入了一定的一致

3 如果一个feature map的点在一个物体边缘的位置,作者发现它的回归效果不太好,所以又加了一个分支去预测中心位置
请添加图片描述

[2021-CVPR]OTA: Optimal Transport Assignment for Object Detection

anchor的赋值问题做成了一个optimal transport 问题

[2021-CVPR]YOLOX: Exceeding YOLO Series in 2021

1 Decoupled head,将分类和regression head 分开

2 strong data augmentation ,mosaic, mixup等,但是300个epoch中的最后15个epoch需要关掉

3 在用强data augemntation的情况下,发现imagenet pretrain没有收益,直接train from scratch

4 anchor free, 直接预测左上角和height width(是不是可以认为这个点其实也是一个anchor)

5 Multi positives 3*3区域都认为是positive,参考 Fcos:Fully convolutional one-stage object detection.

6 SimOTA Advanced label assignment,这个不太懂,改进 [2021-CVPR]Ota: Optimal transport assignment for object detection

7 End-to-end YOLO这个也不太懂 参考Object detection made simpler by eliminating heuristic nms.,掉点了
请添加图片描述

[2020-ECCV] End-to-End Object Detection with Transformers

见vision transformer部分

[2019-CVPR]Generalized Intersection over Union: A Metric and A Loss for Bounding Box Regression

请添加图片描述

NLP系列

未理解

[202111-arxiv] NLP From Scratch Without Large-Scale Pretraining: A Simple and Efficient Framework
需要重看

[2020-ICLR]ALBERT: A LITE BERT FOR SELF-SUPERVISED LEARNING OF LANGUAGE REPRESENTATIONS

提出了两种方式来减少参数量:1)将vocab_size和hidden之间解耦,因为传统的方法是直接将vocab_size的词汇映射成hidden_size,如果词汇有30K, hidden_size为768,这个embedding的参数量就有23M 2) 层间参数共享

另外在next sentense prediction 这个任务上有改进。这个任务主要的问题是负样本太简单了

NSP is a binary classification loss for predicting whether two segments appear consecutively in the original text, as follows: positive examples are created by taking consecutive segments from the training corpus; negative examples are created by pairing segments from different documents; positive and negative examples are sampled with equal probability. We conjecture that the main reason behind NSP’s ineffectiveness is its lack of difficulty as a task, as compared to MLM. As formulated, NSP conflates topic prediction and coherence prediction in a single task2. However, topic prediction is easier to learn compared to coherence prediction, and also overlaps more with what is learned using the MLM loss

请添加图片描述

[201907-arxiv] RoBERTa: A Robustly Optimized BERT Pretraining Approach

主要是修改了BERT的训练的有些配置,可以达到更好的准确率请添加图片描述

量化

ZEROQ

[202006-arxiv] Improving Post Training Neural Quantization:Layer-wise Calibration and Integer Programming

1 将wx的误差作为量化的目标,w量化时会加个v,这个目前还不太懂。并且为了些许建模层间的关系,将顺序地一层一层地量化,因此后面的层会考虑到前面层量化引入的误差

2 用整数规划Integer Programming来做混合量化的搜索,但是感觉loss不太好设

3 重新调整batchnorm

生成模型

未看或未理解

[202203-arixv-没理解]Freeform Body Motion Generation from Speech
[202102-arxiv]Zero-Shot Text-to-Image Generation

稳定性训练论文

https://blog.csdn.net/PeaceInMind/article/details/107140355?spm=1001.2014.3001.5501

[2020-ACM Multimedia] A Lip Sync Expert Is All You Need for Speech to Lip GenerationIn The Wild

Our core architecture can be summed up as “Generating accurate lip-sync by learning from a well-trained lip-sync expert".

主要的是用语音和视频的匹配提前训练一个较好的discriminator, 跟sync-net的变化主要在几个方面,彩色图像输入,网络更深,loss变化

[2019-NIPS]First Order Motion Model for Image Animation
https://blog.csdn.net/PeaceInMind/article/details/122460307?spm=1001.2014.3001.5501

文字检测和识别

未看或未总结

[2021-CVPR]Primitive Representation Learning for Scene Text Recognition

[2021-CVPR]Implicit Feature Alignment: Learn to Convert Text Recognizer to Text Spotter

[2021-CVPR]Sequence-to-Sequence Contrastive Learning for Text Recognition

[2021-CVPR]Self-attention based Text Knowledge Mining for Text Detection

[2021-PAMI-检测识别]ABCNet v2: Adaptive Bezier-Curve Network for Real-time End-to-end Text Spotting

[2021-CVPR-识别-Oral]Dictionary-guided Scene Text Recognition

[2020-ACMMM]Textray: Contour-based geometric modeling for arbitrary-shaped scene text detection.

[2020-CVPR-识别]On Vocabulary Reliance in Scene Text Recognition

[2020-CVPR-识别]SCATTER: Selective Context Attentional Scene Text Recognizer

[2020-CVPR-识别]Towards Accurate Scene Text Recognition With Semantic Reasoning Networks

[2020-CVPR-识别]SEED: Semantics Enhanced Encoder-Decoder Framework for Scene Text Recognition

[2020-CVPR-检测]Deep Relational Reasoning Graph Network for Arbitrary Shape Text Detection

[2020-CVPR-检测]ContourNet: Taking a Further Step Toward Accurate Arbitrary-Shaped Scene Text Detection

[2020-ECCV]Sequential Deformation for Accurate Scene Text Detection

[2020-ECCV]Adaptive Text Recognition through Visual Matching

[2020-ECCV]RobustScanner: Dynamically Enhancing Positional Clues for Robust Text Recognition

[2020-ECCV]AutoSTR: Efficient Backbone Search for Scene Text Recognition

[2020-ECCV]AE TextSpotter: Learning Visual and Linguistic Representation for Ambiguous Text Spotting

[2020-ECCV]Character Region Attention For Text Spotting

[2019-ICCV]Geometry Normalization Networks for Accurate Scene Text Detection

[2019-ICCV]Symmetry constrained rectification network for scene text recognition.

[2019-ICCV-检测识别]TextDragon: An end-to-end framework for arbitrary shaped text spotting

[2019-ICCV-检测识别]Convolutional Character Networks.

[2019-ICCV-检测识别]Towards unconstrained end-to-end textspotting

[2018-CVPR]An end-to-end textspotter with explicit alignment and attention.

[2018-CVPR]Fots: Fast oriented text spotting with a unified network.

[2018-CVPR]Geometry-Aware Scene Text Detection with Instance Transformation Network

[2018-CVPR]Rotation-Sensitive Regression for Oriented Scene Text Detection

[2018-ECCV]Textsnake: A flexible representation for detecting text of arbitrary shapes. In Proc. ECCV, 2018.

[2021-CVPR-oral-识别] Read Like Humans: Autonomous, Bidirectional and Iterative Language Modeling for Scene Text Recognition code

作者从人的行为提出了几个假设: 1 语言模型和视觉模型是自洽的,可以独立work. 当然两者好的交互可以让文字识别做的更好。 2 文字的reasoning和完形填空差不多,context是双向的 3 迭代的, 在一些难的场景中,人是迭代去矫正识别结果的。
请添加图片描述
作者提出了上图中的架构,图片首先会经过一个vision model, 这个vision model是经过改造的,resnet+transformer,resnet也是一个经过特别设计的架构, 通道数降了一个等级,stride=2也变少了,主要是考虑到图片尺寸比较小

        self.layer1 = self._make_layer(block, 32, layers[0], stride=2)
        self.layer2 = self._make_layer(block, 64, layers[1], stride=1)
        self.layer3 = self._make_layer(block, 128, layers[2], stride=2)
        self.layer4 = self._make_layer(block, 256, layers[3], stride=1)
        self.layer5 = self._make_layer(block, 512, layers[4], stride=1)
        
        ResNet(BasicBlock, [3, 4, 6, 6, 3])

为了匹配第一个假设,作者在图像特征到语言模型的地方加了个blocking gradient, pytorch里面应该就是detach的操作,让language model专注在矫正上面,这个可以提供0.9%的提升。个人想法是能不能再最后的几个epoch打开再finetune几个epoch

第二个作者为了双向的context,作者是在attend的时候做了处理。具体的细节还不太清楚。请添加图片描述
3 Iterative Correction

这个关键是要迭代几次,3次可以提升0.3% 0.4%

4 视觉模型的预训练和语言模型的预训练对最终的准确率都有不小的帮助

[2020-CVPR-识别] SEED: Semantics Enhanced Encoder-Decoder Framework for Scene Text Recognition

粗略扫了一眼,感觉也没啥让人眼前一亮的东西。 主要是加了一个全局的特征,这个思路在很多场景应用了请添加图片描述
The first is initializing the state of the decoder with the word embedding from the pre-trained FastText model rather than the predicted semantic information. Another is to use the predicted semantic information directly. We evaluate these two strategies, and their performances are similar. We use the second training strategy which trains the model in a pure end-to-end way. 第二个不是很懂

另外optimizer用的是ADADELA,任何算法都有它的场景和局限性。

[2018-PAMI] ASTER: An Attentional Scene Text Recognizer with Flexible Rectification
TPS

个人感觉创新的点是引入了TPS来矫正图像,这里参考各种资料简要介绍,有些细节还不太明白
请添加图片描述

相比于仿射变化和射影变换等,TPS可以建模非刚性的变化。常用的仿射变化有平行线依然平行的限制,而TPS没有。TPS解的是如下优化问题,对于原图和目标图的一组想对应的点(称之为控制点),( p 1 ′ , p 2 ′ , . . . , p k ′ p_1',p_2',...,p_k' p1p2,...,pk) 和 ( p 1 , p 2 , . . . , p k p_1,p_2,...,p_k p1p2,...,pk), 用f代表映射函数f, TPS的优化目标由两个目标组合而成,

第一个称之为fitting项
E f = ∑ i = 1 k ∣ ∣ f ( p ) − p ′ ∣ ∣ 2 E_f = \sum_{i=1}^{k}||f(p)-p'||^2 Ef=i=1kf(p)p2
第二个是distortion term
E d = ∬ ( ( ∂ 2 f ∂ x 2 ) 2 + 2 ( ∂ 2 f ∂ x y ) + ( ∂ 2 f ∂ x 2 ) ) d x d y E_d = \iint((\frac{\partial^2f}{\partial x^2})^2+2(\frac{\partial^2f}{\partial xy})+(\frac{\partial^2f}{\partial x^2}))dxdy Ed=((x22f)2+2(xy2f)+(x22f))dxdy
这个惩罚项如果是仿射变换那就是0

整体的优化目标是
E = E F + λ E d E=E_F + \lambda E_d E=EF+λEd

之前的工作已经证明了这个优化目标有解析解,即
f ( p ) = A p + ∑ i = 1 k ϕ ( ∣ ∣ p − p i ′ ∣ ∣ ) c i f(p)=Ap+\sum_{i=1}^k\phi(||p-p_i'||)c_i fp=Ap+i=1kϕ(ppi)ci

关于TPS 这个是个不错的介绍
https://zhuanlan.zhihu.com/p/227857813

http://profs.etsmtl.ca/hlombaert/thinplates/

https://www.cse.wustl.edu/~taoju/cse554/lectures/lect07_Deformation2.pdf

[2021-CVPR-检测矩形]MOST: A Multi-Oriented Scene Text Detector with Localization Refinement

不是特别理解请添加图片描述
请添加图片描述

[2021-CVPR-检测任意]Fourier Contour Embedding for Arbitrary-Shaped Text Detection

确实加深了自己对傅里叶变换的理解,这个博客上有gif形象地展示了轮廓拟合的过程https://zhuanlan.zhihu.com/p/375231118,对个人的冲击还是挺大的。 一个圆在复数域可以用c*(cos(kt)+isin(kt)). 几个圆叠加这是这几个个复数叠加。请添加图片描述
backbone为什么选用deformable conv,这个地方应该做个对比实验,不然不太公平。

这种任意形状的NMS是不是会比较慢?请添加图片描述

[2020-CVPR-检测识别]Abcnet: Real-time scene text spotting with adaptive bezier-curve network

引入了一种全新的形式来表示任意形状的文本曲线 bezier-curve。 bezier-curve 由几个(degree)控制点, 具体可见wiki https://en.wikipedia.org/wiki/B%C3%A9zier_curve, 看其中的gif还是非常妙的,
请添加图片描述
所以检测的时候由之前回归box转换成了回归这些contol point.

每个曲线上的点可以理解成是这些控制点的线性变换请添加图片描述
Bezier Ground Truth Generation请添加图片描述
每个标注点的Bezier系数是通过周长的比例去对齐的。请添加图片描述
Bezier Curve Synthetic Dataset

用合成数据生成了大量数据,这个多边形的文本应该怎么映射,一个字母去贴?

BezierAlign
请添加图片描述
Recognition branch.

识别部分是LSTM + CTC loss

[2020-ECCV-检测和识别]Mask TextSpotter v3: Segmentation Proposal Network for Robust Scene Text Spotting

核心的还是用分割的方式产生一个proposal的mask, 把maskrcnn的模式的模式roi feature乘了这个mask

mask的label是shrink过的,论文里用的是Vatti clipping algorithm,不是很懂。

[2019-CVPR-检测-矩形] Look more than once: An accurate detector for text of arbitrary shapes

请添加图片描述
核心观点是在直接回归的基础上再加一次(训练时)或多次(推理) refinement.

直接的回归的loss:

Dice loss:为了解决数据类别不平衡问题,有weighted loss, ohem, 还有focal loss(印象中好像不支持单类), 分割里面还有dice loss. 请添加图片描述
在二分类的情况下,
D = 2 T P T P + F P + T P + F N D=\frac{2TP}{TP+FP+TP+FN} D=TP+FP+TP+FN2TP
而F1-score
p r e c i s i o n = T P T P + F P , r e c a l l = T P T P + F N F 1 = 2 ∗ p r e c i s o n ∗ r e c a l l p r e c i s i o n + r e c a l l = D precision = \frac{TP}{TP+FP}, recall=\frac{TP}{TP+FN}\\ F1 = \frac{2*precison*recall}{precision+recall}=D precision=TP+FPTP,recall=TP+FNTPF1=precision+recall2precisonrecall=D

可以看到优化D其实就是在优化F1 score.

如果正样本太少,负样本太多,导致网络有很多的FN,那recall很低,loss就会很高。

本工作结合了weighted loss和dice loss,文本正样本的权重为64/短边。感觉这个也是一个非常trick的选择

Iterative Refinement Module:请添加图片描述
ROI transformer layer 来自Textnet: Irregular text reading from images with an end-toend

trainable network,具体没看,粗看是个射影变换的东西。

为了得到更精准的边缘信息,用一个1*1卷积和sigmoid得到4个corner attention map.

最后回归的是四个corner坐标的 检测值跟真实值之间的offset.

Shape Expression Module请添加图片描述
这个ground truth的生成用的啥,垂线是怎么取得,可能得看下其他论文,印象中PSE好像有.

[2019-ICCV] Geometry normalization networks for accurate scene text detection

出发点个人理解的不是很清楚。 作者观察到更多的这种样本scale orientation的样本变化对于测试样本在一定scale orientation也会有作用。 这个另外一个原因是不是学术界的数据集很小。

基于此,作者想在训练的时候,特别是特征层把这些变化搞进去。

个人疑问就是在特征层搞类似于数据增强的东西跟在数据集搞数据增强两者的关系到低是啥。因为要变化的特征层接近输出端,所以输入端神经网络的压力是减少的,输出端要建模的东西是类似的,不是特别明白带来准确率的原因是啥

作者提出了两个module,非常好理解。一个是处理尺寸的

Scale Normalization Unit where S is one 1 1 conv operator, and S1/2 is a stack of 1 1 conv, 2 2 max-pooling with stride 2, and 3 3 conv operators

Orientation Normalization Unit
请添加图片描述
r代表旋转90度,f代表上下flip

多模态预训练

未看
[201112-arxiv]Florence: A New Foundation Model for Computer Vision

[2021-CVPR-oral-视频文本]Less is More: CLIPBERT for Video-and-Language Learning via Sparse Sampling[]

由于视频计算量很大,传统的抽样方法无法做到e2e的训练,具体地为请添加图片描述
本工作提出了利用稀疏采样去处理请添加图片描述
得重新看,这种记录看不太明白

[202102-arxiv-重要-图像文本]Learning Transferable Visual Models From Natural Language Supervision

请添加图片描述
请添加图片描述
首先收集了400M image-text pair的数据,代码开源了但数据未开源

训练的时候是利用image跟text配对的形式而不是走caption的形式,主要是数据量太大,文本变化非常多,训练比较困难

为了解决数据量大造成的训练难的问题,作者用了若干现有的海平面呼吸平。

Mixed-precision (Micikevicius et al., 2017) was used to accelerate training and save memory. To save additional memory, gradient checkpointing (Griewank & Walther, 2000; Chen et al., 2016), half-precision Adam statistics (Dhariwal et al., 2020), and half-precision stochastically rounded text encoder weights were used.

并且为了效果在训练和推理都做了若干个人认为比较trick的行为。训练时修改了resnet50网络模型

make several modifications to the original version using the ResNet-D improvements from He et al. (2019) and the antialiased rect-2 blur pooling from Zhang (2019). We also replace the global average pooling layer with an attention pooling mechanism. The attention pooling is implemented as a single layer of “transformer-style” multi-head QKV attention where the query is conditioned on the global average-pooled representation of the image

在imagenet上做推理的时候更是用了80种ensemble PROMPT ENGINEERING AND ENSEMBLING
请添加图片描述

基础

未看

Unified contrastive learning in image-text-label space

[2021-CVPR]Dynamic head: Unifying object detection heads with attentions

[2020-ICLR]Why gradient clipping accelerates training: A theoretical justification for adaptivity

[202102]-High-Performance Large-Scale Image Recognition Without Normalization]

[2021-ICLR]Characterizing signal propagation to close the performance gap in unnormalized

resnets

[2020-NIPS]Batch normalization biases residual blocks towards the identity function

in deep networks

[202103-arxiv-CLIP]Learning Transferable Visual Models From Natural Language Supervision

An empirical study of training end-to-end vision-and-language transformers.

[2021-ICML] ConViT: Improving vision transformers with soft convolutional inductive biases

[202204-arxiv] DeiT III: Revenge of the ViT

主要是引入了一些最新的训练技巧,正则和损失的修改:Stochastic depth,LayerScale,Binary Cross entropy.

数据增强用:Grayscale,Solarization,Gaussian Blur:
请添加图片描述
请添加图片描述
裁减用最简单的Simple Random Crop (SRC)。

预训练的尺寸是126请添加图片描述

[2021-ICCV]Going deeper with image transformers. International Conference on Computer Vision

请添加图片描述

[202204-arxiv] The Effects of Regularization and Data Augmentation are Class Dependent

主要是说有些类别的准确率更低了

[202106] BEiT: BERT pre-training of image transformers.

将image切成patch,然后利用现有的工作(Zero-shot text-to-image generation)将其tokenize, 然后类似bert masked部分进行重建训练,masked 不是随机的(没看懂)请添加图片描述
这里面并没有解释为什么不能直接重建,引入tokenize的本质好处是啥。

[2021-ICCV] Going deeper with Image Transformers

还不是很明白

一个是初始化,感觉类似于cnn里面把block的最后bn的gamma值做了调整

请添加图片描述
第二个是改了网络 ,这部分的具体不理解。另外两个部分的出发点不理解
请添加图片描述

[2021-arxiv] ResNet strikes back: An improved training procedure in timm

请添加图片描述
1 变成1对多loss For this purpose, we adopt the binary cross-entropy (BCE) loss instead of the typical cross-entropy(CE). This loss is consistent with the Mixup and CutMix data augmentation: The targets are defined for each class to 1 (or 1-epsilon" with smoothing) if the class is selected by Mixup or Cutmix, independent of other classes
请添加图片描述
4 optimizer lamb

[2022-arxiv] Model soups: averaging weights of multiple fine-tuned models improves accuracy without increasing inference time

多个网络直接权值平均,这么简单的想法应该有很多人在之前的一些场景试验下,所以可能有它独特的应用场景,不一定具备通用性。
请添加图片描述

[2020-ICLR] HOW MUCH POSITION INFORMATION DO CONVOLUTIONAL NEURAL NETWORKS ENCODE?

这篇工作主要是想确认下CNN中在做一些任务的时候是否学到了绝对位置,因为位置对一些任务也很重要。如下图,作者在显著性检测下对图片进行了裁减,结果有了不小的改变。如果完全从数学上来看,如果图片够大,超过网络的感受野,那应该是不变的,也就是卷积的平移不变性。但是由于网络由多重卷积堆叠而成,zero padding会影响它的行为
请添加图片描述
接下来,作者构建了一些任务,也就是通过固定在imagenet上训练好的vgg和resnet网络,再加个可训练的head来预测与输入无关的位置信息。请添加图片描述
从结果上看训练的效果挺好的。
请添加图片描述
作者又找了两个对位置信息比较敏感的任务语义分割和显著性检测(语义分割为啥对位置信息这么敏感),确认了zero padding在其中扮演了重要的作用(一个疑问是如果网络中不用zero padding是用啥来保证尺寸一样来跟原始的网络保证其他的一致性).

[202111-arxiv]Masked Autoencoders Are Scalable Vision Learners

请添加图片描述

[202111-arxiv] Are Transformers More Robust Than CNNs?

对抗攻击鲁棒性: 1 Robustness to Perturbation-Based Attacks 只要把resnet的relu换成gelu,因为有先前的工作由于relu的非光滑性会影响其对抗攻击的效果。2 Robustness to Patch-Based Attacks resnet加强数据增强
请添加图片描述
Robustness on Out-of-distribution Samples

在这个测试中,transformer就算不用大量数据预训练也会比resnet要好
请添加图片描述

[2021-NIPS] Dynamic Resolution Network

请添加图片描述
不同的图片有个不同的尺寸

训练的loss为普通的分类loss额外加一个flops的惩罚
请添加图片描述

请添加图片描述
另外BN换了对应不同分辨率独立的BN

[202110-arxiv] NON-DEEP NETWORKS

证明了浅层也可以在imagenet上得到很好的结果
we show, for the first time, that a network with a depth of just 12 can achieve top-1 accuracy over 80% on ImageNet, 96% on CIFAR10,and 81% on CIFAR100
请添加图片描述
SSE架构是在SE修改而来,不是在最后的3*3后面加,而是有一个skip操作。

[2020-ECCV] Dynamic ReLU

核心的思路是利用一个类似于SE的架构去控制输出,跟SE不同的是,对于特定的通道,SE的缩放是线性的,而DYRelu是非线性的。
请添加图片描述

[202108-arxiv]Mobile-Former: Bridging MobileNet and Transformer

采用了双路结构,mobilenet和transformer互相融合信息。 注意的点是mobilenet用了作者ECCV20的工作dynamic relu. 另外transformer里面的token是可学习的,并未为了减少flops数,token数量很少,论文中小于等于6
请添加图片描述
请添加图片描述

[202105-arxiv] Rethinking “Batch” in BatchNorm

本文从四个方面去分析bn的问题,主要是统计的精度,训练推理的不一致性,不同域的问题,信息泄露。

1) 统计的精度,主要是bn中统计的平均值和方差。对于统计而言,样本数量越多统计越准确。但考虑到其计算量特别大,一般训练时原始bn的均值方差是通过如下方式进行EMA迭代更新
μ g = λ μ g + ( 1 − λ ) μ b \mu_g=\lambda\mu_g + (1-\lambda)\mu_b μg=λμg+(1λ)μb
该工作认为EMA的方式跟全局统计有一定的差距。

请添加图片描述
通过实验发现在训练初期EMA统计的均值方差跟全局统计的有一定滞后性。基于该论点,工作提出了自己的思路PreciseBN,它有两个特定:统计均值方差的时候固定住网络权重,所有样本权重一样。请添加图片描述
充分训练下提升不是很明显,但是这个问题还是有意义的。
2) 训练推理不一致 训练的时候是用batch的均值和方差,推理的时候是用EMA统计出来的均值和方差

作者做了一个特殊的实验,比如训练的时候batchsize还是1024,但是可能每几个样本之间统计均值方差。请添加图片描述
这个实验最有趣的应该是蓝线,该线说明了就算统计均值方差的batch比较小,如果推理的时候用一致的行为,准确率也是挺高的。所以是不是说之前小batch训练精度不高的原因并不是说大家认为的小batch统计不问题,而最主要的原因来自于训练推理行为的不一致,小batch的均值方差跟ema统计的均值方差不一致的问题。当然推理也用batch的数据不太能工程化,每个样本的结果不再独立,有随机性。
3) 多域问题
分成了两个问题,问题1:一个是在一个域训练,在另外一个域推理;问题2:多域训练,多域推理

问题1:这个是一个典型的域适配问题,该方向的工作很早就给出了一个解法,就是在推理时重新统计一下BN的。

问题2:训练和推理保持一致效果最好

4)信息泄露问题
这个在contrastive learning里面说的比较多,理解不是很透彻,感觉主要是bn统计时样本不独立造成的。在moco, simclr一般用shuffle bn或者大batch size来解

[2019-ICLR]Towards understanding regularization in batch normalization

作者理论分析了一层感知器下bn的作用
一层感知器的定义如下
请添加图片描述
loss定义如下
请添加图片描述
作者推导出btachnorm的均值方差对bn gamma有约束作用请添加图片描述
作者从这个出发得到了三个推论
请添加图片描述请添加图片描述请添加图片描述请添加图片描述

[2021-ICLR]LAMBDANETWORKS: MODELING LONG-RANGE INTERACTIONS WITHOUT ATTENTION

感觉跟video里面换了计算顺序的差不多,没有特别理解

##https://github.com/lucidrains/lambda-networks/blob/main/lambda_networks/lambda_networks.py
import torch
from torch import nn, einsum
from einops import rearrange

# helpers functions

def exists(val):
    return val is not None

def default(val, d):
    return val if exists(val) else d

def calc_rel_pos(n):
    pos = torch.meshgrid(torch.arange(n), torch.arange(n))
    pos = rearrange(torch.stack(pos), 'n i j -> (i j) n')  # [n*n, 2] pos[n] = (i, j)
    rel_pos = pos[None, :] - pos[:, None]                  # [n*n, n*n, 2] rel_pos[n, m] = (rel_i, rel_j)
    rel_pos += n - 1                                       # shift value range from [-n+1, n-1] to [0, 2n-2]
    return rel_pos

# lambda layer

class LambdaLayer(nn.Module):
    def __init__(
        self,
        dim,
        *,
        dim_k,
        n = None,
        r = None,
        heads = 4,
        dim_out = None,
        dim_u = 1):
        super().__init__()
        dim_out = default(dim_out, dim)
        self.u = dim_u # intra-depth dimension
        self.heads = heads

        assert (dim_out % heads) == 0, 'values dimension must be divisible by number of heads for multi-head query'
        dim_v = dim_out // heads

        self.to_q = nn.Conv2d(dim, dim_k * heads, 1, bias = False)
        self.to_k = nn.Conv2d(dim, dim_k * dim_u, 1, bias = False)
        self.to_v = nn.Conv2d(dim, dim_v * dim_u, 1, bias = False)

        self.norm_q = nn.BatchNorm2d(dim_k * heads)
        self.norm_v = nn.BatchNorm2d(dim_v * dim_u)

        self.local_contexts = exists(r)
        if exists(r):
            assert (r % 2) == 1, 'Receptive kernel size should be odd'
            self.pos_conv = nn.Conv3d(dim_u, dim_k, (1, r, r), padding = (0, r // 2, r // 2))
        else:
            assert exists(n), 'You must specify the window size (n=h=w)'
            rel_lengths = 2 * n - 1
            self.rel_pos_emb = nn.Parameter(torch.randn(rel_lengths, rel_lengths, dim_k, dim_u))
            self.rel_pos = calc_rel_pos(n)

    def forward(self, x):
        b, c, hh, ww, u, h = *x.shape, self.u, self.heads

        q = self.to_q(x)
        k = self.to_k(x)
        v = self.to_v(x)

        q = self.norm_q(q)
        v = self.norm_v(v)

        q = rearrange(q, 'b (h k) hh ww -> b h k (hh ww)', h = h)
        k = rearrange(k, 'b (u k) hh ww -> b u k (hh ww)', u = u)
        v = rearrange(v, 'b (u v) hh ww -> b u v (hh ww)', u = u)

        k = k.softmax(dim=-1)

        λc = einsum('b u k m, b u v m -> b k v', k, v)
        Yc = einsum('b h k n, b k v -> b h v n', q, λc)

        if self.local_contexts:
            v = rearrange(v, 'b u v (hh ww) -> b u v hh ww', hh = hh, ww = ww)
            λp = self.pos_conv(v)
            Yp = einsum('b h k n, b k v n -> b h v n', q, λp.flatten(3))
        else:
            n, m = self.rel_pos.unbind(dim = -1)
            rel_pos_emb = self.rel_pos_emb[n, m]
            λp = einsum('n m k u, b u v m -> b n k v', rel_pos_emb, v)
            Yp = einsum('b h k n, b n k v -> b h v n', q, λp)

        Y = Yc + Yp
        out = rearrange(Y, 'b h v (hh ww) -> b (h v) hh ww', hh = hh, ww = ww)
        return out

einsum https://stackoverflow.com/questions/26089893/understanding-numpys-einsum
其他对该工作的评价,供参考
作者:LinT
链接:https://www.zhihu.com/question/429602614/answer/1674095602
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处

AutoML/NAS/压缩

[2020-NIPS] ZERO-COST PROXIES FOR LIGHTWEIGHT NAS

用gradient norm来评估网络的好坏,不太懂背后的逻辑

[2020-NIPS]Pruning neural networks without any data by iteratively conserving synaptic flow

weight压缩的方式,可能不太适合一些硬件。但是它的思路挺有意思的,我们先从结论说起。

评估一个点的重要性它用Synaptic saliency来评估
请添加图片描述
在作者的实现中用了这个

请添加图片描述

不太好理解,这个在matmul里可能还好点,卷积更不好理解,实际操作中,这个是通过以下操作得到

以全1的输入forward的网络,loss为输出的和,backward,每个权重的分数为它的梯度乘以它的权重

The intuition for the equation is that it sums the value of every path from input pixel (i) to output class (j) where the value of a path is the product of the absolute value of the parameters on the path. Thus, a parameter with a higher synaptic flow score means that it is included in either more paths or paths with higher values or both. Thus, intuitively removing the parameters with the smallest scores will hopefully have the least impact on the neural networks initialization and the functions it can learn.

还是有些道理的。理论后面再看

人脸识别

[2019-CVPR] ArcFace: Additive Angular Margin Loss for Deep Face Recognition

很少看人脸的论文。对个人比较有用的是简要介绍了利用分类模型(softmax)和利用feature embedding方式(比如triplet loss)的优缺点:

如果是用softmax,第一个问题就是随着类别的增多,FC层会很大,第二个问题是比较适合closed set的任务,推理时的类别跟训练时的类别一致,但是如果推理时增加了一些新的identity,这种方式就不适用

Triplet loss的方式,第一个问题类似,因为是三个一组做loss, 因此也是随着类别的增多,配对的数量会大量增加(排列组合,应该是个 n 3 n^3 n3),比softmax更严重些;第二个问题是semi-hard sample mining is a quite difficult problem for effective model training,不太理解semi-hard,不过应该类似于难例挖掘

核心逻辑:将softmax转换成一个角度问题,然后在角度上增加一个常量迫使不同identity之间有一定距离,融合了softmax和embdding的想法

考虑最后一层的fc和softmax
请添加图片描述
请添加图片描述
m a x i m i z e    ∑ w x s u b j e c t   t o    ∣ ∣ w ∣ ∣ 2 = 1                    ∣ ∣ x i ∣ ∣ 2 = 1 maximize\ \ \sum wx \\ subject\ to\ \ ||w||_2=1 \\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||x_i||_2=1 maximize  wxsubject to  w2=1                  xi2=1

利用拉格朗日乘数法(Lagrange multiplier)并求导
∑ w x + λ ( ∣ ∣ w ∣ ∣ 2 − 1 ) \sum wx + \lambda (||w||_2-1) wx+λ(w21)
对w和 λ \lambda λ分别求导可得
∑ x + λ 2 w = 0 ∣ ∣ w ∣ ∣ 2 = 1 \sum x +\lambda2w=0 \\ ||w||_2=1 x+λ2w=0w2=1
求得
w = ∑ x ∣ ∣ ∑ x ∣ ∣ 2 w=\frac{\sum x}{||\sum x||_2} w=x2x

视频理解

未看或未总结

Nuta: Non-uniform temporal aggregation for action recognition

[2020-ECCV]Directional temporal modeling for action recognition

[2021-ICCV]VidTr- Video Transformer Without Convolutions

[2021-arxiv]EAN- Event Adaptive Network for Enhanced Action Recognition

MoViNets: Mobile Video Networks for Efficient Video Recognition

Towards Long-Form Video Understanding

Video Contrastive Learning with Global Context

Tuber:Tube-transformer for action detection

Augmented transformer with adaptive graph for temporal action proposal generation.

[2019-ICCV]SCSampler: Sampling salient clips from video for efficient action recognition

[2019-ICCV]Multi-Agent Reinforcement Learning Based Frame Sampling for Effective Untrimmed Video Recognition.

[2018-CVPR] Optical flow guided feature: A fast and robust motion representation for video action recognition

[2018-CVPR]End-to-end learning of motion representation for video understanding.

[2019-CVPR]Representation flow for action recognition

[2021-NIPS]Temporal-attentive Covariance Pooling Networksfor Video Recognition

[2021-CVPR-oral]PGT: A Progressive Method for Training Models on Long Videos

请添加图片描述
初步的理解是将长视频分组,组与组之间gradient detach, feature以一定形式forward

[2021-CVPR]ACTION-Net: Multipath Excitation for Action Recognition

网络设计
请添加图片描述
请添加图片描述

[2021-CVPR]2D or not 2D? Adaptive 3D Convolution Selection for Efficient Video Recognition

主要是个动态3d模块的思路,根据donwsample的图片输入,利用rl决定该图片是否用作输入,并且网络的每个stage是否用3d.没做实验,初步估计比较难训练.另外在trt等落地场景中,像这种动态图一般支持的都不好,感觉不太实用。

[2021-CVPR-oral] FrameExit: Conditional Early Exiting for Efficient Video Recognition

个人觉得从理论上看不太实用,从图片中去选帧一直是视频分类的一个方向,但是在以GPU为主导的硬件平台上,这种方式一般很难并行导致理论上FLOPS较低, 但速度上不来。
请添加图片描述
论文主要核心的思路是Early exit,这个思路在很多的算法中其实早已存在。图片帧一帧一帧地处理,然后用个分类器去判断分类的置信度是否已经足够,如果足够,就不用新添加新图片,否则继续添加。

在送给分类器的图片顺序上,作者用人工经验做了一个trick,即首先送入中间帧图像,然后送第一帧和最后一帧,接下来的帧按照下面的方式去抽
请添加图片描述
这里还有一个个人感觉有实用风险的就是对于每一张图像都有一个分类器,如果最后需要用到的图片比较多,分类器也会较多,而且会存在后面的分类器训练不充分的问题。

在训练gating的时候,如果不做任何处理,只用交叉熵loss去训,那最后训出来的网络肯定是基本没有exit的效果的,因为信息越多,越有利于最后的分类。所以作者在训练gating的时候做了调整
请添加图片描述
gating的gt跟loss有关,这个也是个人觉得有风险的地方,感觉这个值还是比较难调的
请添加图片描述

[202103-arxiv]Video Classification with FineCoarse Networks

请添加图片描述
coarse路径上用下采样的图片,

fine路径用的是一些边缘运动特征,具体获取方式如下,没有仔细看
请添加图片描述

[2021-ICLR]CT-NET: CHANNEL TENSORIZATION NETWORK FOR VIDEO CLASSIFICATION

核心的思路是将c通道分组,第一个卷积先利用卷积处理组内的,接着进行reshuffle,比如把各个组第一个的通道合并成新的一个组,第二个通道合并成令外的一个组,

个人觉得这个思路还是很像shufflenet,开源的代码也是用着k=2的情况。可能还有一些没理解到位的情况

[2018-CVPR]What Makes a Video a Video:Analyzing Temporal Information in Video Understanding Models and Datasets

摘自知乎@王云峰

这篇论文的出发点是分析在某个网络结构(例如C3D)上训练好的模型在对测试视频进行分类的时候,是否真正地用到了运动信息(motion),或者说运动信息真正起到了作用。一个简单的验证实验是在在测试视频中选一帧,然后重复N次构成一个clip(如在C3D中,N=16)。作者实验发现这种情况性能下降了25%。但这25%的性能下降不光是motion丢失带来的,作者认为这里还引入了另外两个问题:(1)改变了视频帧的时间上分布(temporal distribution),因为训练时使用的是16帧的clip,而测试采用采样过的帧构成的clip,训练和测试数据的分布不一致。(2)可能将视频中最重要的帧,对视频分类最有用的帧给丢掉了。

为了解决上面提到的两个问题,这篇论文提出了两个针对性的框架:首先是在低帧率(例如相比C3D中采用的16帧的clip,这里采用1帧的clip)的情况下,基于cycleGAN的类别无关(class-agnostic)的时域生成器(temporal generator, 英文不好,暂时这样翻译了,如果有更准确的翻译请告知)来生成帧,构成视频输入到训练好的网络中。为了使得训练收敛,作者采用了perceptual loss。第二个框架是运动不变(motion-invariant)的关键帧选择器,通过选择一个关键帧进行视频分类的任务。

[2019-NIPS]LiteEval:A Coarse-to-Fine Framework for Resource Efficient Video Recognition

请添加图片描述
思路比较符合人类的想法,主要的问题就是变成LSTM后本来是并行的问题成了串行的问题,GPU运算应该不太友好。

如上图,主要的架构分成两块,底下那块是coarse分支,用轻量级网络承担所有选取帧的计算。上面的分支是fine分支,只有在中间的gating模块认为有必要的时候才会为当前帧走到fine环节,fine环节会用相对计算量更高的网络提取更丰富的特征。

里面存在的一个问题就是gating输出离散导致不可导的问题,论文用的也是Gumbel Softmax

最后的训练目标是包含分类,还有gating打开的期望比例。
请添加图片描述

[202105-arxiv] Adaptive Focus for Efficient Video Recognition

请添加图片描述
先用一个轻量级的(全局)网络(MobileNetV2)过一遍大尺寸的图片(一个视频大概抽16帧),得到的feature会过一个RNN,通过强化学习的方式从每幅以便挑选出合适的区域(一幅图片分割成7*7份区域,从中挑出一份),最后过一个计算量高些的局部网络得到最后的结果。

[2021-ICLR] ADAFUSE: ADAPTIVE TEMPORAL FUSION NETWORK FOR EFFICIENT ACTION RECOGNITION

主要的思路是利用一个policynet判断预测每一个channel的三个状态,keep,reuse,skip.

keep就是保留,reuse就是用上一帧同个通道的信息,skip就是用0去覆盖请添加图片描述
另外由于变成这三类问题,网络会不可导,采用了Gumbel Softmax的技术,pytorch中有实现

另外loss里面除了正常的损失,还加了计算量的损失(问题,论文里这个损失权重为0.1,一般除了乱试外,我们怎么去调整这个weight)

问题:并行变成了串行,减少的flops可能并不能转换成真正的速度提升。

[2020-CVPR] TEA: Temporal Excitation and Aggregation for Action Recognition

低flops不代表在gpu上能更快请添加图片描述
请添加图片描述

[2021-AAAI] SMART Frame Selection for Action Recognition

Focus on the more standard short, trimmed action recognition problem
请添加图片描述
如上图表示,核心的逻辑就是通过两个分支得到每一帧的重要性,一个分支是图上左边所示只考虑当前帧,另外一个分支全局考虑所有帧的关系然后得到每一帧的重要性,最后两个分支的重要性进行相乘。

不管哪个分支,都先要对图像进行特征提取。跟传统的不一样,除了视觉特征(论文里用mobilenet)提取,还包含一个语言特征。它的提取过程是用一个mobilenet,在imagenet训练下,得到该帧top10的类别,这个类别名再次经过一个pre-trained GLoVe进行embedding,然后将这10个embedding进行平均。

左边分支比较好理解,不再赘述,右边分支有些小复杂。为了获取全局的关系,作者首先进行两两的抽样。比如视频中有N帧,那么为每一帧都随机抽取另外一帧(该随机帧一般是在当前帧后续帧进行抽取),组成一个pair。每个pair的特征concat后经过一个frame attention(frame attention

networks for facial expression recognition in videos)得到一个初始的frame的重要性,这个主要是为了得到一个全局的特征表达。

接着要经过下面的处理得到最终的frame重要性,这部分不是特别理解请添加图片描述
Learning to compare: Relation network

for few-shot learning.

所有的帧都抽出来,就算只过mobilenet,耗时应该也挺大的

如上图最上面部分,特征是两部分concat

[201911-arixv-需要重看]You Only Watch Once: A Unified CNN Architecture for Real-Time Spatiotemporal Action Localization

four major parts: 3D-CNN branch, 2D-CNN branch, CFAM and bounding box regression parts.
请添加图片描述
请添加图片描述

Transformer in Vision

https://jonathan-hui.medium.com/nlp-bert-transformer-7f0ac397f524

Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers

End-to-end object detection with transformers

Global self-attention networks for image recognition

https://github.com/dk-liang/Awesome-Visual-Transformer

position embedding

https://www.youtube.com/watch?v=dichIcUZfOw

Transformer简要介绍

请添加图片描述
transofermer可以简单成类似于resblock的模块,不同的地方是,它是一维的,并有它有attention的概念在里面在里面
整体架构
请添加图片描述
注意力架构

比如我们得到一个feature map K,h*w或者是1维
请添加图片描述
multihead变体:是一个group的概念请添加图片描述

未看或未总结

Towards robust vision transformer

[2021-NIPS] Intriguing properties of vision transformers

Fast autoregressive transformers with linear attention

[2021-Neurips]MLP-Mixer: An all-MLP Architecture for Vision

Multiscale Vision Transformers. In ICCV,2021.

ResMLP: Feedforward networks for image classification with data efficient training

[2022-CVPR-oral] MetaFormer is Actually What You Need for Vision

请添加图片描述

[202204-arxiv] Exploring Plain Vision Transformer Backbones for Object Detection

一个是在backbone上不再采用类似于FPN的架构请添加图片描述
另外在attention上也是在多数地方在windows内部做attention,只有在少数的几个层上采用global attention请添加图片描述

[2021-Neurips] CoAtNet: Marrying Convolution and Attention for All Data Sizes

从泛化性,模型容量和迁移性等考虑,选着了一个C-C-T-T的模型,即stage 1和2用convolution, stage3和stage4用transformer,这样在不同的数据规模下,这个模型的训练效果都挺好

[202107-arxiv] Focal Self-attention for Local-Global Interactions in Vision Transformers

出发点也是为了减少attention的计算量,应用的思路是从局部到全局,局部每个token是从比较细的特征区间获取,比如1*1这样的特征图,全局的每个token是从比较大的,比如8*8,相当于token的信息做了一定程度的压缩请添加图片描述
请添加图片描述

[2021-NIPS] Twins: Revisiting the Design of Spatial Attention in Vision Transformers

作者提出了两种架构,一种是结合Conditional Positional Encodings for Vision Transformers 和Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions,把第一个工作中的conv学习positional embeeding和gap结合第二项工作中spatial reducation attention结合起来,在实验中说明会比swin transformer强
另外第二种作者提出了自己的attention模块,主要的出发点就是要减少计算量,具体做法也很简单,主要还是切块,并把每块中的信息融合做成一个key.
请添加图片描述
请添加图片描述
说swin transformer感受野这个claim不是很理解。Although it can significantly reduce the complexity, it lacks the connections

between different windows and thus results in a limited receptive field

没有让人眼前一亮的感觉

[202103-arxiv]Conditional Positional Encodings for Vision Transformers

之前固定长度的positional encoding不能适应推理时的图片缩放要求,所以作者用了一个卷积去学习.请添加图片描述
另外作者将class token替换成了GAP,对这个出发点不是很理解请添加图片描述##### [202103-arxiv] Swin Transformer: Hierarchical Vision Transformer using Shifted Windows

解决原始划分网格太整齐,导致windows边缘会不太友好的问题。另外应该也加入了local attention而不是之前全局的attention来减少计算量请添加图片描述
请添加图片描述

[202102-ICCV]Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions

在transformer架构中如果要嵌入到feature map尺寸较大的网络层中,需要特别考虑到attention的计算量和显存,因为这里的复杂度跟feature map的点数平方相关的,可能这也是为什么之前的引领工作AN IMAGE IS WORTH 16X16 WORDS一开始就把feature map降了16倍的原因。本工作主要是引入了SRA(spatial reducation attention)来处理。原始做attention的时候需要QKV, 假设QKV的尺寸是(h*w)*c,那self attention的计算可以用下面公式描述

A t t e n t i o n ( q , k , v ) = S o f t m a x ( q k T d h e a d ) v Attention(q,k,v)=Softmax(\frac{qk^T}{\sqrt{d_{head}}})v Attention(q,k,v)=Softmax(dhead qkT)v
本工作中会将k和v做个reshape,h x w / (r x r) x c x r x r,再接一个fc层,将其转换成h x w/(r x r) x c。这样,计算量和显存都减少了

[2021-NIPS] Twins Revisiting the Design of Spatial Attention in Vision Transformers

这里指出了在做dense prediction时本工作的absolute positional encoding有问题

[2021-ICLR] AN IMAGE IS WORTH 16X16 WORDS TRANSFORMERS FOR IMAGE RECOGNITION AT SCALE

请添加图片描述

过程总结:

1 Embedding:将输入图片比如尺寸为224*224切分成多个16*16的小图,并利用二维卷积对每个小图进行特征提取,这样可以得到1*c*14*14的feature map, 经过转置变成1*196*c的feature

2 接下来就是经过多级transformer在c通道上进行特征处理

3 最后接一个分类

关键点:
position embedding

position embedding是跟feature embedding同样维度可训练的参数 或是预先定义好的变量(sin,cos)

还会加入一个一维的可学习的特征,称之为class token, 这个是从bert过来的, 即得到了1xCx(14x14+1)的。 接着长宽上的关系会被忽略变成一维的1xCx(196+1)
FINE-TUNING AND HIGHER RESOLUTION

由于position embedding的关系,有可能导致该行为在不同尺度上有影响,另外大尺寸有利于抽取更细粒度的信息,因此预训练完后还需要在大分辨率的数据上进行finetune

实验发现需要大量数据进行训练, 后面有论文进一步通过数据增强等,可以做到类似的准确率。
请添加图片描述

[202012-arxiv] Training data-efficient image transformers & distillation through attention

请添加图片描述
不同的地方:

网络架构上修改,单层的MLP变成两层外加GELU激活

class Mlp(nn.Module):
    def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.):
        super().__init__()
        out_features = out_features or in_features
        hidden_features = hidden_features or in_features
        self.fc1 = nn.Linear(in_features, hidden_features)
        self.act = act_layer()
        self.fc2 = nn.Linear(hidden_features, out_features)
        self.drop = nn.Dropout(drop)

    def forward(self, x):
        x = self.fc1(x)
        x = self.act(x)
        x = self.drop(x)
        x = self.fc2(x)
        x = self.drop(x)
        return x

训练技巧

初始化:全连接层初始化时进行截取trunc_normal_(m.weight, std=.02),用了很多数据增强:请添加图片描述

[202101-arxiv] Bottleneck Transformers for Visual Recognition

请添加图片描述
请添加图片描述
请添加图片描述

[2020-ECCV] End-to-End Object Detection with Transformers

Compared to most previous work on direct set prediction, the main features of DETR are the conjunction of the bipartite matching loss and transformers with (non-autoregressive) parallel decoding
请添加图片描述
训练时得引入set matching, 匹配是使用scipy.optimize.linear_sum_assignment实现的

优点:

在大部分cv任务上都能取得较好的结果,在物体检测领域能规避目前卷积网络所需要的NMS,anchor等操作

缺点:

单独使用,感受野太小,需要跟CNN结合使用

One of the main advantages of attention-based models is their global computations and perfect memory, which makes them more suitable than RNNs on long sequence请添加图片描述
请添加图片描述##### [2021-arxiv]Fast Convergence of DETR with Spatially Modulated Co-Attention请添加图片描述

[202012-arxiv] Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers

请添加图片描述
请添加图片描述
由于transformer的特性使得其很难在高分辨率上, 后面有些工作在解决这些问题

自监督表征学习

未看或未总结

Momentum contrast for unsupervised visual representation learning

Audio-Visual Instance Discrimination with Cross-Modal Agreement

Video Representation Learning by Dense Predictive Coding

Deep Image Prior

Self-supervised Co-Training for Video Representation Learning

Cycle-Contrast for Self-Supervised Video Representation Learning

Labelling unlabelled videos from scratch with multi-modal self-supervision

Data-Efficient Image Recognition with Contrastive Predictive Coding

Video Contrastive Learning with Global Context

[202011-arxiv]### FROST: Faster and more Robust One-shot Semi-supervised Training

[2016-ECCV]Unsupervised Learning of Visual Representations by Solving Jigsaw Puzzles

Rethinking pre-training and self-training

Data-Efficient Image Recognition with Contrastive Predictive Coding

Audio-Visual Instance Discrimination with Cross-Modal Agreement
CPCV2

提升靠改model,提升宽度和深度; layer normalizaiton;预测四个方向的patch; patch-based augmentation

S 4 S^4 S4L: Self-Supervised Semi-Supervised Learning

Exploring Simple Siamese Representation Learning

表征学习:学习一些通用的特征,主要的目的是使得这些特征可以用在多种不同的任务中

自监督表征学习:怎么设计一些pretext任务,当神经网络可以在无标签的情况下可以学习出一些有意义的特征

A main purpose of unsupervised learning is to pre-train representations (i.e., features) that can be transferred to downstream tasks by fine-tuning.

simclr和simclr2

https://lilianweng.github.io/lil-log/2019/11/10/self-supervised-learning.html

SEED: SELF-SUPERVISED DISTILLATION FOR VISUAL REPRESENTATION

Unsupervised learning of visual features by contrasting cluster assignments.

[2021-ICCV-oral] Improving Contrastive Learning by Visualizing Feature Transformation

主要是利用mixup的思路去提升postive和negative的难度。
请添加图片描述
请添加图片描述

[2020-NIPS]Rethinking Pre-training and Self-training

请添加图片描述
请添加图片描述

[202108-arxiv] Multi-Task Self-Training for Learning General Representations

这个主要采用伪标签的思路进行多任务学习,伪标签的生成是由一些现有监督模型生成的,所以要说是自学习多多少少过不去。

首先作者设计了一个对多个任务(分类,检测,分割,深度)都通用的网络,resnet+fpn。在相应的数据集上进行训练, 然后在某个数据集都生成四种任务伪标签。最后进行联合训练,联合训练时的损失分配是个难题,作者借鉴了训练分类时常用的线性规则和其他论文学习weight的思路。
请添加图片描述

[2021-ICLR]Parameter efficient multimodal transformers for video representation learning [code]

请添加图片描述
第一个是通过图右边表示的参数共享达到节省97%参数的目的,这样子可以降显存进而可以e2e的训练。具体共享的方式还得看下代码,不是特别理解,e2e按照openreview中得到的信心需要大量卡比如64卡,然后需要好几天

负样本挖掘:类似于难例挖掘
请添加图片描述

[2020-CVPR-oral]Moco: Momentum contrast for unsupervised visual representation learning

contrastive loss:相近的特征(同一个图片通过增强得到的sample)靠近,否则拉远

为了要记住很多的样本特征,引入了momentum encoder的概念。

这里边的shorcut learning是正样本对会在同一个GPU上,bn会通过scale和bias的学习使得他们靠近而不是在conv的视觉特征上,用shufflebn解决

最近的一些工作如Unsupervised feature learning via non-parametric instance discrimination. Representation

learning with contrastive predictive coding等都跟contrastive loss有关系。虽然他们的出发点不同,但是都可以理解成在建立某种动态字典。字典的键值是对样本采样,然后通过一个encoder网络得到。无监督就是训练一个encoder网络,让匹配到同一个key的样本的encoder表示相近,而匹配到不同key的样本表示不同。所以这里面的字典需要比较大(感觉应该是跟数据集有关系)另外由于encoder网络一直在训练,所以这个字典需要一直更新

The term “pretext” implies that the task being solved is not of genuine interest, but is solved only for the true purpose of learning a good data representation

用q表示一个query,{
请添加图片描述
shuffle BN

网上没有解释的特别清楚的,
请添加图片描述
key之间是希望不同的,通过bn,就天然

This trick eliminates the information leak between samples in the same batch. Because the task in MoCo (and many other contrastive loss works) is to discriminate 1 sample from a batch of samples. Ideally, when the model learns its feature, it should not ‘see’ other samples in the same batch (i.e. sample feature should be extracted independently), otherwise the model can learn some shortcut solution to fit the contrastive task. However, BatchNorm breaks this independence.

This problem was mentioned in CPC page 6 Sect 3.2; CPCv2 page 6, they use LayerNorm instead; DPC page 4, we find BN doesn’t affect performance much. But MoCo’s solution is clean and simple.
请添加图片描述

[2020-ICML] A Simple Framework for Contrastive Learning of Visual Representations

跟moco不同, 用large batchsize解决字典的问题。用global bn解决short cut learning 的问题
请添加图片描述
v2的效果
请添加图片描述

[2018-ICLR]Unsupervised Representation Learning by Predicting Image Rotations

识别旋转,将一个样本翻转[0,90,180,270]度,并把其分成四个类别,训练网络使其是区分这四个类别
请添加图片描述
Unsupervised visual representation learning by context prediction

classifying the input into pre-defined categories

Contrastive losses [27] measure the similarities of sample pairs in a representation space

[2016-ECCV]Colorful Image Colorization

学习上色,任务比较难,因为颜色可以有很多不同的选择

颜色空间的loss需要特殊设置

请添加图片描述

[2015-ICCV] Unsupervised Visual Representation Learning by Context Prediction

请添加图片描述
Pre-text task: 预测patch的相对位置

由于shortcut learning因素,patch需要做一些tirck,

1 位置上不是挨着的,以免特征去拟合特征的连续性等等

2 小patch会做一些blur,如先缩放再还原,增强鲁棒性

3 会随机使用一个颜色通道,这是由于色差导致的,不同的颜色通过透镜后,同一点上的颜色波长很难投影到同一点,如果不考虑这个问题,cnn会通过色差去判断位置

[2014-NIPS]Exemplar-CNN:Discriminative Unsupervised Feature Learning with Convolutional Neural Networks

pretext task: 区别每一个样本

细节:每个样本只有一个数据,因此需要做些数据增强。具体为在样本上裁减一个3232的区域,并希望这个区域富含纹理信息,因此在操作上每个区域没选中的概率跟梯度幅值的平方正相关。we sample a patch with probability proportional to mean squared gradient magnitude within the patch,可以用在视频抽样中
请添加图片描述
并对选中的32
32的区域做各种增强,包括:translation,scaling,rotation,contrast,color

同一个样本所有增强的数据都属于同一个label,网络的目的就是对所有的label做个分类.请添加图片描述

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值