Semi-supervised Learning,
Weakly-supervised Learning,
Unsupervised Learning, and
Active Learning
Yusuke Uchida / @yu4u
1DeNA AIシステム部内の技術共有会で発表した資料です
これなに?
• Semi-supervised Learning, Weakly-supervised Learning,
Unsupervised Learning, Active Learning
について、ざっくり古典&最新手法を紹介
• Disclaimer:画像の話題中心です
2
色々な定義
3
O. Chapelle, B. Schlkopf, and A. Zien, "Semi-Supervised Learning," in The MIT Press, 2010.
http://www.acad.bg/ebook/ml/MITPress-%20SemiSupervised%20Learning.pdf
色々な定義
4
X. Zhu, "Semi-supervised learning literature survey," in Tech. rep. 1530, University of Wisconsin-Madison,
2005.
Pseudo label
色々な定義
• 通常のsupervised以外をweak supervisionと呼んだり
5
Supervised
Semi-supervised
Semi-supervised,
Active learning
Noisy labels
Z. Zhou, "A brief introduction to weakly supervised learning," in National Science Review, Vol. 5, No. 1, pp.
44-53, 2018.
色々な定義
• 分かりやすい
6
J. Jeong, S. Lee, J. Kim, and N. Kwak, "Consistency-based Semi-supervised Learning for Object
Detection," in Proc. of NIPS, 2019.
定義
• Supervised: 予測対象そのものが教師として付加されたデータ
のみで学習
• Semi-supervised:予測対象そのものが教師として付加された
データと、全く教師が付加されていないデータで学習
• Unsupervised: 教師なし、データのみからの学習
• Weakly-supervised: 予測対象の不完全な教師が付加された
データから学習
• Active learning: 教師つき・教師なしデータが与えられ、教師
なしデータに優先度をつけながら教師データを増やす
• Transfer learning, Domain adaptation: 教師が大量にあるド
メインの知識を他のドメインに転移
7
Overview
8
ラベルがいっぱいあるドメインA
ラベルありデータ
ラベルが少ない応用先ドメインB
ラベル
あり
データ
ラベルなしデータ
Domain adaptation
Semi-supervised
Unsupervised
A用ModelSupervised
Transfer learning
Finetune
ラベル追加
Active learning
B用Model
B用Model
B用Model
B用Model
Supervised-learning
9
Supervised-learning
• 略
10
Semi-supervised learning
11
Semi-supervised learning
• 予測対象そのものが教師として付加されたデータと、全く
教師が付加されていないデータで学習
• X. Zhu, "Semi-supervised learning literature survey,"
in Tech. rep. 1530, University of Wisconsin-Madison,
2005.
https://minds.wisconsin.edu/bitstream/handle/1793/60444/TR1530.pdf
• O. Chapelle, B. Schlkopf, and A. Zien, "Semi-Supervised
Learning," in The MIT Press, 2010.
http://www.acad.bg/ebook/ml/MITPress-%20SemiSupervised%20Learning.pdf
12
Semi-supervised learning
• 考え方:近いやつは同じラベルやろ
• 「近い」の定義が重要(manifoldをうまく捉えたり)
• Generative methods [Miller+,’96]
• Graph-based methods (label propagation) [Zhu+,’02]
• Low-density separation methods [Bennett+,’99]
13
D. Miller and H. Uyar, "A mixture of experts classifier with learning based on both labelled and unlabelled
data," in Proc. of NIPS, 1996.
X. Zhu and Z. Ghahramani, "Learning from labeled and unlabeled data with label propagation," in CMU
CALD tech. rep., 2002.
K. Bennett and A. Demiriz, "Semi-supervised support vector machines," in Proc. of NIPS, 1999.
Semi-supervised learning for DNN
• 本質的に同じものであるデータに対する予測分布が
ブレない “consistency regularization” が基本
• VAT, Π model, Mean Teacher, pseudo label, …
(昔とても良い解説記事があったのが消えてた)
• 以降では最近の画像関係のモデルを解説
14
MixMatch
• 異なるK個(=2, in practice)のaugmentationを行ったラベルなし
データの推論結果をsharpenすることでpseudo labelを作成
• ラベルあり、なしデータ間のmixup
15
D. Berthelot, N. Carlini, I. Goodfellow, N. Papernot, A. Oliver, and C. Raffel, "MixMatch: A Holistic Approach
to Semi-Supervised Learning," in Proc. of NIPS, 2019.
https://github.com/google-research/mixmatch
MixMatchの学習時の1iteration
16
ラベルありラベルなし
https://github.com/google-research/mixmatch/blob/master/mixmatch.py#L52
通常のmixupにはない
ラベルあり・なしの整合
性保持(ロスが違う)
ラベルありはCE、
ラベルなしはMSE
ReMixMatch
• MixMatchをベースに改良
• Distribution alignment
• Augmentation anchoring
• CTAugment
• Rotation loss
(後述の弱教師)
17
D. Berthelot, N. Carlini, E. Cubuk, A. Kurakin, K. Sohn, H. Zhang, and C. Raffel, "ReMixMatch: Semi-
Supervised Learning with Distribution Matching and Augmentation Anchoring," in Proc. of ICLR, 2020.
https://github.com/google-research/remixmatch
Distribution alignment
• ラベルなしデータに対するモデルの「平均的な」推論結果のクラス
分布p~(y)が真のクラス分布 p(y)(の推定値)と同じになるように
pseudo labelを補正する
18
直近128バッチ
から算出
ラベル付き
データから算出
ラベルあり・なしデータ間で、真のクラス分布が同じことを仮定
大量のラベルなしデータからランダムに選択してラベルつけた、みたいなケースならOK?
補正前
pseudo label
Augmentation anchoring
• AutoAugmentとか “強い” augmentationしゅごい
• MixMatchの枠組みでも使いたいが、augmentationの度合いが
強すぎて有意なpseudo labelにならない
• そこで、”弱い” augmentationを行ったデータの推論結果を
pseudo labelとして利用し、
異なるK個の “強い” augmentationを
行ったデータの推論結果に対してロスをかける
• K=8(MixMatchでは K=2)
19
弱
強
強
強
強
強
Control theory augment (CTAugment)
• 適切なaugmentationのパターンを自動獲得するAutoAugmentは十
分なvalデータがないと安定しないので、別のアプローチで自動獲得
• CTAugmentではtransformation毎に、強度が離散化されている
• 各強度はweight (0-1) を持っており、その強度でaugmentationし
たときの実際のラベルと推論結果の一致度の指数加重平均
• このweightのベクトルをカテゴリカル分布にしたものから
実際に訓練に使うtransformationの強度を選択
(ただし、weightが0.8以下のものは選択されない)
• transformation自体はuniformに2つ選ばれる
• weightは、各強度をuniformに選択しラベル一致度を計算→update
20
ReMixMatch
21
FixMatch
• 弱くaugmentしたデータと強くaugmentしたデータを推論
• 前者の結果のmaxの出力が閾値以上の場合、one-hotのpseudo
labelにし、後者の推論結果にcross-entropy lossをかける
• シンプル。学習が進むと対象が増える
22
K. Sohn, et al., "FixMatch: Simplifying Semi-Supervised Learning with Consistency and Confidence," in
arXiv:2001.07685, 2020.
RandAugmentとCTAugmentを比較、後者が良い
FixMatch
• 1バッチの処理
• μB個のサンプル、B個がラベルあり
23
通常のクロスエントロピー
ラベルあり&なし全データに対し前述のロスをかける
FixMatch
24
C.f. AugMix
• オリジナルとaugmentした画像間の予測結果をconsistentにするロスを利用
25
D. Hendrycks, N. Mu, E. Cubuk, B. Zoph, J. Gilmer, and B. Lakshminarayanan, "AugMix: A Simple Data
Processing Method to Improve Robustness and Uncertainty," in Proc. of ICLR, 2020.
https://github.com/google-research/augmix
異なるOPを異なる回数かけた画像
の線形和と、更にオリジナルの線形
和でaugmentationを定義 通常のCE オリジナル、aug1, aug2間のJSD
そもそもSSLの設定は現実的なのか?
• ラベルなし画像として、
ラベルあり画像のクラスを
過不足なく集めた画像集合を仮定
• どういう状況?!
• ラベルありとラベルなしの
クラスの分布が乖離すると性能低下
26
A. Oliver, A. Odena, C. Raffel, E. Cubuk, and I. Goodfellow, "Realistic Evaluation of Deep Semi-Supervised
Learning Algorithms," in Proc. of NIPS, 2018.
http://peluigi.hatenablog.com/entry/2018/09/07/162515(分かりやすい解説)
Weakly-supervised learning
27
Weakly-supervised learning
• 予測対象の不完全な教師が付加されたデータから学習
• もともとはMultiple Instance Learning問題として提唱された
28
T. G. Dietterich, R. H. Lathrop, T. Lozano-Perez, "Solving the multiple instance problem with axis-parallel
rectangles," in Artificial Artificial Intelligence, Vol. 89, Issues 1-2, pp. 31-71, 1997.
• 通常は特徴量とラベルが1:1対応
• MILでは、複数の特徴量の集合(bag)に対して
ラベルが付く
• 分子形状が内部結合の状態によって変化するので
MILとして解いている
Weakly-supervised learning
• 画像認識:1枚の画像を “bag” とみなし、画像のラベルに
対応する領域がどこかに1つ以上存在するという問題設定
29
O. Maron and A. Ratan, "Multiple-Instance Learning for Natural Scene Classification," in Proc. of ICML,
1998.
S. Andrews, I. Tsochantaridis, and T. Hofmann, "Support vector machines for multiple-instance learning," in
Proc. of NIPS, 2003.
Weakly-supervised learning
• Multi-instance multi-label learning (MIML) とかいうのも
30
Z. Zhou, M. Zhang, S. Huang, and Y. Li, "Multi-instance multi-label learning," in Artificial Intelligence, Vol.
176, Issue 1, pp. 2291-2320, 2012.
Weakly-supervised learning
• 画像ラベル or BBOXからsegmentationを学習
31
G. Papandreou, L. Chen, K. Murphy, and A. Yuille, "Weakly- and Semi-Supervised Learning of a DCNN for
Semantic Image Segmentation," in Proc. of ICCV, 2015.
Weakly-supervised learning
• 歴史とか具体的な(古典的)手法はこちら
https://www.mi.t.u-tokyo.ac.jp/kanezaki/pdf/3D_and_weaklearning.pdf
32
Unsupervised Learning
• 一般的には、クラスタリングや主成分分析等の
教師なしでデータ自体の構造や表現を獲得する手法
• DNNのコンテキストだと、教師なしで画像から
pretrainモデルを作る話(乱暴); self-supervisedとも
• 古典?:H. Barlow, "Unsupervised Learning," in Neural Computation, Vol.
1, Issue 3, pp. 295-311, 1989.
• DNN:Y. Bengio, A. Courville, and P. Vincent, "Representation Learning:
A Review and New Perspectives," in TPAMI, Vol. 35 Issue 8, pp. 1798-1828,
2013.
33
Unsupervised Learning for DNN
• 自動的に教師となる情報を作り出せる
”pretext” taskで学習させる
• pretext tasks
• 画像の回転を推測させる
• パッチ間の位置関係を推測させる
• パッチのジグソーパズルを解かせる
• Contrastive loss系
• 基本的にsemi-supervisedとしても使える
34
D. Berthelot, N. Carlini, E. Cubuk, A. Kurakin, K. Sohn, H. Zhang, and C. Raffel, "ReMixMatch: Semi-
Supervised Learning with Distribution Matching and Augmentation Anchoring," in Proc. of ICLR, 2020.
パッチ間の位置関係を推測させる
• 8-way classification
• 問題を簡単に解けてしまう
“shortcut” の除去が重要
• エッジのつながり
→cropにjitter
• 画像の位置によって色ズレが発生する色収差
→グレーっぽくする
35
C. Doersch, A. Gupta, and A. Efros, "Unsupervised Visual Representation Learning by Context Prediction,"
in Proc. of ICCV, 2015.
ジグソーパズルを解かせる
• 9!-way classification
36
M. Noroozi and P. Favaro, "Unsupervised learning of visual representations by solving jigsaw puzzles," in
Proc. of ECCV, 2016.
ジグソーパズルを解かせる
• 実際は 9! よりも少ないpermutationを利用
• permutationが多いほうが精度が高い
• なるべく違う(ハミング距離が大きい)permutation set
を利用したほうが良い
37
画像の回転を推定させる
38
S. Gidaris, P. Singh, and N. Komodakis, "Unsupervised Representation Learning by Predicting Image
Rotations," in Proc. of ICLR, 2018.
Contrastive loss系が流行り
• 同一画像を異なるaugmentation
したペアを同じ、他の画像ペアを違う
と当てられるかというpretext task
39
(CPC) A. Oord, Y. Li, and O. Vinyals, "Representation Learning with Contrastive Predictive Coding," in
arXiv:1807.03748, 2018.
(CPCv2) O. Henaff, A. Srinivas, J. Fauw, A. Razavi, C. Doersch, S. Eslami, adn A. Oord, "Data-Efficient
Image Recognition with Contrastive Predictive Coding," in arXiv:1905.09272, 2019.
(MoCo) K. He, H. Fan, Y. Wu, S. Xie, and R. Girshick, "Momentum Contrast for Unsupervised Visual
Representation Learning," in arXiv:1911.05722, 2019.
(PIRL) I. Misra and L. Maaten, "Self-Supervised Learning of Pretext-Invariant Representations," in
arXiv:1912.01991, 2019.
(SimCLR) T. Chen, S. Kornblith, M. Norouzi, and G. Hinton, "A Simple Framework for Contrastive Learning
of Visual Representations," in arXiv:2002.05709, 2020.
Active learning
40
Active learning
• ラベルなしデータにアノテーションをする際に、
このデータにラベルをつけるとモデルの精度が一番上がる
であろうデータを優先的にラベリングしていく考え方
41
M. Wang and X. Hua, "Active learning in multimedia annotation and retrieval: A survey," in ACM Trans. on
Intelligent Systems and TechnologyFebruary, 2011.
Y. Fu, X. Zhu, and B. Li , "A survey on instance selection for active learning," in Knowledge and Information
Systems, Vol. 35, pp 249–283, 2013.
Active learning
• 色々な手法が提案されているが…
最新のsemi-supervisedな手法でラベルなしデータを一緒
に学習すると性能がめっちゃ上がるし、そもそもactive
learningの手法間の差がなくなったでという論文が立て続
けに出た
42
O. Simeoni, M. Budnik, Y. Avrithis, and G. Gravier, "Rethinking deep active learning: Using unlabeled data
at model training," in arXiv:1911.08177, 2019.
S. Mittal, M. Tatarchenko, O. Cicek, T. Brox, "Parting with Illusions about Deep Active Learning", in
arXiv:1912.05361, 2019.
個人的な意見
• 実用上はActive learningというか、hard exampleを見つけ出して
アノテーションするのが重要
• 物体検出とか、ランドマーク検出とかは、
アノテーション候補に推定結果を出して
ずれてるやつをアノテーション対象として選択するのが良い
• Consistencyベースで候補を絞っても良い
(幾何変換した画像間の整合性を見る
⇔ モデル自体をconsistency lossで学習しては?)
43

Semi supervised, weakly-supervised, unsupervised, and active learning