SlideShare a Scribd company logo
1 of 47
Download to read offline
contrastive learningを中⼼とした⾃⼰教師あり学習の論⽂紹介
ぱんさん@オンライン (2020/06/07)
⾃⼰教師あり学習(self-supervised learning)とは
n ⾃⼰教師あり学習とは教師あり学習のアプローチをつかった教師なし学習
n 教師なし学習と⾃⼰教師あり学習の違い
n 教師なし学習:
n 重要な性質を残しつつデータを圧縮する
n 例: クラスタリング,次元削減など
n ⾃⼰教師あり学習:
n データ⾃体から教師ラベルを作り出し,(下流タスクが解けるような)良い表現を学習する
n 例: denoising AE, impaintingなど
n ⾃⼰教師あり学習には⼤まかに3つのカテゴリがある
n 再構成系
n 補助タスク系
n contrastive learning系
n 最近流⾏りなのでこれを中⼼に(代表的な?)論⽂をいくつか紹介する
※⾃分の解釈や誤りを含むかもしれません
⾃⼰教師あり学習には⼤まかに3つのカテゴリがある
n 再構成系
n Extracting and Composing Robust Features with Denoising Autoencoders (ICML 2008)
n Context Encoders: Feature Learning by Inpainting (CVPR 2016)
n Split-Brain Autoencoders: Unsupervised Learning by Cross-Channel Prediction (CVPR 2017)
n 補助タスク系
n Unsupervised Visual Representation Learning by Context Prediction (ICCV 2015)
n Unsupervised Learning of Visual Representations by Solving Jigsaw Puzzles (ECCV 2016)
n Unsupervised Representation Learning by Predicting Image Rotations (ICLR 2018)
n contrastive learning系
n Distributed Representations of Words and Phrases and their Compositionality (NIPS 2013)
n Representation Learning with Contrastive Predictive Coding (arxiv 2018)
n Data-Efficient Image Recognition with Contrastive Predictive Coding (ICLR2020 rejected)
n Momentum Contrast for Unsupervised Visual Representation Learning (CVPR 2020)
n A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02)
n Improved Baselines with Momentum Contrastive Learning (arxiv 2020/03)
n Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05)
再構成系
n Extracting and Composing Robust Features with Denoising Autoencoders (ICML 2008)
n 元画像にノイズを加えてそれを復元するように学習することで良い表現を得る⼿法
n Context Encoders: Feature Learning by Inpainting (CVPR 2016)
n impainting タスクを解くことで良い表現を得る⼿法
n 得られた表現はAEによる表現よりも分類や物体検出タスクなどに有効であることを⽰した
n Split-Brain Autoencoders: Unsupervised Learning by Cross-Channel Prediction (CVPR 2017)
n 2つのdisjointな部分NNを使い,データを分割して予測タスクを解くことで表現を学習する
n 例えば半分のNNはRGBからdepthを推定し,もう半分はdepthからRGBを推定する
補助タスク系
n Unsupervised Visual Representation Learning by Context Prediction (ICCV 2015)
n パッチの位置を予測する補助タスクを解くことで表現を得る
n ちなみにパッチは少し間をあける(境界線で予測されるのを防ぐ)
補助タスク系
n Unsupervised Learning of Visual Representations by Solving Jigsaw Puzzles (ECCV 2016)
n ジグゾーパズルを解くことで表現を学習する
n 9!通りの分類は多すぎるので,サンプリングして約100クラス分類をとく
補助タスク系
n Unsupervised Representation Learning by Predicting Image Rotations (ICLR 2018)
n 画像が何度回転したかを当てることで表現を学習する
n ⾓度の種類は0, 90, 180, 270の四種類で⼗分で,多すぎても少なすぎても良い表現が得られない
contrastive learning系
n そもそもcontrastive learningとは︖
n Noise Contrastive Estimation (NCE) またはそれに準ずるロスを使って学習する⼿法
n 以下ではcontrastive learningに関連する論⽂を紹介する
Noise Contrastive Estimation (NCE) とは︖
n Notes on Noise Contrastive Estimation and Negative Sampling (arxiv) を参考に解説する
n ある⽂脈cが与えられたとき,単語wである確率のモデルを考える
n 経験分布!𝑝(𝑤|𝑐)を考えて,クロスエントロピー誤差の観点からこれを上記のモデルに近づけ
ることを考える
n Vが⾮常に⼤きくなる場合,単純なクロスエントロピーで学習すると計算時間が膨⼤になる
n Vは例えばボキャブラリー数
n これを解決する⽅法がNCE
Noise Contrastive Estimation (NCE) とは︖
n NCEのアイデア: ある⽂脈cが与えられたとき,本物のサンプルwであるかそうでないかの⼆値
分類として考え,モデルのパラメタを推定する
n ここでノイズ分布(本物のサンプルではない分布)として𝑞 𝑤 を考えるが,これは通常⼀様分布とする
n 本物のサンプルであればD = 1,ノイズ分布からのサンプルであれば D = 0とする
n ノイズ分布からのサンプル数はkとすると,次の同時分布が考えられる
n 条件付き確率の定義から,次式
ちなみにdは誤植で
Dだと思われる
Noise Contrastive Estimation (NCE) とは︖
n 実際に求めたいのはモデル分布𝑝!なので,
経験分布を𝑝!(𝑤|𝑐)に置き換える
n そのまま置き換えるだけだと, 𝑍!(𝑐)が残る
n NCEでは𝑍!(𝑐)を定数として1にしてしまう(!?)
n そうすると,右の式は次の式になる
n 最終的に上の⼆値分類を解くために
対数尤度最⼤化を考えると,⽬的関数は下式
Noise Contrastive Estimation (NCE) とは︖
n 期待値をMC近似すると実際によく使われる式になる
n negative samplingの関係性
n ノイズ分布𝑞 𝑤 =
"
#
とすると下式になる
n 上記⽬的関数はword2vecにおける⽬的関数の式に⼀致していることをみていく
Distributed Representations of Words and Phrases and their Compositionality (NIPS 2013)
n word2vecの論⽂
n Skip-gramモデルを利⽤するとき,⽬的関数は下式
n 周りの単語を予測できるような表現を得たいという考えに基づく
n 条件付き確率は次のようにモデル化する
n しかし,⽬的関数の勾配を計算するとき,Wが⼤きすぎて計算量が膨⼤になってしまう
n Wはボキャブラリー数(10$
~)
n vは埋め込みベクトルで学習したい表現
Skip-gram
Distributed Representations of Words and Phrases and their Compositionality (NIPS 2013)
n そこで,対照推定(negative sampling)を⾏う
n negative sample数kは5~20くらいで良いらしい
n → 計算量がめちゃくちゃ減る
n positive(関連する単語)かnegative(それ以外)の⼆値分類をするというイメージ
n 先程導いた式 (下)において,𝑢! 𝑤, 𝑐 = exp(𝑣%
&
'
𝑣%(
)であることを考えると確かに⽬的関数と⼀致する
関係ない単語をk個
サンプリング
関連する単語
である確率
関連しない単語
である確率
⽬的関数 =
Representation Learning with Contrastive Predictive Coding (arxiv 2018)
n ⾳声や画像にも対照推定を⽤いた論⽂
n この辺から対照推定が流⾏りだした
n word2vecでは,周りの単語を予測できるような表現を学習していた
n CPCは⾳声データの場合,⽂脈cの情報からkステップ先を予測できるような表現を学習する
⾳声データ
word2vecでいう
埋め込みベクトル
⾃⼰回帰モデル(GRU)
を使って得たcontext情報
Representation Learning with Contrastive Predictive Coding (arxiv 2018)
n 画像データの場合,contextの情報からk個先のエンコードされたパッチを予測できるような
表現を学習する
画像のpatchをresnetなどで
エンコードする
⾃⼰回帰モデルであるpixelCNNを使い,
エンコードされたパッチの⽂脈cを得る
得られた⽂脈から数段下の
エンコードされたパッチを予測する
Representation Learning with Contrastive Predictive Coding (arxiv 2018)
n 次の𝑓を定義すると,⽬的関数は𝐿"のようになる
n この⽬的関数はpositive sample (PS)の確率の対数尤度になっている
n NCEに基づいたロスで,InfoNCEと呼ぶ
n NCEと⽐較するとnegative sample (NS)の確率の対数尤度項があるはずだがない...
n 理由は⽂脈cとPSと相互情報量を⼤きくしたいという⽬的から⽣まれたから
n ⽬的関数は相互情報量の下限となっている
n N-1はNSの数なので,NSが多いほどタイトなバウンドになることがわかる
n つまりNSは多ければ多いほどよい
Representation Learning with Contrastive Predictive Coding (arxiv 2018)
n ⾳声データ分類に関しては教師あり学習
と同等の精度がでている︕
n CPCで得られた特徴量の上に線形層を加
えて学習したときの結果
n どのステップ先を予測するか,なにをNS
にするのかが重要
Representation Learning with Contrastive Predictive Coding (arxiv 2018)
n 画像データ分類も補助タスク系の⼿法と⽐べて精度めっちゃ上がっている
n データはImageNet
n CPCで得られた特徴量の上に線形層を加えて学習したときの結果
Data-Efficient Image Recognition with Contrastive Predictive Coding (arxiv 2020)
n CPCに様々な⼯夫をして精度をめちゃくちゃ上げたversion2の論⽂
n 下図はどのように特徴を使って実験をしたのかがわかりやすくまとまっている
Data-Efficient Image Recognition with Contrastive Predictive Coding (arxiv 2020)
n CPCv1 → CPCv2の軌跡
n BU: bottom up spatial predictions
n HF: randomly flipping patches horizontally
n LN: layer normalization
n RC: random color-dropping
n TL: tuned prediction lengths
n HP: horizontal spatial predictions
n patchをエンコードするモデルは
ResNet-92からResNet-161に
Data-Efficient Image Recognition with Contrastive Predictive Coding (arxiv 2020)
n ImageNetにおいて特徴量に線形層を加えて学習したときの結果
AMDIMには負けてるっぽいが...?(AMDIMはDeep InfoMaxの拡張論⽂)
Data-Efficient Image Recognition with Contrastive Predictive Coding (arxiv 2020)
n 普通の教師あり学習はラベルが少ないと⼤きく精度を落とす
n CPCを使った学習の場合はラベルデータが1%でも精度が⾼い
A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02)
n CPCではpatchレベルで対照推定を⾏っていた
n ここからはインスタンスレベルで対照推定を⾏う論⽂の紹介
n オーグメンテーションした画像(PS)は近づけて,他の画像(NS)は離すように学習する
これまでは予測できる表現は良い表現であるという話だった
ここからは分類できると良い表現が⼿に⼊るという補助タスク系に近い話な気がする
A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02)
n 訓練時はzを使って対照推定し,推論時はzとgを捨ててしまってhを下流タスクに利⽤する
オーグメント
Resnetなどの
エンコーダ
下流タスクで
利⽤する表現
対照推定で
利⽤する特徴
⼆層のMLP
A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02)
n t-SNEによるhとzの可視化
n zよりもhのほうがもつれが少ない表現が獲得されている
A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02)
n オーグメンテーションは⼤事(特にcropとcolor distort)
A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02)
n ロスはword2vecで使われていたNT-Logistic (NCE) よりもCPCで使われているNT-Xent
(InfoNCE) のほうが良い
n Margin Tripletは距離学習のためによく使われるロス
n NTはNormalized Temperature-scaledの意味
n 温度調整,L2正規化はかなり重要
A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02)
n negative sample数は多いほどよいのでバッチサイズの⼤きさは重要になる
n 結果からみるに2000~4000くらいあるとよい(メモリ... 😥)
A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02)
n アルゴリズムは簡単なので実装⾃体は楽そう
ここは少しわかりにくいが
⼊⼒とPSに対称性があるので
ひっくり返しているだけ
A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02)
n ついにパラメタを増やせば
教師ありに並ぶ
n ※ 他の⼿法と同様に得られた
表現の上に線形層をのせて教
師あり学習はしている
A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02)
n 教師ありもパラメタ増やせば精度
があがる
n ただし教師なし(SimCLR)のほうが
より精度があがる
Momentum Contrast for Unsupervised Visual Representation Learning (CVPR 2020)
n SimCLRと学習⽅法はほぼ同じだが,queryに対して
普通にencoderを⽤いる⼀⽅でkeyに対しては
momentum encoderを⽤いる
n encoderのパラメータをモメンタムを使って更新する
n query: ⼊⼒
n key: ⼊⼒と⽐較する対象
n positive sampleもしくはnegative sample
n ⽬的関数はCPCと同じでinfoNCE
n ただしqとkはL2正規化されている
n τは温度パラメタ(τ = 0.07)
Momentum Contrast for Unsupervised Visual Representation Learning (CVPR 2020)
n negative sample数(key数)を⼤きくするとバッチサイズが⼤きくなりメモリ効率が悪くなる
n 例えば(a)のように,同じエンコーダを使うと⼤量のkeyから伝播される勾配計算が⼤変
n かといって(b)のように予めkeyを作っておくと,古いkeyを使うことになってしまう
n (c)のようにモメンタムによるエンコーダの更新を⾏うことで,勾配計算することなく新しいkeyの
エンコードが可能になり,key数をめちゃくちゃ増やせる
Momentum Contrast for Unsupervised Visual Representation Learning (CVPR 2020)
n pytorch likeなわかりやすいアルゴリズム
で⾮常に簡単に実装できそう
keyは同じデータからオーグメンテーション
により⽣成しているため,positive sample
queueに過去のkey(negative sample)が
K (4000~) 個⼊っている
keyを通すencoderは更新を⾏わない
今回のkeyは新しくqueueに加えられる
(他のデータにとってはNSになるため)
Momentum Contrast for Unsupervised Visual Representation Learning (CVPR 2020)
n key数(K)がめちゃくちゃ増やせるので精度がバク上がりする
n end-to-endはKが⼤きくなるとメモリ的に厳しいので途中で打ち切っている
Momentum Contrast for Unsupervised Visual Representation Learning (CVPR 2020)
n 実はSimCLRの前の論⽂なのでそれよりは精度が低い
n 最近MoCo version2がでた
Improved Baselines with Momentum Contrastive Learning (arxiv 2020/03)
n MoCo version2: 条件をそろえたらSimCLRに勝つと主張した論⽂
MoCo v1との違い
SimCLRとの⽐較
Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05)
n これまでのinstance-wise contrastive learningはクラスが同じでも別のサンプルであれば
negative sampleとして遠ざけるように埋め込む問題がある
n Prototypical contrastive learningはクラスが同じであればpositive sampleとして近づけるよう
に埋め込むようにする
n Prototypeは潜在変数上でk-meansを利⽤して教師なしで学習する
Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05)
n ⽬的関数はEMアルゴリズムから導かれる
n Q関数を考えると
この下限の最⼤化を
考える
Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05)
n E-step: パラメータθを固定したときに下限を最⼤化するのは,Qが事後分布のとき
n M-step: Qを固定したとき,定数項 を無視すると,次の式を
最⼤化するθを求める
実際にはk-meansを⾏うので
クラスターに属していたら1を返し
属していなければ0を返す
Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05)
n 同時分布はクラスタの確率を事前分布とおくと次式
n cが与えられたときの分布は等⽅なガウシアンを仮定する
n ここで である
n vとcにL2正規化を⾏うと, となり,これまでの式から下式が導かれる
クラス版のInfoNCEみたいな式がでてきた!
Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05)
n 最終的にはInfoNCEのロスも追加して下の式がProtoNCEのロス関数になる
n ちなみにφは次のように計算する
n Zは同じクラスターに属するvの数
Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05)
Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05)
n 階層的な意味構造も捉えている
n 粗いクラスターからは⾺の画像がサンプルされ,細かいクラスターからは⼈+⾺の画像がサンプル
される
Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05)
n SimCLRとかMoCo
とかもう少し精度
が良い気がする
が...?
Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05)
n t-sneによるImageNetの可視化
n MoCoよりもPCLのほうがいい感じにクラスターをつくっている

