【画像処理&機械学習】論文LT会!#2
Attention Augmented
Convolution Networks
(https://arxiv.org/abs/1904.09925)
2019/05/09
@fam_taro
Agenda
1. イントロ
2. 関連研究
3. Attention Augmented Convolution
4. 個人的な感想
1
1. イントロ
 Conv 層に self-attention を追加
 Attention Augmented Convolution(以下 AAC)
 SE Block 等が channel の重みだけを出力するのに対し、AACは
feature map 自体を出力
 Conv 層を丸々置き換えることもできる
 提案手法を使うことで ResNet 等の精度が上がる
 Detection でも上がることを確認した (RetinaNet on COCO)
 Squeeze-and-Excitation(SE) よりも精度上がる
 かつパラメータ数も SE より少ない
 SE-ResNet 系が置き換わるかも?
 メモリ消費量が大きい(出力を考えれば妥当)
 (height x width)^2 に比例
 画像サイズを2倍にすると16倍のメモリが必要になる?
 適用したブロックだけなので単純に16倍に増えるわけ
ではなさそうだが… 2
2. 関連研究
 Attention mechanisms in networks
 Attention の特徴
 長い距離での関連について capture できる
 NLP 界隈で流行し始める
 RNN を使った Machine Translation
 CV 界隈では
 かなり幅広く応用されてる
 例
 CV用のモデルに組み込んだもの
 CV用モデルとRNN系モデルをあわせたもの
 代表的な例
 Squeeze-and-Excitation(SE Block)
 Gather-Excite(GE Block)
3
2. 関連研究
4
チャンネルに対
する重み
 Squeeze-and-Excitation(SE Block, 2017)
 https://arxiv.org/abs/1709.01507
 チャンネルに重み付けをする方法
 幅広く使える(大抵の Block に組み込める)
 pretrained-model によくある SE~~~ は基本これが
はいっている
3. Attention Augmented Convolution
 先行研究(SE Block 等) と比較して
 事前に AA Block 抜きで pre-training する必要がない
 non-local neural networks などは事前に付与せずに ImageNet 等を学習する必要あり
 The use of multi-head attention allows the model to attend jointly to both spatial and feature
subspaces
 multi-head attention を利用
 → 空間と特徴の部分空間を一緒に扱えるようになった?(意味怪しいです…)
5
3. Attention Augmented Convolution
 理解に必要な事前知識(Attention とは)
 > Attention の基本は query と memory(key, value) です。
 > Attention とは query によって memory から必要な情報を選択的に引っ張ってくること
 下記サイトより引用
6
“作って理解する Transformer / Attention - Qiita” より引用
https://qiita.com/halhorn/items/c91497522be27bde17ce
・query
・key
・value
の3つの単語が出
現したことだけ
押さえましょう
3. Attention Augmented Convolution
 理解に必要な事前知識
 > Attention の基本は query と memory(key, value) です。
 > Attention とは query によって memory から必要な情報を選択的に引っ張ってくること
 下記サイトより引用
7
“作って理解する Transformer / Attention - Qiita” より引用
https://qiita.com/halhorn/items/c91497522be27bde17ce
LSTM 等を使った場合、
この memory は記憶セ
ル等を示す
今回は input をそのま
ま入力
3. Attention Augmented Convolution
 数式的内訳
 変数の定義
 H: height of input
 W: width of input
 F_in: channel of input
 N_h: number of head in multihead-attention (MHA)
 d_v: depth of values in MHA
 d_k: depth of queries and keys in MHA
8
3. Attention Augmented Convolution
 画像が入力された時の操作
 1. H, W について flatten
 2. flatten したベクトル X から各 attention の head について以下の出力を得る
9
3. Attention Augmented Convolution
 画像が入力された時の操作
 1. H, W について flatten
 2. flatten したベクトル X から各 attention の head について以下の出力を得る
10
Query 特徴量に変換 Key 特徴量に変換
Value 特徴量に変換
3. Attention Augmented Convolution
 画像が入力された時の操作
 3. それぞれの head の出力を concat
 4. contat した結果に対して重みをかけて MHA の出力とする
 MHA(X) は (H, W, d_v)
 メモリ消費量が (HW)^2 に比例していることに注意
11
3. Attention Augmented Convolution
 画像が入力された時の操作
 5. Convolution 層と concat
 細かい使用例はコードを参照ください
12
4. 個人的な所感
 むずかしい…
 SE Block は channel の重み付けがメインなのでシンプルでわかりやすかった
 TensorFlow 実装例が出ているのはありがたい
 PyTorch 等の実装がすでに上がっているので試せそう
 https://github.com/leaderj1001/Attention-Augmented-Conv2d
 SE-ResNet 系は丸々置き換わりそう?
 とはいえ GPU 消費量が大きいので使うのが厳しそう…
 誰かが pre-trained model を公開してくれれば…
 pre-trained model がないと現行モデルを差し替えるのが辛いような
 もしかしたら pre-trained model の一部の weight を使い回せばいけるかも?
13
おまけ
 Wide-ResNet に適用した場合の比較
 図の通り top-1 accuracy は AA 使ったほうが良い
 ただし top-5 については 大きい差はない
14
References
 Attention Augmented Convolutional Networks
 https://arxiv.org/abs/1904.09925
 Attention Augmented Convolutional Networks - 医療系AIエンジニアの技術メモ
 https://ai-engineer-memo.hatenablog.com/entry/2019/05/06/182901
 弊社先輩のメモ。本資料より詳しく書かれてます
 Squeeze-and-Excitation Networks - 医療系AIエンジニアの技術メモ
 https://ai-engineer-memo.hatenablog.com/entry/2019/02/04/005845
 [DL輪読会]Attention Is All You Need
 https://www.slideshare.net/DeepLearningJP2016/dlattention-is-all-you-need
 https://github.com/leaderj1001/Attention-Augmented-Conv2d
 PyTorch 実装(はやい)
 論文解説 Attention Is All You Need (Transformer) - ディープラーニングブログ
 http://deeplearning.hatenablog.com/entry/transformer)
 作って理解する Transformer / Attention - Qiita
 https://qiita.com/halhorn/items/c91497522be27bde17ce)
15

More Related Content

PDF
K-means hashing (CVPR'13) とハッシング周り
PDF
CV勉強会@関東 3巻3章4節 画像表現
PDF
FHE in Action
PDF
Hello, DirectCompute
PDF
CMSI計算科学技術特論B(11) 大規模MD並列化の技術2
PDF
More modern gpu
PPTX
Coursera machine learning week7: Support Vector Machines
PPTX
論文紹介 : Unifying count based exploration and intrinsic motivation
K-means hashing (CVPR'13) とハッシング周り
CV勉強会@関東 3巻3章4節 画像表現
FHE in Action
Hello, DirectCompute
CMSI計算科学技術特論B(11) 大規模MD並列化の技術2
More modern gpu
Coursera machine learning week7: Support Vector Machines
論文紹介 : Unifying count based exploration and intrinsic motivation

What's hot (20)

PDF
フーリエ変換と画像圧縮の仕組み
PDF
Deep Learning を実装する
PDF
CMSI計算科学技術特論B(10) 大規模MD並列化の技術1
PDF
[DL輪読会]“Submodular Field Grammars Representation” and “Deep Submodular Functi...
PPTX
[DL輪読会]Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
PDF
【Unity道場 2月】シェーダを書けるプログラマになろう
PPTX
Structured Light 技術俯瞰
PPTX
CG2013 01
PPT
diff template library
PPTX
論文解説:スマホカメラを用いたBRDFパラメータ取得技術(非DNN)「Two-Shot SVBRDF Capture for Stationary Mat...
PDF
Chainerチュートリアル -v1.5向け- ViEW2015
PDF
PythonによるDeep Learningの実装
PPTX
Deep Learning基本理論とTensorFlow
PPTX
CG2013 05
PDF
【Unite Tokyo 2018】誘導ミサイル完全マスター
PDF
音声認識と深層学習
PDF
CUDA1日(?)体験会
PDF
20110109第8回CV勉強会(ミーンシフトの原理と応用:6章・7章)shirasy)
PDF
Chainerの使い方と自然言語処理への応用
PPTX
Androidで画像処理リベンジ
フーリエ変換と画像圧縮の仕組み
Deep Learning を実装する
CMSI計算科学技術特論B(10) 大規模MD並列化の技術1
[DL輪読会]“Submodular Field Grammars Representation” and “Deep Submodular Functi...
[DL輪読会]Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
【Unity道場 2月】シェーダを書けるプログラマになろう
Structured Light 技術俯瞰
CG2013 01
diff template library
論文解説:スマホカメラを用いたBRDFパラメータ取得技術(非DNN)「Two-Shot SVBRDF Capture for Stationary Mat...
Chainerチュートリアル -v1.5向け- ViEW2015
PythonによるDeep Learningの実装
Deep Learning基本理論とTensorFlow
CG2013 05
【Unite Tokyo 2018】誘導ミサイル完全マスター
音声認識と深層学習
CUDA1日(?)体験会
20110109第8回CV勉強会(ミーンシフトの原理と応用:6章・7章)shirasy)
Chainerの使い方と自然言語処理への応用
Androidで画像処理リベンジ
Ad

Similar to 論文LT会用資料: Attention Augmented Convolution Networks (20)

PDF
最近のDeep Learning (NLP) 界隈におけるAttention事情
PDF
Attentionの基礎からTransformerの入門まで
PDF
MIRU_Preview_JSAI2019
PDF
【DeepLearning研修】Transformerの基礎と応用 -- 第1回 Transformerの基本
PDF
Convolutional Neural Networks のトレンド @WBAFLカジュアルトーク#2
PDF
20190804_icml_kyoto
PDF
[DL輪読会]Pervasive Attention: 2D Convolutional Neural Networks for Sequence-to-...
PPTX
Bert(transformer,attention)
PPTX
CVPR2018 参加報告(速報版)初日
PDF
[DL輪読会] Residual Attention Network for Image Classification
PDF
拡がるディープラーニングの活用
PPTX
視覚と対話の融合研究
PPTX
Active Convolution, Deformable Convolution ―形状・スケールを学習可能なConvolution―
PDF
【DL輪読会】How Much Can CLIP Benefit Vision-and-Language Tasks?
PDF
『Attention Is All You Need』輪講スライド 日本大学 大澤研究室 江刺裕太
PDF
文献紹介:Efficient Attention: Attention With Linear Complexities
PPTX
[DL輪読会]Vision Transformer with Deformable Attention (Deformable Attention Tra...
PPTX
Deep Learningのための専用プロセッサ「MN-Core」の開発と活用(2022/10/19東大大学院「 融合情報学特別講義Ⅲ」)
PPTX
[DL輪読会]Object-Centric Learning with Slot Attention
PDF
NVIDIA Seminar ディープラーニングによる画像認識と応用事例
最近のDeep Learning (NLP) 界隈におけるAttention事情
Attentionの基礎からTransformerの入門まで
MIRU_Preview_JSAI2019
【DeepLearning研修】Transformerの基礎と応用 -- 第1回 Transformerの基本
Convolutional Neural Networks のトレンド @WBAFLカジュアルトーク#2
20190804_icml_kyoto
[DL輪読会]Pervasive Attention: 2D Convolutional Neural Networks for Sequence-to-...
Bert(transformer,attention)
CVPR2018 参加報告(速報版)初日
[DL輪読会] Residual Attention Network for Image Classification
拡がるディープラーニングの活用
視覚と対話の融合研究
Active Convolution, Deformable Convolution ―形状・スケールを学習可能なConvolution―
【DL輪読会】How Much Can CLIP Benefit Vision-and-Language Tasks?
『Attention Is All You Need』輪講スライド 日本大学 大澤研究室 江刺裕太
文献紹介:Efficient Attention: Attention With Linear Complexities
[DL輪読会]Vision Transformer with Deformable Attention (Deformable Attention Tra...
Deep Learningのための専用プロセッサ「MN-Core」の開発と活用(2022/10/19東大大学院「 融合情報学特別講義Ⅲ」)
[DL輪読会]Object-Centric Learning with Slot Attention
NVIDIA Seminar ディープラーニングによる画像認識と応用事例
Ad

More from Yusuke Fujimoto (6)

PDF
Paper LT: Mask Scoring R-CNN
PPTX
Paper: Bounding Box Regression with Uncertainty for Accurate Object Detection
PPTX
Tensor コアを使った PyTorch の高速化
PPTX
Paper: Objects as Points(CenterNet)
PPTX
Paper: seq2seq 20190320
PPTX
Paper: clinically accuratechestx-rayreport generation_noself
Paper LT: Mask Scoring R-CNN
Paper: Bounding Box Regression with Uncertainty for Accurate Object Detection
Tensor コアを使った PyTorch の高速化
Paper: Objects as Points(CenterNet)
Paper: seq2seq 20190320
Paper: clinically accuratechestx-rayreport generation_noself

論文LT会用資料: Attention Augmented Convolution Networks

  • 2. Agenda 1. イントロ 2. 関連研究 3. Attention Augmented Convolution 4. 個人的な感想 1
  • 3. 1. イントロ  Conv 層に self-attention を追加  Attention Augmented Convolution(以下 AAC)  SE Block 等が channel の重みだけを出力するのに対し、AACは feature map 自体を出力  Conv 層を丸々置き換えることもできる  提案手法を使うことで ResNet 等の精度が上がる  Detection でも上がることを確認した (RetinaNet on COCO)  Squeeze-and-Excitation(SE) よりも精度上がる  かつパラメータ数も SE より少ない  SE-ResNet 系が置き換わるかも?  メモリ消費量が大きい(出力を考えれば妥当)  (height x width)^2 に比例  画像サイズを2倍にすると16倍のメモリが必要になる?  適用したブロックだけなので単純に16倍に増えるわけ ではなさそうだが… 2
  • 4. 2. 関連研究  Attention mechanisms in networks  Attention の特徴  長い距離での関連について capture できる  NLP 界隈で流行し始める  RNN を使った Machine Translation  CV 界隈では  かなり幅広く応用されてる  例  CV用のモデルに組み込んだもの  CV用モデルとRNN系モデルをあわせたもの  代表的な例  Squeeze-and-Excitation(SE Block)  Gather-Excite(GE Block) 3
  • 5. 2. 関連研究 4 チャンネルに対 する重み  Squeeze-and-Excitation(SE Block, 2017)  https://arxiv.org/abs/1709.01507  チャンネルに重み付けをする方法  幅広く使える(大抵の Block に組み込める)  pretrained-model によくある SE~~~ は基本これが はいっている
  • 6. 3. Attention Augmented Convolution  先行研究(SE Block 等) と比較して  事前に AA Block 抜きで pre-training する必要がない  non-local neural networks などは事前に付与せずに ImageNet 等を学習する必要あり  The use of multi-head attention allows the model to attend jointly to both spatial and feature subspaces  multi-head attention を利用  → 空間と特徴の部分空間を一緒に扱えるようになった?(意味怪しいです…) 5
  • 7. 3. Attention Augmented Convolution  理解に必要な事前知識(Attention とは)  > Attention の基本は query と memory(key, value) です。  > Attention とは query によって memory から必要な情報を選択的に引っ張ってくること  下記サイトより引用 6 “作って理解する Transformer / Attention - Qiita” より引用 https://qiita.com/halhorn/items/c91497522be27bde17ce ・query ・key ・value の3つの単語が出 現したことだけ 押さえましょう
  • 8. 3. Attention Augmented Convolution  理解に必要な事前知識  > Attention の基本は query と memory(key, value) です。  > Attention とは query によって memory から必要な情報を選択的に引っ張ってくること  下記サイトより引用 7 “作って理解する Transformer / Attention - Qiita” より引用 https://qiita.com/halhorn/items/c91497522be27bde17ce LSTM 等を使った場合、 この memory は記憶セ ル等を示す 今回は input をそのま ま入力
  • 9. 3. Attention Augmented Convolution  数式的内訳  変数の定義  H: height of input  W: width of input  F_in: channel of input  N_h: number of head in multihead-attention (MHA)  d_v: depth of values in MHA  d_k: depth of queries and keys in MHA 8
  • 10. 3. Attention Augmented Convolution  画像が入力された時の操作  1. H, W について flatten  2. flatten したベクトル X から各 attention の head について以下の出力を得る 9
  • 11. 3. Attention Augmented Convolution  画像が入力された時の操作  1. H, W について flatten  2. flatten したベクトル X から各 attention の head について以下の出力を得る 10 Query 特徴量に変換 Key 特徴量に変換 Value 特徴量に変換
  • 12. 3. Attention Augmented Convolution  画像が入力された時の操作  3. それぞれの head の出力を concat  4. contat した結果に対して重みをかけて MHA の出力とする  MHA(X) は (H, W, d_v)  メモリ消費量が (HW)^2 に比例していることに注意 11
  • 13. 3. Attention Augmented Convolution  画像が入力された時の操作  5. Convolution 層と concat  細かい使用例はコードを参照ください 12
  • 14. 4. 個人的な所感  むずかしい…  SE Block は channel の重み付けがメインなのでシンプルでわかりやすかった  TensorFlow 実装例が出ているのはありがたい  PyTorch 等の実装がすでに上がっているので試せそう  https://github.com/leaderj1001/Attention-Augmented-Conv2d  SE-ResNet 系は丸々置き換わりそう?  とはいえ GPU 消費量が大きいので使うのが厳しそう…  誰かが pre-trained model を公開してくれれば…  pre-trained model がないと現行モデルを差し替えるのが辛いような  もしかしたら pre-trained model の一部の weight を使い回せばいけるかも? 13
  • 15. おまけ  Wide-ResNet に適用した場合の比較  図の通り top-1 accuracy は AA 使ったほうが良い  ただし top-5 については 大きい差はない 14
  • 16. References  Attention Augmented Convolutional Networks  https://arxiv.org/abs/1904.09925  Attention Augmented Convolutional Networks - 医療系AIエンジニアの技術メモ  https://ai-engineer-memo.hatenablog.com/entry/2019/05/06/182901  弊社先輩のメモ。本資料より詳しく書かれてます  Squeeze-and-Excitation Networks - 医療系AIエンジニアの技術メモ  https://ai-engineer-memo.hatenablog.com/entry/2019/02/04/005845  [DL輪読会]Attention Is All You Need  https://www.slideshare.net/DeepLearningJP2016/dlattention-is-all-you-need  https://github.com/leaderj1001/Attention-Augmented-Conv2d  PyTorch 実装(はやい)  論文解説 Attention Is All You Need (Transformer) - ディープラーニングブログ  http://deeplearning.hatenablog.com/entry/transformer)  作って理解する Transformer / Attention - Qiita  https://qiita.com/halhorn/items/c91497522be27bde17ce) 15