zoukankan      html  css  js  c++  java
  • Transformer在视觉领域的应用

    Transformer在视觉领域的应用

    前言

    在机器翻译, NLP领域, 基于attention机制的transformer模型取得了很好的结果, 目前有许多工作把Transformer用到CV领域, 实现端到端的目标检测和图片分类。 在这篇博客中, 我们会从Attention机制开始回顾, 之后解释Transformer的结构, 最后讲解三篇把transformer应用到计算机视觉任务的模型。

    Attention机制

    Attention机制起源于自然语言处理中的seq2seq模型, 这个模型是一个RNN的结构, 输入一个句子, 输出机器翻译后的句子, 或者是这个句子的下一段话。

    image-20201214105209842

    对于这种模型而言, 很大的一个问题就是每一层传给下一层的向量长度是固定的, 很难用固定长度的向量表达前面的全部信息, 因此在句子很长的时候,模型效果不是很好。

    比如

    image-20201214105504305

    这个时候应该回答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机制会让我们选择性地关注一些区域, 这样有限的向量长度, 就可以关注到更多信息了。

    比如像下面这几张图展示的这样, 在不同时刻关注不同的图片区域, 来生成不同的语言符号。

    ![image-20201214105835680](/Users/edward/Library/Application Support/typora-user-images/image-20201214105835680.png)

    ![image-20201214105913850](/Users/edward/Library/Application Support/typora-user-images/image-20201214105913850.png)

    image-20201214105924342

    Transformer

    模型结构

    模型的整体结构

    2020120108510572s6

    transformer是一个自回归的模型, 关于模型细节的介绍 这篇博客http://jalammar.github.io/illustrated-transformer/ 写的很清楚了

    总体来看transformer通过q,k,v的方式来给特征加权, 达到长期记忆的效果。

    End to End Object Detection With Transformer

    第一篇用transformer做端到端目标检测的论文

    亮点

    1. 不用NMS 直接做set prediction
    2. 二分图匹配loss
    3. object queries很有意思, 本身是无意义的信息

    image-20201214110731799

    Deformable-DETR

    对detr的改进

    亮点有

    1. 加入deformable参数
    2. 多尺度特征融合

    image-20201214110829061

    16x16

    用transformer做图像分类

    亮点

    1. Image net上接近sota
    2. 用了图片分块的方式

    image-20201214110909012

    相关论文列表

    • 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)
  • 相关阅读:
    盒模型
    DTD
    JS 中的 __proto__ 、prototype、constructor
    ES 5 中 判断数组的方法
    js keyup、keypress和keydown事件
    webpack 安装 url-loader 模块后,图片地址展示错误问题
    前端展示PDF内容
    对象的深拷贝
    IE 11 中不知promise 的 finally 方法
    js判断一个字符串是否为纯数字组成
  • 原文地址:https://www.cnblogs.com/ziyuzhu-edward/p/14132194.html
Copyright © 2011-2022 走看看