More Related Content

What's hot

GAN(と強化学習との関係)
GAN(と強化学習との関係)GAN(と強化学習との関係)
GAN(と強化学習との関係)Masahiro Suzuki
 
[DL輪読会]GQNと関連研究,世界モデルとの関係について
[DL輪読会]GQNと関連研究,世界モデルとの関係について[DL輪読会]GQNと関連研究,世界モデルとの関係について
[DL輪読会]GQNと関連研究,世界モデルとの関係についてDeep Learning JP
 
【DL輪読会】ViT + Self Supervised Learningまとめ
【DL輪読会】ViT + Self Supervised Learningまとめ【DL輪読会】ViT + Self Supervised Learningまとめ
【DL輪読会】ViT + Self Supervised LearningまとめDeep Learning JP
 
SSII2022 [TS1] Transformerの最前線〜 畳込みニューラルネットワークの先へ 〜
SSII2022 [TS1] Transformerの最前線〜 畳込みニューラルネットワークの先へ 〜SSII2022 [TS1] Transformerの最前線〜 畳込みニューラルネットワークの先へ 〜
SSII2022 [TS1] Transformerの最前線〜 畳込みニューラルネットワークの先へ 〜SSII
 
PCAの最終形態GPLVMの解説
PCAの最終形態GPLVMの解説PCAの最終形態GPLVMの解説
PCAの最終形態GPLVMの解説弘毅 露崎
 
