Transformer在視覺領域的應用
前言
在機器翻譯, NLP領域, 基於attention機制的transformer模型取得了很好的結果, 目前有許多工作把Transformer用到CV領域, 實現端到端的目標檢測和圖片分類。 在這篇博客中, 我們會從Attention機制開始回顧, 之后解釋Transformer的結構, 最后講解三篇把transformer應用到計算機視覺任務的模型。
Attention機制
Attention機制起源於自然語言處理中的seq2seq模型, 這個模型是一個RNN的結構, 輸入一個句子, 輸出機器翻譯后的句子, 或者是這個句子的下一段話。
對於這種模型而言, 很大的一個問題就是每一層傳給下一層的向量長度是固定的, 很難用固定長度的向量表達前面的全部信息, 因此在句子很長的時候,模型效果不是很好。
比如
這個時候應該回答That's why I like apple, 但是因為中間插入了N個詞, 信息太多了, 模型忘記了前面的apple。
解決這個問題的辦法就是attention
Wiki上對attention的定義: Attention is the behavioral and cognitive process of selectively concentrating on a discrete aspect of information, while ignoring other perceivable information
簡單來說, attention機制會讓我們選擇性地關注一些區域, 這樣有限的向量長度, 就可以關注到更多信息了。
比如像下面這幾張圖展示的這樣, 在不同時刻關注不同的圖片區域, 來生成不同的語言符號。


Transformer
模型結構
模型的整體結構

transformer是一個自回歸的模型, 關於模型細節的介紹 這篇博客http://jalammar.github.io/illustrated-transformer/ 寫的很清楚了
總體來看transformer通過q,k,v的方式來給特征加權, 達到長期記憶的效果。
End to End Object Detection With Transformer
第一篇用transformer做端到端目標檢測的論文
亮點
- 不用NMS 直接做set prediction
- 二分圖匹配loss
- object queries很有意思, 本身是無意義的信息
Deformable-DETR
對detr的改進
亮點有
- 加入deformable參數
- 多尺度特征融合
16x16
用transformer做圖像分類
亮點
- Image net上接近sota
- 用了圖片分塊的方式
相關論文列表
- Attention is all you need(2017)
- Non-local Neural Networks(2018)
- End-to-End object Detection with Transformers(Detr 2020)
- Deformable Detr(2020)
- An Image is worth 16x16 words(2020)
- Rethinking transformer based set prediction for object detection(2020)
- End to end object detection with adaptive clustering transformer(2020)
- End to end lane shape prediction with transformers(2020)
- Pre-trained image processing transformers(IPT 2020)
- Sparse RCNN End-toEnd object detection with learnable proposals(2020)
- Unsupervised pre-training for object detection with transformers(Up-DETR 2020)
- HandTransformer(2020)