Swin Transformer (ICCV'21 Best Paper) を完璧に理解する資料
Swin Transformer (ICCV'21 Best Paper) を完璧に理解する資料Swin Transformer (ICCV'21 Best Paper) を完璧に理解する資料
Swin Transformer (ICCV'21 Best Paper) を完璧に理解する資料Yusuke Uchida
 
PRML学習者から入る深層生成モデル入門
PRML学習者から入る深層生成モデル入門PRML学習者から入る深層生成モデル入門
PRML学習者から入る深層生成モデル入門tmtm otm
 
[DL輪読会]Vision Transformer with Deformable Attention (Deformable Attention Tra...
[DL輪読会]Vision Transformer with Deformable Attention (Deformable Attention Tra...[DL輪読会]Vision Transformer with Deformable Attention (Deformable Attention Tra...
[DL輪読会]Vision Transformer with Deformable Attention (Deformable Attention Tra...Deep Learning JP
 
SSII2022 [SS1] ニューラル3D表現の最新動向〜 ニューラルネットでなんでも表せる?? 〜​
SSII2022 [SS1] ニューラル3D表現の最新動向〜 ニューラルネットでなんでも表せる?? 〜​SSII2022 [SS1] ニューラル3D表現の最新動向〜 ニューラルネットでなんでも表せる?? 〜​
SSII2022 [SS1] ニューラル3D表現の最新動向〜 ニューラルネットでなんでも表せる?? 〜​SSII
 
[DL輪読会]Focal Loss for Dense Object Detection
[DL輪読会]Focal Loss for Dense Object Detection[DL輪読会]Focal Loss for Dense Object Detection
[DL輪読会]Focal Loss for Dense Object DetectionDeep Learning JP
 
[DL輪読会]Recent Advances in Autoencoder-Based Representation Learning
[DL輪読会]Recent Advances in Autoencoder-Based Representation Learning[DL輪読会]Recent Advances in Autoencoder-Based Representation Learning
[DL輪読会]Recent Advances in Autoencoder-Based Representation LearningDeep Learning JP
 
「世界モデル」と関連研究について
「世界モデル」と関連研究について「世界モデル」と関連研究について
「世界モデル」と関連研究についてMasahiro Suzuki
 
【論文読み会】Self-Attention Generative Adversarial Networks
【論文読み会】Self-Attention Generative  Adversarial Networks【論文読み会】Self-Attention Generative  Adversarial Networks
【論文読み会】Self-Attention Generative Adversarial NetworksARISE analytics
 
【論文読み会】Deep Clustering for Unsupervised Learning of Visual Features
【論文読み会】Deep Clustering for Unsupervised Learning of Visual Features【論文読み会】Deep Clustering for Unsupervised Learning of Visual Features
【論文読み会】Deep Clustering for Unsupervised Learning of Visual FeaturesARISE analytics
 
Curriculum Learning (関東CV勉強会)
Curriculum Learning (関東CV勉強会)Curriculum Learning (関東CV勉強会)
Curriculum Learning (関東CV勉強会)Yoshitaka Ushiku
 
Fisher Vectorによる画像認識
Fisher Vectorによる画像認識Fisher Vectorによる画像認識
Fisher Vectorによる画像認識Takao Yamanaka
 
[DL輪読会]相互情報量最大化による表現学習
[DL輪読会]相互情報量最大化による表現学習[DL輪読会]相互情報量最大化による表現学習
[DL輪読会]相互情報量最大化による表現学習Deep Learning JP
 
Attentionの基礎からTransformerの入門まで
Attentionの基礎からTransformerの入門までAttentionの基礎からTransformerの入門まで
Attentionの基礎からTransformerの入門までAGIRobots
 

What's hot (20)

GAN(と強化学習との関係)
GAN(と強化学習との関係)GAN(と強化学習との関係)
GAN(と強化学習との関係)
 
[DL輪読会]GQNと関連研究,世界モデルとの関係について
[DL輪読会]GQNと関連研究,世界モデルとの関係について[DL輪読会]GQNと関連研究,世界モデルとの関係について
[DL輪読会]GQNと関連研究,世界モデルとの関係について
 
【DL輪読会】ViT + Self Supervised Learningまとめ
【DL輪読会】ViT + Self Supervised Learningまとめ【DL輪読会】ViT + Self Supervised Learningまとめ
【DL輪読会】ViT + Self Supervised Learningまとめ
 
SSII2022 [TS1] Transformerの最前線〜 畳込みニューラルネットワークの先へ 〜
SSII2022 [TS1] Transformerの最前線〜 畳込みニューラルネットワークの先へ 〜SSII2022 [TS1] Transformerの最前線〜 畳込みニューラルネットワークの先へ 〜
SSII2022 [TS1] Transformerの最前線〜 畳込みニューラルネットワークの先へ 〜
 
PCAの最終形態GPLVMの解説
PCAの最終形態GPLVMの解説PCAの最終形態GPLVMの解説
PCAの最終形態GPLVMの解説
 
Swin Transformer (ICCV'21 Best Paper) を完璧に理解する資料
Swin Transformer (ICCV'21 Best Paper) を完璧に理解する資料Swin Transformer (ICCV'21 Best Paper) を完璧に理解する資料
Swin Transformer (ICCV'21 Best Paper) を完璧に理解する資料
 
PRML学習者から入る深層生成モデル入門
PRML学習者から入る深層生成モデル入門PRML学習者から入る深層生成モデル入門
PRML学習者から入る深層生成モデル入門
 
[DL輪読会]Vision Transformer with Deformable Attention (Deformable Attention Tra...
[DL輪読会]Vision Transformer with Deformable Attention (Deformable Attention Tra...[DL輪読会]Vision Transformer with Deformable Attention (Deformable Attention Tra...
[DL輪読会]Vision Transformer with Deformable Attention (Deformable Attention Tra...
 
実装レベルで学ぶVQVAE
実装レベルで学ぶVQVAE実装レベルで学ぶVQVAE
実装レベルで学ぶVQVAE
 
SSII2022 [SS1] ニューラル3D表現の最新動向〜 ニューラルネットでなんでも表せる?? 〜​
SSII2022 [SS1] ニューラル3D表現の最新動向〜 ニューラルネットでなんでも表せる?? 〜​SSII2022 [SS1] ニューラル3D表現の最新動向〜 ニューラルネットでなんでも表せる?? 〜​
SSII2022 [SS1] ニューラル3D表現の最新動向〜 ニューラルネットでなんでも表せる?? 〜​
 
ELBO型VAEのダメなところ
ELBO型VAEのダメなところELBO型VAEのダメなところ
ELBO型VAEのダメなところ
 
[DL輪読会]Focal Loss for Dense Object Detection
[DL輪読会]Focal Loss for Dense Object Detection[DL輪読会]Focal Loss for Dense Object Detection
[DL輪読会]Focal Loss for Dense Object Detection
 
[DL輪読会]Recent Advances in Autoencoder-Based Representation Learning
[DL輪読会]Recent Advances in Autoencoder-Based Representation Learning[DL輪読会]Recent Advances in Autoencoder-Based Representation Learning
[DL輪読会]Recent Advances in Autoencoder-Based Representation Learning
 
「世界モデル」と関連研究について
「世界モデル」と関連研究について「世界モデル」と関連研究について
「世界モデル」と関連研究について
 
【論文読み会】Self-Attention Generative Adversarial Networks
【論文読み会】Self-Attention Generative  Adversarial Networks【論文読み会】Self-Attention Generative  Adversarial Networks
【論文読み会】Self-Attention Generative Adversarial Networks
 
【論文読み会】Deep Clustering for Unsupervised Learning of Visual Features
【論文読み会】Deep Clustering for Unsupervised Learning of Visual Features【論文読み会】Deep Clustering for Unsupervised Learning of Visual Features
【論文読み会】Deep Clustering for Unsupervised Learning of Visual Features
 
Curriculum Learning (関東CV勉強会)
Curriculum Learning (関東CV勉強会)Curriculum Learning (関東CV勉強会)
Curriculum Learning (関東CV勉強会)
 
Fisher Vectorによる画像認識
Fisher Vectorによる画像認識Fisher Vectorによる画像認識
Fisher Vectorによる画像認識
 
[DL輪読会]相互情報量最大化による表現学習
[DL輪読会]相互情報量最大化による表現学習[DL輪読会]相互情報量最大化による表現学習
[DL輪読会]相互情報量最大化による表現学習
 
Attentionの基礎からTransformerの入門まで
Attentionの基礎からTransformerの入門までAttentionの基礎からTransformerの入門まで
Attentionの基礎からTransformerの入門まで
 

Similar to Contrastive learning 20200607

Minimally Supervised Classification to Semantic Categories using Automaticall...
Minimally Supervised Classification to Semantic Categories using Automaticall...Minimally Supervised Classification to Semantic Categories using Automaticall...
Minimally Supervised Classification to Semantic Categories using Automaticall...sakaizawa
 
論文紹介 Semi-supervised Learning with Deep Generative Models
論文紹介 Semi-supervised Learning with Deep Generative Models論文紹介 Semi-supervised Learning with Deep Generative Models
論文紹介 Semi-supervised Learning with Deep Generative ModelsSeiya Tokui
 
Recurrent Neural Networks
Recurrent Neural NetworksRecurrent Neural Networks
Recurrent Neural NetworksSeiya Tokui
 
Deep Learningの基礎と応用
Deep Learningの基礎と応用Deep Learningの基礎と応用
Deep Learningの基礎と応用Seiya Tokui
 
Semantic_Matching_AAAI16_論文紹介
Semantic_Matching_AAAI16_論文紹介Semantic_Matching_AAAI16_論文紹介
Semantic_Matching_AAAI16_論文紹介Masayoshi Kondo
 
関西CVPRML勉強会 kernel PCA
関西CVPRML勉強会 kernel PCA関西CVPRML勉強会 kernel PCA
関西CVPRML勉強会 kernel PCAAkisato Kimura
 
東京大学工学部計数工学科応用音響学 D2 Clustering
東京大学工学部計数工学科応用音響学 D2 Clustering東京大学工学部計数工学科応用音響学 D2 Clustering
東京大学工学部計数工学科応用音響学 D2 ClusteringHiroshi Ono
 
LS for Reinforcement Learning
LS for Reinforcement LearningLS for Reinforcement Learning
LS for Reinforcement Learningimlschedules
 
130323 slide all
130323 slide all130323 slide all
130323 slide allikea0064
 
アンサンブル木モデル解釈のためのモデル簡略化法
アンサンブル木モデル解釈のためのモデル簡略化法アンサンブル木モデル解釈のためのモデル簡略化法
アンサンブル木モデル解釈のためのモデル簡略化法Satoshi Hara
 
Nl237 presentation
Nl237 presentationNl237 presentation
Nl237 presentationRoy Ray
 
【招待講演】パラメータ制約付き行列分解のベイズ汎化誤差解析【StatsML若手シンポ2020】
【招待講演】パラメータ制約付き行列分解のベイズ汎化誤差解析【StatsML若手シンポ2020】【招待講演】パラメータ制約付き行列分解のベイズ汎化誤差解析【StatsML若手シンポ2020】
【招待講演】パラメータ制約付き行列分解のベイズ汎化誤差解析【StatsML若手シンポ2020】Naoki Hayashi
 
AtCoder Regular Contest 017
AtCoder Regular Contest 017AtCoder Regular Contest 017
AtCoder Regular Contest 017AtCoder Inc.
 
[DL輪読会]NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis
[DL輪読会]NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis[DL輪読会]NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis
[DL輪読会]NeRF: Representing Scenes as Neural Radiance Fields for View SynthesisDeep Learning JP
 
NLP若手の回 ACL2012参加報告
NLP若手の回 ACL2012参加報告NLP若手の回 ACL2012参加報告
NLP若手の回 ACL2012参加報告Hiroyuki TOKUNAGA
 
2015 08 survey
2015 08 survey2015 08 survey
2015 08 surveymarujirou
 

Similar to Contrastive learning 20200607 (20)

Minimally Supervised Classification to Semantic Categories using Automaticall...
Minimally Supervised Classification to Semantic Categories using Automaticall...Minimally Supervised Classification to Semantic Categories using Automaticall...
Minimally Supervised Classification to Semantic Categories using Automaticall...
 
論文紹介 Semi-supervised Learning with Deep Generative Models
論文紹介 Semi-supervised Learning with Deep Generative Models論文紹介 Semi-supervised Learning with Deep Generative Models
論文紹介 Semi-supervised Learning with Deep Generative Models
 
Recurrent Neural Networks
Recurrent Neural NetworksRecurrent Neural Networks
Recurrent Neural Networks
 
深層学習による自然言語処理の研究動向
深層学習による自然言語処理の研究動向深層学習による自然言語処理の研究動向
深層学習による自然言語処理の研究動向
 
Deep Learningの基礎と応用
Deep Learningの基礎と応用Deep Learningの基礎と応用
Deep Learningの基礎と応用
 
Semantic_Matching_AAAI16_論文紹介
Semantic_Matching_AAAI16_論文紹介Semantic_Matching_AAAI16_論文紹介
Semantic_Matching_AAAI16_論文紹介
 
機械学習
機械学習機械学習
機械学習
 
関西CVPRML勉強会 kernel PCA
関西CVPRML勉強会 kernel PCA関西CVPRML勉強会 kernel PCA
関西CVPRML勉強会 kernel PCA
 
東京大学工学部計数工学科応用音響学 D2 Clustering
東京大学工学部計数工学科応用音響学 D2 Clustering東京大学工学部計数工学科応用音響学 D2 Clustering
東京大学工学部計数工学科応用音響学 D2 Clustering
 
LS for Reinforcement Learning
LS for Reinforcement LearningLS for Reinforcement Learning
LS for Reinforcement Learning
 
130323 slide all
130323 slide all130323 slide all
130323 slide all
 
Anomaly detection survey
Anomaly detection surveyAnomaly detection survey
Anomaly detection survey
 
アンサンブル木モデル解釈のためのモデル簡略化法
アンサンブル木モデル解釈のためのモデル簡略化法アンサンブル木モデル解釈のためのモデル簡略化法
アンサンブル木モデル解釈のためのモデル簡略化法
 
Nl237 presentation
Nl237 presentationNl237 presentation
Nl237 presentation
 
AdaFace(CVPR2022)
AdaFace(CVPR2022)AdaFace(CVPR2022)
AdaFace(CVPR2022)
 
【招待講演】パラメータ制約付き行列分解のベイズ汎化誤差解析【StatsML若手シンポ2020】
【招待講演】パラメータ制約付き行列分解のベイズ汎化誤差解析【StatsML若手シンポ2020】【招待講演】パラメータ制約付き行列分解のベイズ汎化誤差解析【StatsML若手シンポ2020】
【招待講演】パラメータ制約付き行列分解のベイズ汎化誤差解析【StatsML若手シンポ2020】
 
AtCoder Regular Contest 017
AtCoder Regular Contest 017AtCoder Regular Contest 017
AtCoder Regular Contest 017
 
[DL輪読会]NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis
[DL輪読会]NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis[DL輪読会]NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis
[DL輪読会]NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis
 
NLP若手の回 ACL2012参加報告
NLP若手の回 ACL2012参加報告NLP若手の回 ACL2012参加報告
NLP若手の回 ACL2012参加報告
 
2015 08 survey
2015 08 survey2015 08 survey
2015 08 survey
 

More from ぱんいち すみもと

ICLR・ICML読み会2021 by パンハウスゼミ
ICLR・ICML読み会2021 by パンハウスゼミICLR・ICML読み会2021 by パンハウスゼミ
ICLR・ICML読み会2021 by パンハウスゼミぱんいち すみもと
 
Free lunch for few shot learning distribution calibration
Free lunch for few shot learning distribution calibrationFree lunch for few shot learning distribution calibration
Free lunch for few shot learning distribution calibrationぱんいち すみもと
 
最近(2020/09/13)のarxivの分布外検知の論文を紹介
最近(2020/09/13)のarxivの分布外検知の論文を紹介最近(2020/09/13)のarxivの分布外検知の論文を紹介
最近(2020/09/13)のarxivの分布外検知の論文を紹介ぱんいち すみもと
 
Anomaly Detection by Latent Regularized Dual Adversarial Networks
Anomaly Detection by Latent Regularized Dual Adversarial NetworksAnomaly Detection by Latent Regularized Dual Adversarial Networks
Anomaly Detection by Latent Regularized Dual Adversarial Networksぱんいち すみもと
 
ICLR2020の異常検知論文の紹介 (2019/11/23)
ICLR2020の異常検知論文の紹介 (2019/11/23)ICLR2020の異常検知論文の紹介 (2019/11/23)
ICLR2020の異常検知論文の紹介 (2019/11/23)ぱんいち すみもと
 
パンハウスゼミ 異常検知論文紹介 20191005
パンハウスゼミ 異常検知論文紹介  20191005パンハウスゼミ 異常検知論文紹介  20191005
パンハウスゼミ 異常検知論文紹介 20191005ぱんいち すみもと
 
Anomaly detection 系の論文を一言でまとめた
Anomaly detection 系の論文を一言でまとめたAnomaly detection 系の論文を一言でまとめた
Anomaly detection 系の論文を一言でまとめたぱんいち すみもと
 
Categorical reparameterization with gumbel softmax
Categorical reparameterization with gumbel softmaxCategorical reparameterization with gumbel softmax
Categorical reparameterization with gumbel softmaxぱんいち すみもと
 
パンでも分かるVariational Autoencoder
パンでも分かるVariational Autoencoderパンでも分かるVariational Autoencoder
パンでも分かるVariational Autoencoderぱんいち すみもと
 

More from ぱんいち すみもと (18)

ICLR・ICML読み会2021 by パンハウスゼミ
ICLR・ICML読み会2021 by パンハウスゼミICLR・ICML読み会2021 by パンハウスゼミ
ICLR・ICML読み会2021 by パンハウスゼミ
 
Free lunch for few shot learning distribution calibration
Free lunch for few shot learning distribution calibrationFree lunch for few shot learning distribution calibration
Free lunch for few shot learning distribution calibration
 
最近(2020/09/13)のarxivの分布外検知の論文を紹介
最近(2020/09/13)のarxivの分布外検知の論文を紹介最近(2020/09/13)のarxivの分布外検知の論文を紹介
最近(2020/09/13)のarxivの分布外検知の論文を紹介
 
continual learning survey
continual learning surveycontinual learning survey
continual learning survey
 
Variational denoising network
Variational denoising networkVariational denoising network
Variational denoising network
 
Deep Semi-Supervised Anomaly Detection
Deep Semi-Supervised Anomaly DetectionDeep Semi-Supervised Anomaly Detection
Deep Semi-Supervised Anomaly Detection
 
Anomaly Detection by Latent Regularized Dual Adversarial Networks
Anomaly Detection by Latent Regularized Dual Adversarial NetworksAnomaly Detection by Latent Regularized Dual Adversarial Networks
Anomaly Detection by Latent Regularized Dual Adversarial Networks
 
ICLR2020の異常検知論文の紹介 (2019/11/23)
ICLR2020の異常検知論文の紹介 (2019/11/23)ICLR2020の異常検知論文の紹介 (2019/11/23)
ICLR2020の異常検知論文の紹介 (2019/11/23)
 
パンハウスゼミ 異常検知論文紹介 20191005
パンハウスゼミ 異常検知論文紹介  20191005パンハウスゼミ 異常検知論文紹介  20191005
パンハウスゼミ 異常検知論文紹介 20191005
 
Anomaly detection 系の論文を一言でまとめた
Anomaly detection 系の論文を一言でまとめたAnomaly detection 系の論文を一言でまとめた
Anomaly detection 系の論文を一言でまとめた
 
最新の異常検知手法(NIPS 2018)
最新の異常検知手法(NIPS 2018)最新の異常検知手法(NIPS 2018)
最新の異常検知手法(NIPS 2018)
 
Dual dl
Dual dlDual dl
Dual dl
 
Categorical reparameterization with gumbel softmax
Categorical reparameterization with gumbel softmaxCategorical reparameterization with gumbel softmax
Categorical reparameterization with gumbel softmax
 
Domain transfer サーベイ
Domain transfer サーベイDomain transfer サーベイ
Domain transfer サーベイ
 
Intro VAE
Intro VAEIntro VAE
Intro VAE
 
パンでも分かるVariational Autoencoder
パンでも分かるVariational Autoencoderパンでも分かるVariational Autoencoder
パンでも分かるVariational Autoencoder
 
PRML 14章
PRML 14章PRML 14章
PRML 14章
 
PRML 9章
PRML 9章PRML 9章
PRML 9章
 

Contrastive learning 20200607

  • 2. ⾃⼰教師あり学習(self-supervised learning)とは n ⾃⼰教師あり学習とは教師あり学習のアプローチをつかった教師なし学習 n 教師なし学習と⾃⼰教師あり学習の違い n 教師なし学習: n 重要な性質を残しつつデータを圧縮する n 例: クラスタリング,次元削減など n ⾃⼰教師あり学習: n データ⾃体から教師ラベルを作り出し,(下流タスクが解けるような)良い表現を学習する n 例: denoising AE, impaintingなど n ⾃⼰教師あり学習には⼤まかに3つのカテゴリがある n 再構成系 n 補助タスク系 n contrastive learning系 n 最近流⾏りなのでこれを中⼼に(代表的な?)論⽂をいくつか紹介する ※⾃分の解釈や誤りを含むかもしれません
  • 3. ⾃⼰教師あり学習には⼤まかに3つのカテゴリがある n 再構成系 n Extracting and Composing Robust Features with Denoising Autoencoders (ICML 2008) n Context Encoders: Feature Learning by Inpainting (CVPR 2016) n Split-Brain Autoencoders: Unsupervised Learning by Cross-Channel Prediction (CVPR 2017) n 補助タスク系 n Unsupervised Visual Representation Learning by Context Prediction (ICCV 2015) n Unsupervised Learning of Visual Representations by Solving Jigsaw Puzzles (ECCV 2016) n Unsupervised Representation Learning by Predicting Image Rotations (ICLR 2018) n contrastive learning系 n Distributed Representations of Words and Phrases and their Compositionality (NIPS 2013) n Representation Learning with Contrastive Predictive Coding (arxiv 2018) n Data-Efficient Image Recognition with Contrastive Predictive Coding (ICLR2020 rejected) n Momentum Contrast for Unsupervised Visual Representation Learning (CVPR 2020) n A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02) n Improved Baselines with Momentum Contrastive Learning (arxiv 2020/03) n Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05)
  • 4. 再構成系 n Extracting and Composing Robust Features with Denoising Autoencoders (ICML 2008) n 元画像にノイズを加えてそれを復元するように学習することで良い表現を得る⼿法 n Context Encoders: Feature Learning by Inpainting (CVPR 2016) n impainting タスクを解くことで良い表現を得る⼿法 n 得られた表現はAEによる表現よりも分類や物体検出タスクなどに有効であることを⽰した n Split-Brain Autoencoders: Unsupervised Learning by Cross-Channel Prediction (CVPR 2017) n 2つのdisjointな部分NNを使い,データを分割して予測タスクを解くことで表現を学習する n 例えば半分のNNはRGBからdepthを推定し,もう半分はdepthからRGBを推定する
  • 5. 補助タスク系 n Unsupervised Visual Representation Learning by Context Prediction (ICCV 2015) n パッチの位置を予測する補助タスクを解くことで表現を得る n ちなみにパッチは少し間をあける(境界線で予測されるのを防ぐ)
  • 6. 補助タスク系 n Unsupervised Learning of Visual Representations by Solving Jigsaw Puzzles (ECCV 2016) n ジグゾーパズルを解くことで表現を学習する n 9!通りの分類は多すぎるので,サンプリングして約100クラス分類をとく
  • 7. 補助タスク系 n Unsupervised Representation Learning by Predicting Image Rotations (ICLR 2018) n 画像が何度回転したかを当てることで表現を学習する n ⾓度の種類は0, 90, 180, 270の四種類で⼗分で,多すぎても少なすぎても良い表現が得られない
  • 8. contrastive learning系 n そもそもcontrastive learningとは︖ n Noise Contrastive Estimation (NCE) またはそれに準ずるロスを使って学習する⼿法 n 以下ではcontrastive learningに関連する論⽂を紹介する
  • 9. Noise Contrastive Estimation (NCE) とは︖ n Notes on Noise Contrastive Estimation and Negative Sampling (arxiv) を参考に解説する n ある⽂脈cが与えられたとき,単語wである確率のモデルを考える n 経験分布!𝑝(𝑤|𝑐)を考えて,クロスエントロピー誤差の観点からこれを上記のモデルに近づけ ることを考える n Vが⾮常に⼤きくなる場合,単純なクロスエントロピーで学習すると計算時間が膨⼤になる n Vは例えばボキャブラリー数 n これを解決する⽅法がNCE
  • 10. Noise Contrastive Estimation (NCE) とは︖ n NCEのアイデア: ある⽂脈cが与えられたとき,本物のサンプルwであるかそうでないかの⼆値 分類として考え,モデルのパラメタを推定する n ここでノイズ分布(本物のサンプルではない分布)として𝑞 𝑤 を考えるが,これは通常⼀様分布とする n 本物のサンプルであればD = 1,ノイズ分布からのサンプルであれば D = 0とする n ノイズ分布からのサンプル数はkとすると,次の同時分布が考えられる n 条件付き確率の定義から,次式 ちなみにdは誤植で Dだと思われる
  • 11. Noise Contrastive Estimation (NCE) とは︖ n 実際に求めたいのはモデル分布𝑝!なので, 経験分布を𝑝!(𝑤|𝑐)に置き換える n そのまま置き換えるだけだと, 𝑍!(𝑐)が残る n NCEでは𝑍!(𝑐)を定数として1にしてしまう(!?) n そうすると,右の式は次の式になる n 最終的に上の⼆値分類を解くために 対数尤度最⼤化を考えると,⽬的関数は下式
  • 12. Noise Contrastive Estimation (NCE) とは︖ n 期待値をMC近似すると実際によく使われる式になる n negative samplingの関係性 n ノイズ分布𝑞 𝑤 = " # とすると下式になる n 上記⽬的関数はword2vecにおける⽬的関数の式に⼀致していることをみていく
  • 13. Distributed Representations of Words and Phrases and their Compositionality (NIPS 2013) n word2vecの論⽂ n Skip-gramモデルを利⽤するとき,⽬的関数は下式 n 周りの単語を予測できるような表現を得たいという考えに基づく n 条件付き確率は次のようにモデル化する n しかし,⽬的関数の勾配を計算するとき,Wが⼤きすぎて計算量が膨⼤になってしまう n Wはボキャブラリー数(10$ ~) n vは埋め込みベクトルで学習したい表現 Skip-gram
  • 14. Distributed Representations of Words and Phrases and their Compositionality (NIPS 2013) n そこで,対照推定(negative sampling)を⾏う n negative sample数kは5~20くらいで良いらしい n → 計算量がめちゃくちゃ減る n positive(関連する単語)かnegative(それ以外)の⼆値分類をするというイメージ n 先程導いた式 (下)において,𝑢! 𝑤, 𝑐 = exp(𝑣% & ' 𝑣%( )であることを考えると確かに⽬的関数と⼀致する 関係ない単語をk個 サンプリング 関連する単語 である確率 関連しない単語 である確率 ⽬的関数 =
  • 15. Representation Learning with Contrastive Predictive Coding (arxiv 2018) n ⾳声や画像にも対照推定を⽤いた論⽂ n この辺から対照推定が流⾏りだした n word2vecでは,周りの単語を予測できるような表現を学習していた n CPCは⾳声データの場合,⽂脈cの情報からkステップ先を予測できるような表現を学習する ⾳声データ word2vecでいう 埋め込みベクトル ⾃⼰回帰モデル(GRU) を使って得たcontext情報
  • 16. Representation Learning with Contrastive Predictive Coding (arxiv 2018) n 画像データの場合,contextの情報からk個先のエンコードされたパッチを予測できるような 表現を学習する 画像のpatchをresnetなどで エンコードする ⾃⼰回帰モデルであるpixelCNNを使い, エンコードされたパッチの⽂脈cを得る 得られた⽂脈から数段下の エンコードされたパッチを予測する
  • 17. Representation Learning with Contrastive Predictive Coding (arxiv 2018) n 次の𝑓を定義すると,⽬的関数は𝐿"のようになる n この⽬的関数はpositive sample (PS)の確率の対数尤度になっている n NCEに基づいたロスで,InfoNCEと呼ぶ n NCEと⽐較するとnegative sample (NS)の確率の対数尤度項があるはずだがない... n 理由は⽂脈cとPSと相互情報量を⼤きくしたいという⽬的から⽣まれたから n ⽬的関数は相互情報量の下限となっている n N-1はNSの数なので,NSが多いほどタイトなバウンドになることがわかる n つまりNSは多ければ多いほどよい
  • 18. Representation Learning with Contrastive Predictive Coding (arxiv 2018) n ⾳声データ分類に関しては教師あり学習 と同等の精度がでている︕ n CPCで得られた特徴量の上に線形層を加 えて学習したときの結果 n どのステップ先を予測するか,なにをNS にするのかが重要
  • 19. Representation Learning with Contrastive Predictive Coding (arxiv 2018) n 画像データ分類も補助タスク系の⼿法と⽐べて精度めっちゃ上がっている n データはImageNet n CPCで得られた特徴量の上に線形層を加えて学習したときの結果
  • 20. Data-Efficient Image Recognition with Contrastive Predictive Coding (arxiv 2020) n CPCに様々な⼯夫をして精度をめちゃくちゃ上げたversion2の論⽂ n 下図はどのように特徴を使って実験をしたのかがわかりやすくまとまっている
  • 21. Data-Efficient Image Recognition with Contrastive Predictive Coding (arxiv 2020) n CPCv1 → CPCv2の軌跡 n BU: bottom up spatial predictions n HF: randomly flipping patches horizontally n LN: layer normalization n RC: random color-dropping n TL: tuned prediction lengths n HP: horizontal spatial predictions n patchをエンコードするモデルは ResNet-92からResNet-161に
  • 22. Data-Efficient Image Recognition with Contrastive Predictive Coding (arxiv 2020) n ImageNetにおいて特徴量に線形層を加えて学習したときの結果 AMDIMには負けてるっぽいが...?(AMDIMはDeep InfoMaxの拡張論⽂)
  • 23. Data-Efficient Image Recognition with Contrastive Predictive Coding (arxiv 2020) n 普通の教師あり学習はラベルが少ないと⼤きく精度を落とす n CPCを使った学習の場合はラベルデータが1%でも精度が⾼い
  • 24. A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02) n CPCではpatchレベルで対照推定を⾏っていた n ここからはインスタンスレベルで対照推定を⾏う論⽂の紹介 n オーグメンテーションした画像(PS)は近づけて,他の画像(NS)は離すように学習する これまでは予測できる表現は良い表現であるという話だった ここからは分類できると良い表現が⼿に⼊るという補助タスク系に近い話な気がする
  • 25. A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02) n 訓練時はzを使って対照推定し,推論時はzとgを捨ててしまってhを下流タスクに利⽤する オーグメント Resnetなどの エンコーダ 下流タスクで 利⽤する表現 対照推定で 利⽤する特徴 ⼆層のMLP
  • 26. A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02) n t-SNEによるhとzの可視化 n zよりもhのほうがもつれが少ない表現が獲得されている
  • 27. A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02) n オーグメンテーションは⼤事(特にcropとcolor distort)
  • 28. A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02) n ロスはword2vecで使われていたNT-Logistic (NCE) よりもCPCで使われているNT-Xent (InfoNCE) のほうが良い n Margin Tripletは距離学習のためによく使われるロス n NTはNormalized Temperature-scaledの意味 n 温度調整,L2正規化はかなり重要
  • 29. A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02) n negative sample数は多いほどよいのでバッチサイズの⼤きさは重要になる n 結果からみるに2000~4000くらいあるとよい(メモリ... 😥)
  • 30. A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02) n アルゴリズムは簡単なので実装⾃体は楽そう ここは少しわかりにくいが ⼊⼒とPSに対称性があるので ひっくり返しているだけ
  • 31. A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02) n ついにパラメタを増やせば 教師ありに並ぶ n ※ 他の⼿法と同様に得られた 表現の上に線形層をのせて教 師あり学習はしている
  • 32. A Simple Framework for Contrastive Learning of Visual Representations (arxiv 2020/02) n 教師ありもパラメタ増やせば精度 があがる n ただし教師なし(SimCLR)のほうが より精度があがる
  • 33. Momentum Contrast for Unsupervised Visual Representation Learning (CVPR 2020) n SimCLRと学習⽅法はほぼ同じだが,queryに対して 普通にencoderを⽤いる⼀⽅でkeyに対しては momentum encoderを⽤いる n encoderのパラメータをモメンタムを使って更新する n query: ⼊⼒ n key: ⼊⼒と⽐較する対象 n positive sampleもしくはnegative sample n ⽬的関数はCPCと同じでinfoNCE n ただしqとkはL2正規化されている n τは温度パラメタ(τ = 0.07)
  • 34. Momentum Contrast for Unsupervised Visual Representation Learning (CVPR 2020) n negative sample数(key数)を⼤きくするとバッチサイズが⼤きくなりメモリ効率が悪くなる n 例えば(a)のように,同じエンコーダを使うと⼤量のkeyから伝播される勾配計算が⼤変 n かといって(b)のように予めkeyを作っておくと,古いkeyを使うことになってしまう n (c)のようにモメンタムによるエンコーダの更新を⾏うことで,勾配計算することなく新しいkeyの エンコードが可能になり,key数をめちゃくちゃ増やせる
  • 35. Momentum Contrast for Unsupervised Visual Representation Learning (CVPR 2020) n pytorch likeなわかりやすいアルゴリズム で⾮常に簡単に実装できそう keyは同じデータからオーグメンテーション により⽣成しているため,positive sample queueに過去のkey(negative sample)が K (4000~) 個⼊っている keyを通すencoderは更新を⾏わない 今回のkeyは新しくqueueに加えられる (他のデータにとってはNSになるため)
  • 36. Momentum Contrast for Unsupervised Visual Representation Learning (CVPR 2020) n key数(K)がめちゃくちゃ増やせるので精度がバク上がりする n end-to-endはKが⼤きくなるとメモリ的に厳しいので途中で打ち切っている
  • 37. Momentum Contrast for Unsupervised Visual Representation Learning (CVPR 2020) n 実はSimCLRの前の論⽂なのでそれよりは精度が低い n 最近MoCo version2がでた
  • 38. Improved Baselines with Momentum Contrastive Learning (arxiv 2020/03) n MoCo version2: 条件をそろえたらSimCLRに勝つと主張した論⽂ MoCo v1との違い SimCLRとの⽐較
  • 39. Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05) n これまでのinstance-wise contrastive learningはクラスが同じでも別のサンプルであれば negative sampleとして遠ざけるように埋め込む問題がある n Prototypical contrastive learningはクラスが同じであればpositive sampleとして近づけるよう に埋め込むようにする n Prototypeは潜在変数上でk-meansを利⽤して教師なしで学習する
  • 40. Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05) n ⽬的関数はEMアルゴリズムから導かれる n Q関数を考えると この下限の最⼤化を 考える
  • 41. Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05) n E-step: パラメータθを固定したときに下限を最⼤化するのは,Qが事後分布のとき n M-step: Qを固定したとき,定数項 を無視すると,次の式を 最⼤化するθを求める 実際にはk-meansを⾏うので クラスターに属していたら1を返し 属していなければ0を返す
  • 42. Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05) n 同時分布はクラスタの確率を事前分布とおくと次式 n cが与えられたときの分布は等⽅なガウシアンを仮定する n ここで である n vとcにL2正規化を⾏うと, となり,これまでの式から下式が導かれる クラス版のInfoNCEみたいな式がでてきた!
  • 43. Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05) n 最終的にはInfoNCEのロスも追加して下の式がProtoNCEのロス関数になる n ちなみにφは次のように計算する n Zは同じクラスターに属するvの数
  • 44. Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05)
  • 45. Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05) n 階層的な意味構造も捉えている n 粗いクラスターからは⾺の画像がサンプルされ,細かいクラスターからは⼈+⾺の画像がサンプル される
  • 46. Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05) n SimCLRとかMoCo とかもう少し精度 が良い気がする が...?
  • 47. Prototypical Contrastive Learning of Unsupervised Representations (arxiv 2020/05) n t-sneによるImageNetの可視化 n MoCoよりもPCLのほうがいい感じにクラスターをつくっている