179
第26回 名古屋CVPRML勉強会 Random Forests祭り http://www.vision.cs.chubu.ac.jp/CVTutorial/ 藤吉研究室 中部大学工学部情報工学科 1

Random Forests

Embed Size (px)

DESCRIPTION

第26回名古屋CVPRML勉強会「Random Forests祭り」 2013年11月16日 Classification Forest Regression Forest Density Forest Semi-supervised Forest Random Fern

Citation preview

Page 1: Random Forests

第26回 名古屋CVPRML勉強会Random Forests祭り

http://www.vision.cs.chubu.ac.jp/CVTutorial/

藤吉研究室中部大学工学部情報工学科

1

Page 2: Random Forests

1. Random Forests2. 学習を用いたキーポイントマッチングの高速化- Random Forestsを用いたキーポイントマッチング- 2段階Random Forestsによる高精度化

3. Random Forestsを用いた物体検出4. Random Forestsを用いた人体姿勢推定5. Regression Forests6. その他の問題設定への応用1. Density Forests2. Semi-Supervised Forests

2

Page 3: Random Forests

Random Forests [Breiman, 2001]

• アイデア‒ 決定木学習 + アンサンブル学習 + ランダム学習• 別名

‒ Randomized Trees‒ Randomized Forests‒ Randomized Decision Forests

• できること‒ マルチクラス識別‒ クラスタリング

• 特徴‒ シンプルかつ高速な学習と識別

3

Page 4: Random Forests

CVへの応用:キーポイントマッチング

[Lepetit et al., 2006]4

Page 5: Random Forests

CVへの応用:物体認識&セグメンテーション

[Shotton et al., 2008]

5

Page 6: Random Forests

• 文字認識 [Amit & Geman, 1997]

• visual word クラスタリング[Moosmann et al., 2006]

• 行動認識&姿勢推定[山下 et al., 2010]

CVへの応用:その他

図 13 各ノードにおける事前選択特徴とクラス分割結果例

うに,下位ノードでは各行動クラスを認識するための特徴が多く選択されている.提案手法で導入した事前特徴選択により,上位ノード

は多数のクラスに共通する特徴,下位ノードは特定のクラスに対応する特徴を階層的に選択することができている.これにより,1つのフレームワークで階層的に人体検出から姿勢推定,行動認識を実現している.

6. ま と め我々は,人の行動を理解するために,人体検出から行

動認識までを 1つのフレームワークで実現する BoostedRandomized Treesを提案した.提案手法は,決定木のノード生成時に各クラスの尤度をもとに認識対象となるクラスを定義し,Joint Boostingにより効率的に特徴を選択することで,上位ノードは多数のクラスに対応した特徴,下位ノードは特定のクラスに対応した特徴を階層的に選択することが可能である.今後は,姿勢のバリエーションを増加させていくとともに,一般物体認識などに応用していく.

文 献[1] L. Breiman, “Random forests”, Machine Learning,

No.45(1), pp. 5-32, 2001.[2] P. Geurts, D. Ernst, and L. Wehenkel, “Extremely

randomized trees”,Machine Learning,No.36,Vol.1,pp. 3-42,2006.

[3] V. Lepetit, P. Lagger, and P. Fua,“Randomized treesfor real-time keypoint recognition”,IEEE Conf. onComputer Vision and Pattern Recognition,pp. 775-781,2005.

[4] J. Shotton, M. Johnson, R. Cipolla, “Semantic Tex-ton Forests for Image Categorization and Segmenta-tion”, IEEE Conf. on Computer Vision and PatternRecognition, 2008.

[5] N. Dalal and B. Triggs,“Histograms of oriented gra-dients for human detection”,IEEE Conf. on Com-puter Vision and Pattern Recognition, 2005.

[6] Q. Zhu, S. Avidan, M. C. Yeh, and K. T. Cheng,“Fast human detection using a cascade of histogramsof oriented gradients,IEEE Conf. on Computer Vi-sion and Pattern Recognition, Vol. 2, pp. 1491-1498,2006.

[7] C. Hou, H. Ai and S. Lao,“Multiview PedestrianDetection Based on Vector Boosting”,Asian Conf.

of Computer Vision, pp. 210-219,2007.[8] M. Blank, L. Gorelick, E. Shechtman, M. Irani,and

R.Basri. “Actions as space-time shapes”, IEEE Intl.Conf. of Computer Vision, 2005.

[9] J. C. Niebles and L. Fei-Fei. “A hierarchical modelof shape and appearance for human action classifica-tion”, IEEE Conf. on Computer Vision and PatternRecognition, 2007.

[10] K. Schindler and L. Van Gool,“Action snippets:How many frames does human action recognition re-quire?”,IEEE Conf. on Computer Vision and PatternRecognition, 2008.

[11] A. Fathi and G. Mori,“Human pose estimation us-ing motion exemplars”, IEEE Intl. Conf. of ComputerVision, 2007.

[12] G. Shakhnarovich, P. Viola, D. Trevor, “Fast poseestimation with parameter-sensitive hashing”, IEEEIntl. Conf. of Computer Vision, 2003.

[13] A. Bissacco, M.-H. Yang and S. Soatto, “Fast hu-man pose estimation using appearance and motion viamulti-dimensional boosting regression”, IEEE Conf.on Computer Vision and Pattern Recognition, 2007.

[14] G. Rogez, J. Rihan, S. Ramalingam, C. Orrite and P.H.S. Torr, “Randomized Trees for Human Pose Detec-tion”, IEEE Conf. on Computer Vision and PatternRecognition, 2008.

[15] A. Bissacco, M.-H.Yang and S. Soatto, “Detecting hu-mans via their pose”, In NIPS, pp. 169-176, 2006.

[16] A. Torralba, K. P. Murphy and W. T. Free-man,”Sharing features: e!cient boosting proceduresfor multiclass object detection”,IEEE Conf. on Com-puter Vision and Pattern Recognition, 2004.

[17] Z. Tu,”Probabilistic boosting-tree: learning discrim-inative models for classification, recognition and clus-tering”,IEEE Intl. Conf. of Computer Vision, 2005.

[18] J. Gall and V.Lempitsky, ”Class-specific hough forestsfor object detection”,IEEE Conf. on Computer Vi-sion and Pattern Recognition, 2009.

[19] R. Okada,”Discriminative and Generalized HoughTransform for Object Detection”,IEEE Intl. Conf.of Computer Vision, 2009.

6

Page 7: Random Forests

• パーツベースの人検出 [三井 et al., 2011]

‒ 人の領域をパーツに分割し、RFsによるマルチクラス識別器を構築

CVへの応用4:人検出

提案手法

従来法

C0 C1 C2 C3 C4 C5

+ + + … = ) ( Ave

Tree0 Tree1 TreeT-1

… … …

Randomized Trees マルチクラス識別器

0.61 0.29 = 0.32 h0 =

7

Page 8: Random Forests

Random Forestsの特徴

• メリット‒ 高速な学習・識別• ランダム学習により高次元特徴(数万~)でも効率的な学習が可能• 選択された特徴量のみで識別

‒ 教師信号のノイズに強い• 学習データのランダム選択によりノイズの影響を抑制

• デメリット‒ オーバーフィッティングになりやすい• パラメータが多い(木の数,木の深さ,サブセット)• 学習データ数が少ないとうまく学習できない→ 大量の学習データを取得 or 生成する工夫が必要

8

Page 9: Random Forests

マルチクラス識別器の比較(思いっきり主観です!)

SVM(one-vs-rest)

Boosting(Joint Boosting)

Random Forests

学習データの数

ノイズの影響

学習時間

識別時間

少 中 多

少 大 少

中 遅い 速い

遅い 中 速い

9

Page 10: Random Forests

1. Random Forests の学習アルゴリズム

10

Page 11: Random Forests

木構造を利用した識別器

決定木の数

深さ

D

1. 0.8 1.2 3.4 ... 3.22. 0.2 2.3 4.2 ... 4.23. 1.1 4.1 2.6 ... 6.74. 4.2 1.3 2.1 ... 2.4

1. 2.3 5.2 1.2 ... 6.22. 0.2 5.2 3.4 ... 7.23. 1.1 2.5 5.2 ... 3.24. 1.2 3.6 6.2 ... 6.3

学習サンプル

tree1 treeT

末端ノード

分岐ノード

カテゴリ1 カテゴリ2

1. 2.1 1.2 2.5 ... 2.62. 1.2 2.7 7.4 ... 3.23. 2.1 3.1 3.3 ... 8.54. 1.7 4.2 8.2 ... 2.1

カテゴリC

0

1

2

3

11

Page 12: Random Forests

・前処理− データ集合 S から T 個のサブセット作成

・For t = 1, 2, …, T  サブセットの数だけ木を作成- IF エントロピー H(S)=0 or 指定した深さDに達した

・末端ノード作成- ELSE・分岐関数候補をランダムに K 個選択・ For k = 1, 2, …, K

- 候補 k を用いてサンプルの分割- 候補 k の情報利得算出

・最も情報利得Iが高い候補を選択・単純ベイズ識別器作成

学習アルゴリズム

Random Forestsの学習アルゴリズム

12

Page 13: Random Forests

サブセットの作成

• サンプル集合 S を用意‒ サンプルi ∈ S には特徴ベクトル vi, 教師信号 ci が付与

• サブセットの作成‒ T 個のサブセットをランダムに作成

サブセット S1 サブセット S2 サブセット ST

サンプル集合 S

13

Page 14: Random Forests

サブセット作成のポイント

• サブセット間のサンプルの数は統一‒ 木の数と密接な関係

• 完全なランダム選択‒ サブセット間でのサンプルの重複を許容‒ 学習に利用されないサンプルも許容

サンプル集合 S

サブセット S1 サブセット S2 サブセット ST

14

Page 15: Random Forests

学習アルゴリズム

15

・前処理− データ集合 S から T 個のサブセット作成

・For t = 1, 2, …, T  サブセットの数だけ木を作成- IF エントロピー H(S)=0 or 指定した深さDに達した

・末端ノード作成- ELSE・分岐関数候補をランダムに K 個選択・ For k = 1, 2, …, K

- 候補 k を用いてサンプルの分割- 候補 k の情報利得算出

・最も情報利得Iが高い候補を選択・単純ベイズ識別器作成

Random Forestsの学習アルゴリズム

Page 16: Random Forests

• 一般的には2つの方法が取られる‒ 情報量を基準として複数の候補から良いものを選択 ( K>1 )• Random Forests[ L. Breiman 01 ]• Semantic Texton Forests[ J. Shotton 08 ]

‒ 単純にランダム選択 ( K=1 )• Extremely Randomized Trees[ P. Geurts 06 ]• Keypoint Matching [ V.Lepetit ’08 ]

分岐関数の決定方法

16

Page 17: Random Forests

• 基本的に設計は自由‒ しきい値,特徴量の大小関係

• Semantic Texton Forestsではしきい値を利用

分岐関数の設計

f(p) = Px1,y1,c1

f(p) = Px1,y1,c1 + Px2,y2,c2

f(p) = Px1,y1,c1 � Px2,y2,c2

f(p) = |Px1,y1,c1 � Px2,y2,c2 |

i

p

Pixel&i&gives&patch&p (21x21 pixels'in'experiments)'

17

:左に分岐:右に分岐

�f(v) < totherwise分岐ルール:

Page 18: Random Forests

分岐関数候補の選択

• 学習サンプルの特徴ベクトルから候補を選出‒ 分岐関数 f と しきい値 t の組み合わせをK個ランダムに選択

• 例:1000次元の特徴ベクトル

特徴次元

Freq

.

1 2 3 4 5 6 7 8 1000999998997996995994993

1.0

候補数 K = √(特徴次元数1000) ≒ 32 が推奨されている[Breiman ’01]

(2, 0.1)1, ( 993, 0.3 )2, ( 6, 0.2 )3, ( 999, 0.2 )4, ... , ( 4, 0.3 )K{ }

18

Page 19: Random Forests

分岐関数候補数とランダム性

• 分岐関数候補数を多く設定‒ ランダム性の低い決定木‒ 学習時間が増加‒ 識別性能の向上

• 分岐関数候補数を少なく設定‒ ランダム性の高い決定木‒ 学習時間の削減‒ 識別性能の低下

19

Page 20: Random Forests

学習アルゴリズム

20

・前処理− データ集合 S から T 個のサブセット作成

・For t = 1, 2, …, T  サブセットの数だけ木を作成- IF エントロピー H(S)=0 or 指定した深さDに達した

・末端ノード作成- ELSE・分岐関数候補をランダムに K 個選択・ For k = 1, 2, …, K

- 候補 k を用いてサンプルの分割- 候補 k の情報利得算出

・最も情報利得Iが高い候補を選択・単純ベイズ識別器作成

Random Forestsの学習アルゴリズム

Page 21: Random Forests

• 分岐関数候補を用いてサンプルを分割

• 情報利得 I により候補を評価

サンプルの分割と情報利得の算出

Sl : 左に分岐するサンプル集合Sr : 右に分岐するサンプル集合

H : 情報エントロピーSj : 親ノードのサンプル集合

21

Ij = H(Sj)��

i=L,R

|Sij |

|Sj |H(Sij)

Sl = {i � Sj |fk(vi) < tk}Sr = Sj \ Sl

= H(Sj)�|Sl||Sj |H(Sl)�

|Sr||Sj |H(Sr)

Page 22: Random Forests

情報エントロピー

• カテゴリの出現確率の偏りを表す‒ クラスの出現確率に偏りが少ない場合エントロピーは大

22

0

0.25

0.50

0.75

1.00

0.0 0.2 0.4 0.6 0.8 1.0

エントロピー

カテゴリ1の出現確率

2カテゴリの出現確率とエントロピー

エントロピー :

H(S) = �C�

c=1

Pc log2 Pc

Page 23: Random Forests

情報利得

• ノードを分割後に減少したエントロピーの量

23

候補1 候補2

親ノードSj

情報利得: Ij = H(Sj)�|Sl||Sj |H(Sl)�

|Sr||Sj |H(Sr)

H(SL1 ) = �2

4log2

24� 2

4log2

24

= 0.5 + 0.5 = 1.0

H(SR2 ) = �4

4log2

44� 0

4log2

04

= 0.0 + 0.0 = 0.0

H(Sj) = �58

log258� 3

8log2

38

= 0.425 + 0.529 = 0.954

H(SR1 ) = �3

4log2

34� 1

4log2

14

= 0.311 + 0.5 = 0.811

H(SL2 ) = �3

4log2

34� 1

4log2

14

= 0.311 + 0.5 = 0.811

0.5490.0485

I2 = 0.954� 48� 0.811� 4

8� 0.0I1 = 0.954� 4

8� 1.0� 4

8� 0.811

親ノードのエントロピー

候補1のエントロピー

候補2のエントロピー

Page 24: Random Forests

実装上の情報利得

• 親ノードの情報エントロピーは変化しない

→子ノードのエントロピーが最大となる候補を選択→計算コストの削減

24

I1 = 0.954� 48� 1.0� 4

8� 0.811

= 0.0485

I2 = 0.954� 48� 0.811� 4

8� 0.0

= 0.549

Ij = H(Sj)�|Sl||Sj |H(Sl)�

|Sr||Sj |H(Sr)

Ij = � |Sl||Sj |H(Sl)�

|Sr||Sj |H(Sr)

実装上の情報利得

Page 25: Random Forests

分岐ノード決定過程

• 分岐ノード決定シミュレーション‒ 分岐関数:2次元空間を分割する一次関数‒ 3つの分岐関数から最適なものを見つける

x

y

12

3カテゴリ数 : 4サンプル数 : 4 × 33

25

Page 26: Random Forests

分岐ノード決定過程1

• 分岐関数候補1

x

y1

2

3

情報利得 :

Pl (c)

0.01

0.500.490

Pr (c)

0.49

0 0.010.50

エントロピー :

x

y1

Sl Sr

26

H(S) = �C�

c=1

Pc log2 Pc

H(Sl) = 1.10

H(Sr) = 1.10

I = � |Sl||Sj |H(Sl)�

|Sr||Sj |H(Sr)

I1 = �1.10

Page 27: Random Forests

分岐ノード決定過程2

• 分岐関数候補2

x

y1

2

3

Pl (c)

0

0.500.50

0

Pr (c)

0.50

0 0

0.50

x

y 2

Sl Sr

27

I2 = �1.0

H(Sr) = 1.0

H(Sl) = 1.0

情報利得 :

エントロピー : H(S) = �C�

c=1

Pc log2 Pc

I = � |Sl||Sj |H(Sl)�

|Sr||Sj |H(Sr)

Page 28: Random Forests

分岐ノード決定過程3

• 分岐関数候補3

x

y1

2

3

Pl (c)

0

0.460.51

0.03

Pr (c)

0.490.040

0.46

x

y

3

Sl

Sr

28

H(Sl) = 1.16

H(Sr) = 1.21

情報利得 :

エントロピー : H(S) = �C�

c=1

Pc log2 Pc

I = � |Sl||Sj |H(Sl)�

|Sr||Sj |H(Sr)

I3 = �1.185

Page 29: Random Forests

分岐ノード決定過程4

• 分岐ノード決定シミュレーション‒ 分岐関数:2次元空間を分割する一次関数‒ 3つの分岐関数から最適なものを見つける

x

y

12

3

カテゴリ数 : 4サンプル数 : 4 × 33

→分岐関数候補 2 を選択

max

29

I1 = �1.10

I2 = �1.0

I3 = �1.185

Page 30: Random Forests

学習アルゴリズム

30

・前処理− データ集合 S から T 個のサブセット作成

・For t = 1, 2, …, T  サブセットの数だけ木を作成- IF エントロピー H(S)=0 or 指定した深さDに達した

・末端ノード作成- ELSE・分岐関数候補をランダムに K 個選択・ For k = 1, 2, …, K

- 候補 k を用いてサンプルの分割- 候補 k の情報利得算出

・最も情報利得Iが高い候補を選択・単純ベイズ識別器作成

Random Forestsの学習アルゴリズム

Page 31: Random Forests

末端ノードの作成条件

• エントロピー H(S) が0になった時‒ これ以上分岐が出来ないのため終了

• 指定した深さD まで学習が進んだ時‒ 過学習を防ぐため

31

Page 32: Random Forests

エントロピー H(S) が0になる場合

• Sr と Sl に単一カテゴリのサンプルが属する状態になる→ 分岐ができない

x

y

P (c)

1.0

エントロピー :

32

H(S) = �C�

c=1

Pc log2 Pc

H(Sj) = 0.0

Page 33: Random Forests

指定した深さに達する場合

• 木が深くなるほど過学習になる→ 木の深さを制限して対応

x

y

例:最大の深さ3で学習

1

2

3

0

→ 指定した深さに成長したため 末端ノード

33

Page 34: Random Forests

末端ノード作成

• カテゴリの出現確率Pn (c)

‒ サンプル集合Sに付与された教師信号を投票

サブセット St

確率

カテゴリ C34

Page 35: Random Forests

実装上の注意点

• 学習サンプルの各クラスのサンプル数が不均等の場合→ Inverse Label Frequencyが必要

• 学習サンプル I すべてを用いてクラスの頻度分布を作成‒ あるサンプル i ∈ I に付けられているラベルを ciを利用

• カテゴリの頻度分布作成時に重み付け

�c =

��

i�I

[c = ci]

��1

カテゴリ C

頻度

35

Page 36: Random Forests

・前処理− データ集合 S から T 個のサブセット作成

・For t = 1, 2, …, T  サブセットの数だけ木を作成- IF エントロピー H(S)=0 or 指定した深さDに達した

・末端ノード作成- ELSE・分岐関数候補をランダムに K 個選択・ For k = 1, 2, …, K

- 候補 k を用いてサンプルの分割- 候補 k の情報利得算出

・最も情報利得Iが高い候補を選択・単純ベイズ識別器作成

学習アルゴリズム

36

Random Forestsの学習アルゴリズム

Page 37: Random Forests

単純ベイズ識別器の作成

• T 個の決定木をトラバーサル

……tree t1 tree tT

v v

P1(c|v) Pt(c|v)

P (c|v) =1T

T�

t=1

Pt(c|v)識別結果の統合:

単純ベイズ識別器: C�i = arg max

ci

P (ci|v)

+ …… +

Average

=T 87 654 32

1

37

Page 38: Random Forests

Random Forestsによる学習過程

• トイプロブレムを利用して学習過程を観察

・分類問題:3クラス・特徴次元:2次元

・学習パラメータ木の数 1分岐候補 25深さ 4

480

6400

トイプロブレム

38

Page 39: Random Forests

学習過程1

• 深さ1

I :−0.68特徴量  :xしきい値 :393

0 393

ノード

480

640

39

Page 40: Random Forests

学習過程2

• 深さ2

640

480

0 233

I :−0.04特徴量  :xしきい値 :233

ノード

40

Page 41: Random Forests

学習過程3

• 深さ3

480

6400

212

I :−0.23特徴量  :yしきい値 :227

ノード

41

Page 42: Random Forests

学習過程4 (終了)

• 深さ4

480

6400 256 I :0.0特徴量  :xしきい値 :256

ノード

42

Page 43: Random Forests

パラメータ調整のコツ

• 過学習を回避するためには‒ 深さを浅く設定する

• 表現能力をあげるためには‒ 木の数を増やす

• 分岐ノード候補数‒ √特徴次元数 が推奨

• サブセットに分けるデータの数‒ サブセット間で若干重複がある程度の数

43

Page 44: Random Forests

木の数による識別境界の変化

44

Page 45: Random Forests

木の数による識別境界の変化

• 分岐関数の候補数:15

45

木の数:5 木の数:300

→マージン最大化

Page 46: Random Forests

Random Forestsのソースコード

• Random Forestsの学習,識別‒ URL : http://www.vision.cs.chubu.ac.jp/CVTutorial/‒ Dataset : 人工生成サンプル‒ 作成環境 : Visual Studio Ver. 2008, C++‒ 学習プログラム:main_training.cpp‒ 学習パラメータの設定• Learn関数の引数に設定(numTrees, maxDepth, featureTrials, thresholdTrials, dataPerTree)

‒ 識別プログラム:main_evaluate.cpp

46

Page 47: Random Forests

Boosted Random Forest[MIRU2013]

47

•  Random Forest�Boosting����������

!"!##

$%"!##

%!"!##

&%"!##

!#

%!!#

'!!!#

'%!!#

$!!!#

$%!!#

(!!!#

)*+,-.-/0# 1*2*3# 45/*6-/*# 4758*950*# :;*35.*#

!!"#$!"

#$%%&'($!%

&#)

$$<=#$$><=#?@A#B7,5C+.#$$><=#!"#)

��� ��������47%����������

Page 48: Random Forests

まとめ:Random Forests

• Random Forests‒ 決定木を用いたマルチクラス識別器‒ 高速な学習・識別

• Boosted Random Forest

48

Page 49: Random Forests

2. 学習を用いたキーポイントマッチングの高速化- Random Forestsを用いたキーポイントマッチング- 2段階Random Forestsによる高精度化- Ferns

49

Page 50: Random Forests

SIFTアプローチの変遷

Lowe:SIFT

Ke, Sukthankar:PCA-SIFT

頑健性の向上

Mikolajczyk, Schmid:GLOH

頑健性の向上Bay et al.:

SURF

手法の高速化

Sinha, Sudipta:SIFT-GPU

GPU を用いた高速化

高精度

高速

学習なし

1999

2004

2006

2006

2005

Lepetit, Fua:RTs

学習あり

2006

高速・高精度化

50

Page 51: Random Forests

Random Forestsによるキーポイントマッチング [Lepetit’06]

• 決定木を用いたキーポイントの分類‒ 学習• テンプレートをアフィン変換して学習画像を作成• 学習画像すべてからキーポイントを検出• キーポイントを中心とした32×32のパッチを作成• 決定木の構築

‒ 分類によるマッチング• 入力画像からキーポイント検出• キーポイントを中心とした32×32のパッチを作成• 決定木によりキーポイントをマッチング

51

Page 52: Random Forests

学習画像の生成

• 見えの変化に対応するためテンプレートをアフィン変換‒ ランダムなパラメータでアフィン変換行列を作成• 回転,スキュー,平行移動,スケール

( x , y ):テンプレート上の座標( x’ , y’ ):アフィン変換後の座標

52

Page 53: Random Forests

• 学習画像すべてからキーポイントを抽出‒ 逆行列によりテンプレート上の対応するキーポイント算出‒ 同一位置のキーポイント数をカウント‒ 多くの画像から検出されたキーポイントを検出(例:200)→ノイズおよびひずみに安定したキーポイントを選択

アフィン変換に頑健なキーポイント選択

53

Page 54: Random Forests

Random Forestsの構築

・・・学習画像

キーポイント

キーポイント

キーポイント ・・・

・・・

・・・

・・・

サブセット1 サブセット2 サブセットN

≦ >

≦ >

ピクセルの位置はランダムに選択

54

Page 55: Random Forests

キーポイントの分類

テンプレート 入力画像

32×32

+ +( + )  Average =・・・

・・・

Tree1 Tree2 TreeN

≦ > ≦ > ≦ >

c55

Page 56: Random Forests

ノードに利用する特徴量

• 2ピクセルを用いた手法• 4ピクセルを用いた手法• SIFT特徴量を用いた手法 ≦ >

2ピクセル間の輝度

−− ≦ > −−

2ピクセル対(4ピクセル)の輝度差

≦ >

SIFTヒストグラム間の差

56

Page 57: Random Forests

• 2ピクセル間の輝度差

ノードにおける特徴(2ピクセルを用いた手法)

m:ピクセルP:パッチIσ:平滑化後の画像

≦ >

2ピクセル間の輝度

57

Page 58: Random Forests

ノードにおける特徴(4ピクセルを用いた手法)

−− ≦ > −−

• 2つのピクセル対の関係性

2ピクセル対(4ピクセル)の輝度差

m:ピクセルP:パッチIσ:平滑化後の画像

58

Page 59: Random Forests

ノードにおける特徴(SIFT特徴量を用いた手法)

• パッチから得られるSIFT特徴量を使用

u

v o

Bin(u, v, o)

≦ >

SIFTヒストグラム間の差59

Page 60: Random Forests

• 実験データ‒ Title:タイトル領域のキーポイント100個‒ Eyes:画像(目)良識のキーポイント100個

• 比較手法‒ C2:2ピクセルを用いた手法‒ C4:4ピクセルを用いた手法‒ Ch:SIFT特徴量を用いた手法

特徴量の評価実験

Advice on writing a book by Prof. Hartley (ICCV2011) 60

Page 61: Random Forests

• 実験結果‒ 木の数が増えるほど精度が高い‒ C4はC2より精度が低い‒ ChはC2より精度が高いが、計算コストが高い

特徴量の評価結果

C2 C4 Ch

Title set

depth10

depth12

depth15

60.7%

69.2%

77.0%

57.7%

65.1%

73.7%

66.6%

75.0%

82.4%

Eyes set

depth10

depth12

depth15

72.7%

78.6%

84.7%

70.0%

76.1%

81.4%

74.5%

84.2%

84.2%

マッチング精度

61

Page 62: Random Forests

SIFTによるマッチング結果

対応点数:18 正解点数: 562

Page 63: Random Forests

SURFによるマッチング結果

対応点数:25 正解点数:1363

Page 64: Random Forests

Random Forestsによるマッチング結果

対応点数:38 正解点数:3864

Page 65: Random Forests

2. 学習を用いたキーポイントマッチングの高速化- Random Forestsを用いたキーポイントマッチング- 2段階Random Forestsによる高精度化- Ferns

65

Page 66: Random Forests

Random Forestsによるマッチング精度

検出例(70度):1/4 (25%)

検出例(40度):217/217 (100%)

射影変化が大きいと精度が低下66

Page 67: Random Forests

2段階のRandom Forestsによる高精度化 [西村 et al., 2010]

• 学習画像の生成‒ 3次元上の回転を表現

• 決定木の構築‒ 視点変化とキーポイント多様性を同じRandom Forestsで表現

2段階にRandom Forestsを構築

→ 視点の変化とキーポイントの多様性を個々のRandom Forestsで表現

67

Page 68: Random Forests

• オイラー角を用いて3次元上の回転を表現‒ Viewpointをψθφ回転角で定義

前処理:学習画像の生成

Viewpoint

z

68

Page 69: Random Forests

学習画像の生成例

0 36 72 108 144 180 216 251 288 324

45

60

70

φ

ψ=90

θ

69

Page 70: Random Forests

提案手法:2段階のRandom Forests

Keypoint分類結果

学習画像

Viewpointクラス3に分類Tree 1 Tree 2 Tree N1

・・・

Viewpoint分類のためのRandom Forests

入力画像

Viewpointクラス3

Viewpointクラス2

Viewpointクラス1

Tree 1 Tree 2 Tree N2

・・・

Keypoint分類のためのRandom Forests

70

Page 71: Random Forests

提案手法:2段階のRandom Forests

Keypoint分類結果

学習画像

Viewpointクラス1に分類Tree 1 Tree 2 Tree N1

・・・

Viewpoint分類のためのRandom Forests

入力画像

Viewpointクラス3

Viewpointクラス2

Viewpointクラス1

Tree 1 Tree 2 Tree N2

・・・

Keypoint分類のためのRandom Forests

71

Page 72: Random Forests

1段階目:Viewpointの分類

入力画像

セントロイド画像

Viewpointクラス1 3010 20

クラス1に分類

72

Page 73: Random Forests

1段階目:Viewpointの分類

セントロイド画像

クラス12に分類

1 3010 20入力画像Viewpointクラス

73

Page 74: Random Forests

2段階目:キーポイント分類のRandom Forestsの構築

・・・

サブセットTサブセット2

サブセット1:1:1:1

:1

:1:1

Viewpointクラス1

サブセットT2サブセット2

サブセット1:2:2:2

:2:2:2

Viewpointクラス2

サブセットT2サブセット2

サブセット1:K:K:K

:K:K:K

ViewpointクラスK

Tree 1 Tree 2 Tree N2

・・・

Tree 1 Tree 2 Tree N2

・・・

Tree 1 Tree 2 Tree N2

・・・

74

Page 75: Random Forests

2段階目: Keypointの分類結果

提案手法:38/45 (84%)Randomized Trees: 5/7 (71%)

75

Page 76: Random Forests

キーポイントマッチング結果の比較

SIFT:0/1 (0%)

RTs :1/4 (25%) 2段階RTs:23/26 (88%)

ASIFT:276/276 (100%)

76

Page 77: Random Forests

キーポイントマッチング手法の比較

95

90

85

80

75

10 100 1000 10000 100000

処理時間 [ms]

マッチング精度 [%]

2段階RTs ASIFT

SURF

RTs

SIFT

100

70

RFs

キーポイントマッチング(全探索)を決定木分類の問題として解く→高性能化と高速化を同時に実現

77

Page 78: Random Forests

2段階Random Forestsによるキーポイントマッチング

78

Page 79: Random Forests

2. 学習を用いたキーポイントマッチングの高速化- Random Forestsを用いたキーポイントマッチング- 2段階Random Forestsによる高精度化- Ferns

79

Page 80: Random Forests

Random Ferns [Özuysal et al.,2010]

• キーポイント識別に特化させたRandom Forests‒ 決定木のメモリ容量を削減‒ 同じ階層で共通の分岐関数を使用→ 各分岐関数の出力でリーフノードを表現可能

Ferns(シダ植物)

80

f0

f1 f2

f3 f4 f5 f6

f0

f1 f1

f2 f2 f2 f2

f0

f1

f2

Page 81: Random Forests

Random Fernsの構築1

• 分岐関数の出力パターンからクラスの頻度分布を作成‒ 分岐関数はランダムで決定

カテゴリciの学習画像

0

1

0

0 1

1

0

1

1

0

1

1 (011)2 = 3

(101)2 = 5

(010)2 = 2

(011)2 = 3

Fern

カテゴリciの頻度分布

81

0 1 2 3 4 5 6

Page 82: Random Forests

Random Fernsの構築2

• 分岐関数の出力パターンからクラスの頻度分布を作成

・・・

・・・

・・・

・・・

Ferns

Fern 1

Fern 2

Fern T

クラスc1 クラスc2 クラスc3

82

0 1 2 3 4 5 6

0 1 2 3 4 5 6

0 1 2 3 4 5 6

0 1 2 3 4 5 6 0 1 2 3 4 5 6

0 1 2 3 4 5 6 0 1 2 3 4 5 6

0 1 2 3 4 5 6 0 1 2 3 4 5 6

Page 83: Random Forests

Random Fernsの識別

• 各クラス毎に各Fernの頻度を総積して分類

・・・

Ferns

未知入力

(001)2

(101)2

(010)2

1

5

2

最終結果:83

クラスc1 クラスc2 クラスc3

0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6

0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6

0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6

… ……

Page 84: Random Forests

まとめ: キーポイントマッチング

• 学習を用いたキーポイントマッチングの高速化‒ Random Forestsを用いたキーポイントマッチング• SIFTベースの手法より高速・高精度化

‒ 2段階Random Forestsによる高精度化• Viewpontに分けてから分類

‒ Ferns• Random Forestsの軽量化

84

Page 85: Random Forests

85

3. Random Forestsを用いた物体検出- Hough Forests- 事例ベースのRandom Forests

Page 86: Random Forests

Hough Forests [Gall et al., 2011]

• Random Forestsモデルの特定物体検出器

• アイデア‒ 局所パッチを用いた投票により物体重心を推定

• メリット‒ 部分的な遮蔽があっても検出可能

• デメリット‒ スケール変化に対応できない• 入力画像のスケールを変化させて対応

86

Page 87: Random Forests

学習サンプル

• 学習用画像からパッチを抽出‒ 検出対象を含むパッチ:ポジティブサンプル• 物体中心とのオフセットベクトル:di

‒ 背景領域のパッチ:ネガティブサンプル• オフセットベクトルなし

87

ポジティブ ネガティブ

オフセットベクトル学習用画像

重心 切り出し

学習サンプル

Page 88: Random Forests

Hough Forestsの分岐関数

88

• 分岐関数はパッチ内の輝度差を比較‒ 輝度差がしきい値以下の場合は左, それ以外は右に分岐

- > Th

右に分岐分岐ノード

Page 89: Random Forests

分岐関数の決定方法

• 評価関数の値が最小の候補を分岐関数に決定

• 2つの評価関数を階層とサンプル数に応じて選択‒ クラスラベルのエントロピー

‒ オフセットベクトルの分散の値

89

数式

S(v) =

!left i ! In|fj(vi) < tjright otherwise

(1)

S(v) =

!Il i ! In|fj(vi) < tjIr In\Il

(2)

!E (3)

Il = i ! In|fj(vi) < tj (4)

Ir = In\Il (5)

!E = E(In) " |Il||In|

E(Il) "|Ir||In|

E(Ir) (6)

E(I) = "N"

n=1

Pnlog2Pn (7)

p(C = P |S) =1T

T"

t=1

SPt

SPt + SN

t

(8)

U1(A) = |A|("c · logc " (1 " c) · log(1 " c)) (9)

U2(A) ="

i:ci=1

(di " dA)2 (10)

argmink

(U!({pi|tk(Ii) = 0) + U!({pi|tk(Ii) = 0)) (11)

1

数式

S(v) =

!left i ! In|fj(vi) < tjright otherwise

(1)

S(v) =

!Il i ! In|fj(vi) < tjIr In\Il

(2)

!E (3)

Il = i ! In|fj(vi) < tj (4)

Ir = In\Il (5)

!E = E(In) " |Il||In|

E(Il) "|Ir||In|

E(Ir) (6)

E(I) = "N"

n=1

Pnlog2Pn (7)

p(C = P |S) =1T

T"

t=1

SPt

SPt + SN

t

(8)

U1(A) = |A|("c · logc " (1 " c) · log(1 " c)) (9)

U2(A) ="

i:ci=1

(di " dA)2 (10)

argmink

(U!({pi|tk(Ii) = 0) + U!({pi|tk(Ii) = 0)) (11)

1

A : パッチ集合c : Aのポジティブクラスの確率

tk : k番目の分岐関数の候補

FLAB Work Document April 26, 2013 6

Hough ImageV 歩行者検出結果

図 6: 投票処理を用いた歩行者検出

ここで dAはオフセットベクトル diの平均値であるので,U2はオフセットベクトルの分散に相当する.2つの評価関数を用いて,各ノードの分岐関数は以下の手順で選択される.まず,式(2)の分岐関数のプール {tk}を生成する.そして,式 (10)を用いて背景パッチと物体パッチの不確実性が最小となる分岐関数を選択する.

argmink

(U!({pi|tk(Ii) = 0) + U!({pi|tk(Ii) = 0)) (10)

ここで,!は 1か 2のいずれかをランダムに選択することを表している.しかし,入力されるパッチ集合に含まれる背景パッチの数があまりに少ない場合,オフセットの不確実性が最小となるように分岐関数を選択するため !には 2が適用される.また,!に 1と 2を交互に選択することで,末端ノードでは確実に双方の不確実性が減少していると考えられる.このように構築した木を用いてオブジェクトの検出を行う.識別HFによる物体検出では,入力画像に含まれる対象オブジェクトを投票処理により,重心を求めることでオブジェクトを検出することができる.第 1段階により検出された歩行者候補領域から抽出したパッチを各決定木に入力する.末端ノードに到達した,画像中のある位置 yのパッチ I(y)が画像中の異なる位置 xを中心としたオブジェクトに含まれる確率を式 (11)により算出して,木の本数 T で平均する.

p(E(x)|I(y); {Tt}Tt=1) =

1T

!p(E(x)|I(y); Tt) (11)

次に,異なるパッチからの投票を統合するため,図 6に示すように 2次元のHough ImageV に投票を行う.そして,式 (12)により近隣のパッチからの投票をピクセル位置 xごとに総和すると,図 6(a)に示すようになる.

V (x) =!

p(E(x)|I(y); {Tt}Tt=1) (12)

投票した結果から,mean shift等を用いて算出した極大値をその位置をオブジェクトの重心として図 6(b)のように歩行者を検出することができる.

: パッチ画像

dA : Aのオフセットベクトルの平均

pi :サンプル集合

argmink

(U�({pi|tk(Ii) = 0}) + U�({pi|tk(Ii) = 1}))左の子ノードに分岐したサンプル集合

右の子ノードに分岐したサンプル集合

Page 90: Random Forests

末端ノードの作成

• 末端ノードに保存される情報‒ クラス確率 CL

‒ オフセットベクトル d

90

P Nオフセットベクトルクラス確率 CL

・・・・-75

-5075

50

0

0

到達したパッチ

物体中心

Page 91: Random Forests

Hough Forestsの識別

• 入力画像からパッチを抽出‒ 各決定木に入力‒ 決定木の出力を尤度マップに投票‒ mean shift等を用いて物体重心を検出

91

尤度マップ 検出結果

Page 92: Random Forests

事例ベースのRandom Forest [Dahang et al., 2012]

• アイデア‒ テンプレートと未知入力サンプルの距離計算により左右に分岐‒ 学習により最適なテンプレートとしきい値を選択

• メリット‒ 高速な識別• DOT特徴を用いた類似度計算 → SSDによる高速な距離計算• カスケード構造のRandom Forest → 探索空間の削減

92

Page 93: Random Forests

第1段階歩行者候補領域

カスケード構造のRF による歩行者検出器

• 第1段階:Holistic RFにより歩行者候補領域を検出‒ Random Forestsと同じ学習アルゴリズムを使用

• 第2段階:Patch-based RF による歩行者検出‒ Hough Forestsと同じ学習アルゴリズムを使用

93

入力画像 第2段階歩行者検出結果

Page 94: Random Forests

DOT特徴量 [Hinterstoisser et al., 2010]

• DOT特徴を使用‒ 局所領域の離散的な勾配方向毎に勾配強度をバイナリコード化• 最上位ビットは注目画素が垂直の場合1, それ以外は0

94

τ

01000 1 11

入力画像 セル 勾配方向ヒストグラム

バイナリ化

Page 95: Random Forests

分岐関数の設計

• テンプレートとサンプルの距離計算により左右に分岐‒ Holistic RFとPatch-based RFで同じ分岐関数を使用

95

:左に分岐:右に分岐

分岐関数:

FLAB Work Document April 26, 2013 2

p(E(x)|I(y); {Tt}Tt=1) =

1T

!p(E(x)|I(y); Tt) (12)

V (x) =!

p(E(x)|I(y); {Tt}Tt=1) (13)

d

CL

"F (S, Ti) < !i

otherwise(14)

S : 未知サンプルTi : テンプレートτi : しきい値

未知サンプル

テンプレート

テンプレートのバイナリコード

AND演算子

未知サンプルのバイナリコード

FLAB Work Document April 26, 2013 2

p(E(x)|I(y); {Tt}Tt=1) =

1T

!p(E(x)|I(y); Tt) (12)

V (x) =!

p(E(x)|I(y); {Tt}Tt=1) (13)

d

CL

"F (S, Ti) < !i

otherwise(14)

T

SNt

SPt

F (S, T ) =!

P Sd !S

P Td !T

"(P sd ! P T

d "= 0)   d = 1, 2, · · · , n (15)

FLAB Work Document April 26, 2013 2

p(E(x)|I(y); {Tt}Tt=1) =

1T

!p(E(x)|I(y); Tt) (12)

V (x) =!

p(E(x)|I(y); {Tt}Tt=1) (13)

d

CL

"F (S, Ti) < !i

otherwise(14)

T

SNt

SPt

F (S, Ti) =!

P Sd !S

P Td !T

"(P sd ! P T

d "= 0)   d = 1, 2, · · · , n (15)

PSd

P Td

PS1

P T1

PS2

P T2

PS3

P T3

PS55

P T55

"=

n : セルの数

00010 0 00 ≠ 0δ( )

01010 0 10P2S

10110 1 00P2T

FLAB Work Document April 26, 2013 2

p(E(x)|I(y); {Tt}Tt=1) =

1T

!p(E(x)|I(y); Tt) (12)

V (x) =!

p(E(x)|I(y); {Tt}Tt=1) (13)

d

CL

"F (S, Ti) < !i

otherwise(14)

T

SNt

SPt

F (S, T ) =!

P Sd !S

P Td !T

"(P sd ! P T

d "= 0)   d = 1, 2, · · · , n (15)

1

分岐ノード

Page 96: Random Forests

歩行者検出の結果例

96

人が密集するような状況においても高精度に検出

[Dahang et al., 2012]

Page 97: Random Forests

4. Random Forestsを用いた人体姿勢推定- 距離測定カメラと距離画像- Random Forestsを用いた人体姿勢推定

97

Page 98: Random Forests

人体姿勢推定の動向

• モーションキャプチャ‒ リアルタイムで様々な運動を行う人体の形状・サイズ全ての取得は不可能

‒ 高速に取得は可能だが,再初期化や頑健な認識が困難‒ 距離測定カメラは一般的に高価

• KINECT‒ 高速,高精度,低計算コストで深度画像を取得• 再初期化の処理が不必要

‒ 低価格

98

Page 99: Random Forests

距離測定カメラ

• TOF方式‒ 赤外光の反射時間

• パターン照射方式‒ 赤外光パターンを照射し解析

スイスmesa社 PMDTec パナソニック

Microsoft Kinect Xtion Pro99

XBOX ONE(2013)

Page 100: Random Forests

TOF(Time of Flight)カメラ

• TOF(飛行時間)方式‒ LED光源を変調させ、CCD/CMOS イメージセンサは各画素ごとに反射してきた変調信号の位相を計測

‒ 各画素の距離は変調信号の周期の分数として定義

Principles of ToF Imaging

13

Continuous Wave Modulation• Continuous light waves instead of short light pulses• Modulation in terms of frequency of sinusoidal waves• Detected wave after reflection has shifted phase• Phase shift proportional to distance from reflecting surface

Emitter

Detector

continuous wave

3D Surface

...

...

20 MHz

... ...

Phase Meter

phase shift

100

Page 101: Random Forests

KINECTカメラ

Picture from the Artist Audrey PenvenKINECT照射パターン

• パターン照射方式‒ プロジェクションパターンの斑点間の幅を用いて三角測量により3次元形状を計測

101

Page 102: Random Forests

距離画像

• メリット‒ 暗闇においても距離情報を取得可能‒ テクスチャ情報がないため,プライバシー保護に最適

距離画像カラー画像

102

Page 103: Random Forests

Random Forestsによる人体姿勢推定 [Shotton et al.,2011]

• 単一の深度画像からの人体姿勢認識‒ 高速、高精度、低計算コスト‒ 応用先:NUI (Natural User Interface)

出力:3次元間接位置(姿勢)入力:単一の深度画像

103

Page 104: Random Forests

手法の流れ

1.深度画像から人体を検出(背景差分)

2. 人体をパーツ分割3.関節の3次元位置を取得

104

Page 105: Random Forests

アプローチ

1.人体パーツの学習データ‒ 様々な姿勢の人体深度データを人工的に生成

2. 人体パーツ識別・姿勢推定‒ 高速に計算可能な特徴量‒ Random Forests識別器による人体パーツ識別

105

Page 106: Random Forests

CGによる人体データの生成

• CGにより生成する人体形状データ‒ Autodesk MotionBuilder内の3Dメッシュデータを利用• 15種類の素体データ

※ パーツの学習用に色分け済み

Autodesk MotionBuilder

106

Page 107: Random Forests

人体モデルにモーションを付加

• モーションキャプチャデータ‒ mocap(CMU): http://mocap.cs.cmu.edu/• 特定の運動時の各関節の角度データ• 100,000データ

107

Page 108: Random Forests

学習データの自動生成

• 学習データの生成の流れ‒ Autodesk MotionBuilderより素体を選択

‒ 素体の各関節にモーションキャプチャのデータを設定し,3Dメッシュを変形• 色々なパラメータをランダムに設定

‒ 身長・幅・形状・カメラ姿勢・カメラノイズ・衣服・髪など

‒ 3Dメッシュをレンダリングし,深度バッファを取得人体データ

モーションデータ

Autodesk MotionBuilder

学習データ108

Page 109: Random Forests

• 注目点周辺の2点間の深度の差

深度の差に基づく特徴量

������

����

�����

����

����� ������

:注目ピクセル :差分を求める選択した2点

θ1 :距離差が大きい(背景と体)θ2 :距離差が大きい(背景と腕)

θ1 : 距離差が小さい(頭と体)θ2 : 距離差が小さい(腕や足等の細い部位)

������

����

�����

����

����� ������

109

Page 110: Random Forests

Random Forests による識別器の学習

• 生成した人体パーツ画像データを学習‒ 学習の入力:1画素毎単位の特徴量 + 正解人体パーツラベル

���1���

学習サンプル

深度画像 パーツのラベル

各ノードでθとτを決定

110

Page 111: Random Forests

各画素毎の人体パーツ推定結果

Figure 9. Example results from the Ganapathi et al. test set. This test set contains one actor from a low fixed camera viewpoint (whichmakes the actor appear to be leaning backwards). Our system can accurately localize body joints despite being designed for a differentdepth camera. Quantitative comparison in main paper.

Figure 9. Example results from the Ganapathi et al. test set. This test set contains one actor from a low fixed camera viewpoint (whichmakes the actor appear to be leaning backwards). Our system can accurately localize body joints despite being designed for a differentdepth camera. Quantitative comparison in main paper.

Figure 9. Example results from the Ganapathi et al. test set. This test set contains one actor from a low fixed camera viewpoint (whichmakes the actor appear to be leaning backwards). Our system can accurately localize body joints despite being designed for a differentdepth camera. Quantitative comparison in main paper.

Figure 9. Example results from the Ganapathi et al. test set. This test set contains one actor from a low fixed camera viewpoint (whichmakes the actor appear to be leaning backwards). Our system can accurately localize body joints despite being designed for a differentdepth camera. Quantitative comparison in main paper.

111

Page 112: Random Forests

関節の3次元位置推定

• 各パーツごとに関節の3次元位置を推定‒ 密度推定を行い,最頻値を推定• ミーンシフトベースの手法を利用

カーネル密度推定(パーツクラスcに対する)

:3次元空間中の位置(画像上の位置 に対応)

112

Page 113: Random Forests

人体姿勢推定

Xbox 360 GPU上で5ms/frame以下 (200FPS) で動作

113

Page 114: Random Forests

5. Regression Forests - 回帰分析への応用 -

114

Page 115: Random Forests

• Regression Forests• 学習アルゴリズム- 回帰木の作成- 分岐ノードの決定

• 回帰- 予測の統合

• 最小二乗法との比較- UCI Machine Learning Repository を用いた比較

• CV分野への応用

115

Page 116: Random Forests

Random ForestsとRegression Forests

• Random Forests : クラス分類問題‒ 決定木:クラス確率を保持‒ 入力 : 連続変数‒ 出力 : カテゴリごとの確率

• Regression Forests : 回帰問題‒ 回帰木:回帰係数を保持‒ 入力 : 連続変数‒ 出力 : 連続変数

116

Random Forests Regression Forests

Page 117: Random Forests

117

回帰分析

?

x

y

学習サンプル未知入力サンプル

y

u

x

?

線形モデル

y = a+ bx

y = a+ bx+ cu

回帰直線 回帰平面

出力

入力

出力

入力

• 入力変数から出力変数の値を予測• 線形,非線形などの回帰モデル‒ 回帰係数を最小二乗法などで求める問題

Page 118: Random Forests

Regression Forestsとは

• 目的‒ 高精度な回帰分析‒ 線形,非線形な回帰

• メリット‒ 予測モデルにより様々な回帰分析が可能

• デメリット‒ 最小二乗法による線形回帰より学習に時間が必要

118

Page 119: Random Forests

学習アルゴリズム

• 前処理‒ サンプル集合をサブセットに分割

• 回帰木の作成‒ 分岐ノードの学習‒ 末端ノードの作成‒ 予測モデル

119

Page 120: Random Forests

前処理

• Random Forestsと同様にサブセットを作成‒ ランダムサンプリングによって任意の数のサンプルを抽出‒ サブセット間の重複は許容

120

サブセット S1 サブセット S2 サブセット ST

サンプル集合 S

Page 121: Random Forests

回帰木の作成

• サブセットを用いて回帰木を作成‒ 分岐ノード• サンプルの特徴量としきい値の比較しサンプルを左右に分岐

‒ 末端ノード• 辿り着いた学習サンプルを回帰分析した結果を保存

121

分岐ノード

末端ノード

Page 122: Random Forests

• ランダムに特徴次元としきい値を選択

• 目的関数を最大にする特徴次元としきい値を選択

分岐ノードの決定過程

122

Ij =�

(x,y)�Sj

(y � yj)2 ��

i=L,R

��

(x,y)�Sij

(y � yj)2�

現在のノード における分散

目的関数

子ノードの和

子ノード の分散j jL, jR

y

x

y

出力

入力

1 2 3

jLjR

j

Sj

SLj

SRj

Page 123: Random Forests

分岐ノード決定過程1

• 候補1の目的関数の評価値を算出‒ 分割したサンプル集合を用いて についての分散を算出

123

候補1によりサンプルを分割

�2L = 6.0

�2R = 12.0

y

L Rx

y

出力

入力

1 2 3

x

y 1

Page 124: Random Forests

分岐ノード決定過程2

• 候補2の目的関数の評価値を算出‒ 分割したサンプル集合を用いて についての分散を算出

124

�2L = 11.3

y

候補2によりサンプルを分割

�2R = 12.0

L Rx

y

出力

入力

1 2 3 y 2

x

Page 125: Random Forests

分岐ノード決定過程3

• 候補3の目的関数の評価値を算出‒ 分割したサンプル集合を用いて についての分散を算出

125

�2L = 20.1

�2R = 0.6

y

L Rx

y

出力

入力

1 2 3

x

y 3

候補3によりサンプルを分割

Page 126: Random Forests

31

分岐ノード決定過程4

• 目的関数が最大となる分岐関数に決定

126

→末端ノードを作成する条件を満たすまで分岐を繰り返す

I1 = 35.8� (6.0 + 12.0) = 17.8

I2 = 35.8� (11.3 + 0.8) = 23.7

I3 = 35.8� (20.1 + 0.6) = 15.1x

y

出力

入力

1 2 3

Page 127: Random Forests

末端ノードの作成

• 一定の条件に達した場合に末端ノードを作成‒ 深さ,到達したサンプル数....etc.

• 到達したサンプルを用いて回帰分析‒ 回帰係数を保存

127

保存

x

y

出力

入力

Page 128: Random Forests

回帰

• 未知入力サンプルを各回帰木に入力‒ 辿り着いた末端ノードの回帰係数を用いて予測値を出力

128

y =1T

T�

t=1

yt→各回帰木の出力を合成

・・・

y1 y2

yT

Page 129: Random Forests

回帰木の統合(tree1)

• 平均モデルを用いたRegression Forestsによる回帰

129

100

150

200

250

300

0 50 100 150 200 250 300 350 400

Y

X

train sample

tree1

Page 130: Random Forests

回帰木の統合(tree2)

• 平均モデルを用いたRegression Forestsによる回帰

130

100

150

200

250

300

0 50 100 150 200 250 300 350 400

Y

X

train sample

tree2

Page 131: Random Forests

回帰木の統合(tree3)

• 平均モデルを用いたRegression Forestsによる回帰

131

100

150

200

250

300

0 50 100 150 200 250 300 350 400

Y

X

train sample

tree3

Page 132: Random Forests

100

150

200

250

300

0 50 100 150 200 250 300 350 400

Y

X

train sample

tree4

回帰木の統合(tree4)

• 平均モデルを用いたRegression Forestsによる回帰

132

Page 133: Random Forests

100

150

200

250

300

0 50 100 150 200 250 300 350 400

Y

X

train sample

tree5

回帰木の統合(tree5)

• 平均モデルを用いたRegression Forestsによる回帰

133

Page 134: Random Forests

100

150

200

250

300

0 50 100 150 200 250 300 350 400

Y

X

train sampleoutputtree1tree2tree3tree4tree5

回帰木の統合(Regression Forests)

• 平均モデルを用いたRegression Forestsによる回帰

134

Page 135: Random Forests

回帰モデル

• 末端ノードの回帰モデルは自由に設計‒ 平均• サンプル集合の目的変数の平均値を予測とする

‒ 線形回帰• 最小二乗法などを用いて線形回帰

‒ 確率的線形回帰• 線形回帰+分散による信頼性の算出

135

x

y

平均x

y

線形x

y

確率的線形計算コスト 小 大回帰精度 低 高

Page 136: Random Forests

回帰モデル:平均モデル

136

0

50

100

150

200

250

300

350

400

0 50 100 150 200 250 300 350 400

Y

X

outputtrain sample

• 木の数:5,木の深さ:10

Page 137: Random Forests

0

50

100

150

200

250

300

350

400

0 50 100 150 200 250 300 350 400

train sampleoutput

Y

X

回帰モデル:線形モデル

137

• 木の数:5,木の深さ:2

Page 138: Random Forests

回帰モデル:確率的線形モデル

138

• 木の数:10,木の深さ:2

0

50

100

150

200

250

300

350

400

0 50 100 150 200 250 300 350 400

train sampleoutput

kukan +kukan -

Y

X

→サンプルの分散に基づき回帰の信頼性を表現

Page 139: Random Forests

実データを用いた最小二乗法との比較

• 最小二乗法とRegression Forestsの比較• UCI Machine Learning Repositoryのデータセット‒ 機械学習のベンチマークデータセット‒ URL : http://archive.ics.uci.edu/ml/‒ 回帰,クラス分類問題などを扱う‒ Dataset : Concrete Compressive Strength Data Set• 目的変数:コンクリートの強度(1次元)• 従属変数:8次元の実数• サンプル数:1030

139

Page 140: Random Forests

Regression Forestsと最小二乗法の比較

• 木の学習パラメータ‒ 木の数 : 5, 10‒ 木の本数 : 5. 10‒ サブセットのサイズ : 1.0

• 残差の2乗和を比較

140

→残差を大幅に減少

Page 141: Random Forests

人体の向き推定

• 10度毎に学習し5度毎に評価• 平均モデル‒ 5クラスに分けてRandom Forestを学習‒ 末端ノードはラベルの平均値を保存

• 線形モデル‒ Regression Forestにより学習‒ 末端ノードは最小二乗法による回帰予測を保存

141-90° -45° 0° 45° 90°

Page 142: Random Forests

平均モデルと線形モデルの推定結果例

• 人体姿勢推定‒ 10度刻みの角度で学習

142

0.00

2.00

4.00

6.00

8.00

10.00

12.00

14.00

16.00

-100 -80 -60 -40 -20 0 20 40 60 80 100 人体の向き [deg]

平均誤差[deg]

Page 143: Random Forests

CV分野への応用1

• 距離画像からの人体姿勢推定 [Girshick R. et al., 2011]

‒ Regression Forestにより,直接関節の三次元位置を回帰して推定‒ 入力:距離画像の2点間の距離差( [Shotton et al., 2011]と同じ) ‒ 出力:人体の関節3次元位置

143

Page 144: Random Forests

CV分野への応用2

• Conditional Regression Forestsによる顔向き推定と顔特徴点の推定 [Dantone, M. et al., 2012]

‒ 入力:パッチ(Haar-like特徴:領域間の輝度差)‒ 出力:顔向き,器官位置

144

Real-time Facial Feature Detection using Conditional Regression Forests

Matthias Dantone1 Juergen Gall1,2 Gabriele Fanelli1 Luc Van Gool1,31ETH Zurich, Switzerland 2MPI for Intelligent Systems, Germany 3KU Leuven, Belgium{dantone,fanelli}@vision.ee.ethz.ch [email protected] [email protected]

Abstract

Although facial feature detection from 2D images is awell-studied field, there is a lack of real-time methods thatestimate feature points even on low quality images. Here wepropose conditional regression forest for this task. Whileregression forest learn the relations between facial imagepatches and the location of feature points from the entireset of faces, conditional regression forest learn the relationsconditional to global face properties. In our experiments,we use the head pose as a global property and demonstratethat conditional regression forests outperform regressionforests for facial feature detection. We have evaluated themethod on the challenging Labeled Faces in the Wild [20]database where close-to-human accuracy is achieved whileprocessing images in real-time.

1. IntroductionDue to its relevance for many applications like human

computer interaction or face analysis, facial feature pointdetection is a very active area in computer vision [1, 3,24, 25, 29]. Recent state-of-the-art methods like [3] havereported impressive results where localization accuracy ofhuman annotators has been achieved on images of mediumquality. However, most of the available methods do notachieve real-time performance which is a requirement formany applications. Furthermore, low quality images stillchallenge state-of-the-art algorithms.

In recent years, regression forests [4] have proven to be aversatile tool for solving challenging computer vision tasksefficiently. In this domain, regression forests learn a map-ping from local image or depth patches to a probability overthe parameter space, e.g., the 2D position or the 3D orien-tation of the head. While related Hough forests [16] detectobjects in 2D images efficiently, real-time methods for poseestimation [12, 17] rely on depth data and an abundance ofsynthetic training data.

In this work, we present a method based on regressionforests that detects 2D facial feature points in real-time asexemplified by Fig. 1. Since regression forests learn the

Figure 1. Our approach estimates facial feature points from 2Dimages in real-time.

spatial relations between image patches and facial featuresfrom the complete training set and average the spatial dis-tributions over all trees in the forest, the forests tend to in-troduce a bias to the mean face. This is very problematicfor facial feature detection since subtle deformations affectonly the image appearance in the neighborhood of a specificfeature point. In order to steer the impact of patches close toa facial feature, which adapt better to local deformations butare more sensitive to occlusions, and more distant patchesthat favor the mean face, we introduce an objective functionthat allows to find a good trade-off.

Another contribution of this work is the introduction ofconditional regression forests. In general, regression forestsaim to learn the probability over the parameter space givena face image from the entire training set, where each treeis trained on a randomly sub-sampled training set to avoidover-fitting. Conditional regression forests aim to learn sev-eral conditional probabilities over the parameter space in-stead. The motivation is that conditional probabilities areeasier to learn since the trees do not have to deal with allfacial variations in appearance and shape. Since some vari-

1

Page 145: Random Forests

複数パスを考慮したRegression Forestsによるカメラのヨー角の推定

• Regression Forests:回帰木を構築して回帰分析を解くアプローチ  トラバーサル時にノイズの特徴次元を参照すると分岐が反転‒ ノイズにより推定精度の低下

145

ノイズによる分岐の反転で推定精度が低下 複数のパスによりノイズの影響を低減

従来法

提案手法

Page 146: Random Forests

複数パスを考慮したRegression Forestsによるカメラのヨー角の推定

146

ノイズに対して頑健な回帰推定を実現

推定したヨー角からの距離算出結果

ヨー角の推定結果

平均誤差 誤差の分散

RegF 0.031 0.0007

提案手法 0.027 0.0004

ノイズが40%の状態では8%の精度向上

Page 147: Random Forests

6. Random Forestsの他の問題設定への適用- Density Forests - 密度推定 -- Semi-supervised Forests - 半教師付き学習 -

147

Page 148: Random Forests

Density Forestsとは

• 目的‒ Forestモデルを用いたサンプル集合の密度推定

• メリット‒ 複雑な問題に対し柔軟な密度推定が可能

148

Page 149: Random Forests

Random ForestsとDensity Forests

• Random Forests : クラス分類問題‒ 決定木:クラス確率を保持‒ 入力 : 連続変数‒ 出力 : カテゴリごとの確率

• Density Forests : 密度推定問題‒ 密度木:密度分布を保持‒ 入力 : 連続変数‒ 出力 : 推定密度

149

Random Forests Density Forests

Page 150: Random Forests

密度木の作成

• サンプル集合を用いて密度木を作成‒ 分岐ノード• サンプルの特徴量としきい値の比較しサンプルを左右に分岐

‒ 末端ノード• 辿り着いた学習サンプル集合の密度分布を保存

150

分岐ノード

末端ノード

Page 151: Random Forests

• ランダムに特徴次元としきい値の候補を選択

• 候補の中から目的関数を最大にするものを選択‒ ラベルがないため正規分布のエントロピーを利用

分岐ノードの学習

151

目的関数 Ij = log(|�(Sj)|)��

i�{L,R}

|Sij |

|Sj | log(|�(Sij)|)

SRj

Sj

SLj

1

2

j

jL jR

親のノード の正規分布のエントロピー 子ノード の正規分布のエントロピー

x1

x2

j jL, jR

Page 152: Random Forests

1

2

分岐ノード決定過程1

• 候補1の目的関数の評価値を算出

152

候補1によりサンプルを分割

L R

1

I1 = 5.67 − 1.25 +1.30( ) = 3.12

Sj SLj SR

j

x1

x2

x1

x2

Page 153: Random Forests

1

2

分岐ノード決定過程2

• 候補2の目的関数の評価値を算出

153

候補2によりサンプルを分割

L

R

2

Sj

SRj

SLj

x1

x2

x1

x2

I2 = 5.67 − 2.35 + 2.13( ) =1.19

Page 154: Random Forests

分岐ノード決定過程3

• 目的関数が最大となる分岐関数に決定→ 候補1の方が情報利得が大きくなる

154

→末端ノードを作成する条件を満たすまで分岐を繰り返す€

I1 = 5.67 − 1.25 +1.30( ) = 3.12

I2 = 5.67 − 2.35 + 2.13( ) =1.19

1

2

Sj

x1

x2

Page 155: Random Forests

末端ノードの作成

• 終了条件(深さ,到達したサンプル数....etc. )• 到達したサンプル集合を用いて密度分布を算出‒ すべての末端ノードの密度分布情報を保存

155

µ, Λ保存

:密度分布

µ, Λ保存µ, Λ保存 µ, Λ保存

:サンプル

Page 156: Random Forests

• 各ノードに到達した学習サンプルはひとつの多変量正規分布        にまとめられる‒ 正規分布の重なりを考慮し分配関数 を用いて正規化

‒ 高次元な の計算は困難であるため近似を行う

分配関数

156一本の木から得られる密度分布

: 積分の間隔

: 各末端ノードに到達したサンプルの割合: 各末端ノードに到達した各次元の平均値: 各末端ノードの共分散行列

: 入力サンプル

間隔を狭くする事で近似はより正確になる

Page 157: Random Forests

アンサンブルモデル

• サンプル集合を密度木に入力‒ 辿り着いた末端ノードの密度分布を用いて推定密度を出力

157

pT (v)p2(v)p1(v)

tree 1 tree 2 tree T

→各密度木の出力を合成 p(v) =1T

T�

t

pt(v)

+

++

/T

・・・

Average

各木の出力:

サンプルの割合

分配関数 末端ノードの正規分布

Page 158: Random Forests

Density Forests による密度推定結果

158

入力データ

Den

sity

For

ests

Page 159: Random Forests

• 個々の木の出力では特徴をとらえきれてないが木の出力を合成することで滑らかな密度推定が可能

アンサンブルモデルの効果

159

tree 1 tree 2 tree T€

+

++

/T =

各treeの出力 forestsの出力

Page 160: Random Forests

6. Random Forestsの他の問題設定への適用- Density Forests - 密度推定 -- Semi-supervised Forests - 半教師付き学習 -

160

Page 161: Random Forests

Semi-supervised とは

• supervised:教師あり学習‒ すべてのサンプルにラベルがある

• unsupervised:教師なし学習‒ すべてのサンプルにラベルが無い

• semi-supervised:半教師あり学習‒ ラベル付きの小規模なサンプル集合とラベル無しの大規模なサンプル集合が混合

‒ 代表的な手法• トランスダクティブサポートベクターマシン(TSVM)

161

Page 162: Random Forests

• 識別性能を向上するためラベル付けされていないサンプルを有効に活用‒ トランスダクティブ学習を行う

Semi-supervised learning

162

部分的にラベル付けされたサンプル ラベルの伝播

:ラベル付きサンプル

:ラベル無しサンプル

識別境界

vl

vu

Page 163: Random Forests

Semi-supervised Forests

• 教師あり学習と密度推定の両方の考え方を利用‒ ラベル付きサンプルの情報利得とラベル付き,ラベル無しサンプル集合の正規分布のエントロピーにより分割

‒ ラベルなしサンプルにラベルを伝播• クラス確率を定義

163

クラス確率 密度

+Random Forests Density Forests

Page 164: Random Forests

分岐ノードの選択

• 目的関数を最大とする組み合わせ情報利得により学習サンプルの分類と高密度領域を分割

164

教師あり:

教師なし:

従来の分類木のようにクラス確率のエントロピーにより算出

密度推定と同様に正規分布のエントロピーにより算出

ラベル付きデータのみを用いる

ラベル付き,ラベル無し両方のデータを用いる

:ユーザーで定義される変数間の相対的な重み目的関数:

Page 165: Random Forests

• 目的関数を最大とする組み合わせ情報利得により学習サンプルの分類と高密度領域を分割

分岐ノードの選択

165

→ラベル付きサンプルのクラス確率のエントロピーが小さく 全てのサンプルの正規分布のエントロピーが小さいものが選択される

:ユーザーで定義される変数間の相対的な重み目的関数:

Page 166: Random Forests

Semi-supervised Forestsの構築

• 末端ノードに各次元の平均値と共分散行列を保存

166

µ, Λ保存µ, Λ保存

Tree 1 Tree T

学習サンプル

...

Page 167: Random Forests

ラベルの伝播

• ラベル無しサンプルとの測地線距離が最小となるラベル付きサンプルのラベルを伝播

167

:クラス

:測地線距離

測地線距離 :測地線パス:測地線パスの長さ:すべての測地線パス

:初期点,終了点

局所距離(マハラノビス距離)

:各ポイントの距離

:  によって末端ノードの共分散行列

Page 168: Random Forests

• サンプルにラベルを伝播した結果を用いて末端ノードにクラス確率    を定義‒ 帰納的にforestの構築を行うため新しい分類器の学習は不要

帰納

168

Tree 1 Tree T

...

Page 169: Random Forests

Semi-supervised ForestsとSVM,TSVMの比較

169

Semi-Supervised Forest

SVM TSVM入力データ

[Criminisi et al., 2011]

Page 170: Random Forests

Semi-supervised Forests による分類結果

170

[Criminisi et al., 2011]

入力データ 深さD=6 深さD=10

ラベル付きデータ数

4個(各クラス1個)

ラベル付きデータ数

8個(各クラス2個)

Page 171: Random Forests

チュートリアル資料:Random Forests[Criminisi et al., 2011]

• Classification, Regression, Density Estimation, Manifold Learning and Semi-Supervised Learning

チュートリアル: http://research.microsoft.com/en-us/groups/vision/decisionforests.aspx

171

Page 172: Random Forests

参考文献1

1. Random Forests- [Breiman, 2001] L. Breiman, "Random Forests.", Machine Learning 45 (1): 5‒32, 2001.

- [Lepetit et al., 2006] V. Lepetit and P. Fua, “Keypoint Recognition using Randomized Trees”, IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. 28, Nr. 9, pp. 1465-1479, 2006.

- [Shotton et al., 2008] J. Shotton, M. Johnson, R. Cipolla, “Semantic Texton Forests for Image Categorization and Segmentation.”, In Proc. IEEE CVPR 2008.

- [Amit & Geman, 1997] Y. Amit and D. Geman Y, “Shape Quantization and Recognition with Randomized Trees”, Neural Computation, vol. 9, pp. 1545-1588, 1996

- [Moosmann et al., 2006] F. Moosmann, B. Triggs, and F. Jurie, “Fast Discriminative Visual Codebooks using Randomized Clustering Forests.”, In NIPS, 2006.

- [山下 et al., 2010] 山下隆義, 山内悠嗣, 藤吉弘亘, "Boosted Randomized Trees による人物検出と行動の同時認識", 第13回画像の認識・理解シンポジウム(MIRU2010), 2010.

- [Geurts et al., 2006] P. Gurts, D. Ernst, and L. Wehenkel, “Extremely Randomized Trees”, Machine Learning, vol. 63, issue 1, pp. 3-42, 2006. 172

Page 173: Random Forests

参考文献1

2. 学習を用いたキーポイントマッチングの高速化- [西村 et al., 2010] 西村孝, 清水彰一, 藤吉弘亘, "2段階のRandomized Treesを用いたキーポイントの分類", 第13回画像の認識・理解シンポジウム(MIRU2010), 2010.

- [Özuysal et al.,2010] M. Özuysal, M. Calonder, V. Lepetit, P. Fua, “Fast Keypoint Recognition using Random Ferns” IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. 32, Nr. 3, pp. 448 - 461, 2010.

3. Random Forestsを用いた物体検出- [Gall et al., 2011] J.Gall, A.Yao, N.Razavi, L.Van Gool, and V. Lempitsky, “Hough forests for object detection, tracking and action recognition”, IEEE Transactions on Pattern Analysis and Machine Itelligence, vol. 33, no. 11, pp. 2188-2202, 2011.

- [Dahang et al., 2012] Tang Danhang, Yang Liu, and Tae-Kyun Kim. “Fast Pedestrian Detection by Cascaded Random Forest with Dominant Orientation Templates”, BMVC, pp. 58.1-58.11, 2012

- [Hinterstoisser et al., 2010] S.Hinterstoisser, V. Lepetit, S. llic, P. Fua, and N. Navab, “Dominant Orientation Templates for Real-Time Detection of Texture-Less Objects”, IEEE Computer Society Conference on Computer Vision and Pattern Recognition, 2010.

173

Page 174: Random Forests

参考文献3

4. Random Forestsを用いた人体姿勢推定- [Shotton et al., 2011] Jamie Shotton, Andrew Fitzgibbon, Mat Cook, Toby Sharp, Mark Finocchio, Richard Moore, Alex Kipman, Andrew Blake,”Real-Time Human Pose Recognition in Parts from Single Depth Images”,Computer Vision and Pattern Recognition,vol.2,pp.1297-1304,2011.

- [Criminisi et al., 2011] A. Criminisi, J. Shotton, and E. Konukoglu, Decision Forests for Classification, Regression, Density Estimation, Manifold Learning and Semi-Supervised Learning, no. MSR-TR-2011-114, 28 October 2011.

5. Regression Forests- [Girshick R. et al., 2011] Girshick R., Shotton J., Kohli P., Criminisi A., and Fitzgibbon A., “Efficient regression of general-activity human poses from depth images”, Computer Vision (ICCV), 2011 IEEE International Conference on, 415 -422, 2011.

- [Dantone, M. et al., 2012] Dantone M., Gall J., Fanelli G., and Van Gool L., “Real-time facial feature detection using conditional regression forests”, Computer Vision and Pattern Recognition (CVPR), 2012 IEEE Conference on, 2578 -2585, 2012.

174

Page 175: Random Forests

プログラム解説

• プログラム構成‒ main_training.cpp (学習のメイン関数)‒ main_evaluate.cpp (識別のメイン関数)‒ rts_forest.cpp (RFの生成・走査に関する処理関数)‒ rts_tree.cpp (決定木の生成・走査に関する処理関数)‒ rts_forest.hpp (決定木のパラメータに関するヘッダ)‒ rts_tree.hpp (決定木の生成・走査に関するヘッダ)‒ rts_feature.hpp (特徴量を格納するクラスが書かれたヘッダ)‒ rts_node.hpp (各ノードの情報を格納するクラス)‒ rts_sample.hpp (各サンプルの特徴ベクトルとラベルを格納するクラス)

175

Page 176: Random Forests

データ構造

• サンプル‒ 特徴ベクトル• Feature feature_vec(vector型float配列);

‒ 教師信号• int label;

• ノード‒ int feature_id; // feature ID‒ float threshold; // threshold‒ float *distribution; // distribution histogram‒ Node *lChild; // left Child node‒ Node *rChild; // right Child node

176

Page 177: Random Forests

プログラム解説

177

rts_forest rts_tree・サブセットの生成・決定木の生成・末端ノードの生成・決定木の情報の保存

main_training・サンプル入力・Forest の学習

・分岐関数の選択・末端ノードの生成

・ノードの書き出し

サブセット決定木のパラメータ

- 教師信号の投票-出現確率の正規化

サンプル集合

rts_forest rts_tree・決定木による識別・決定木の出力を統合

main_evaluate・Forest の読込み・サンプルの読込み・識別

・決定木の走査

学習

識別サンプル

サンプル集合

末端ノードのクラス確率

特徴ベクトル

サンプル集合決定木のパラメータ

Forest 全体のクラス確率

Page 178: Random Forests

rts_forest.cpp

178

Learn - サンプルから Forest を生成する関数 - 引数 : 決定木のパラメータとサンプル集合 - tree の BuildTree, BuildHistgramを呼び出し

EstimateClass - 未知入力サンプルの識別を行う関数 - 引数 : 識別サンプル (特徴ベクトル ) - tree の Traversal を呼び出し

Save - Forest を保存する関数 - 引数 : ファイル名 - tree の Save を呼び出し

Load - Forest を読み込む関数 - 引数 : ファイル名 - tree の Load を呼び出し

Page 179: Random Forests

rts_tree.cpp

179

BuildTree - 再帰によりノードを生成する関数 - 引数 : 決定木のパラメータとサンプル集合、ラベルに対する重み - 各ノードの分岐関数を選択する

BuildHistgrams - 生成した決定木の末端ノードを生成する関数 - 引数 : サンプル集合、ラベルに対する重み - clearHistgrams, voteHistograms, normalizeHistogra を呼び出し

clearHistograms - 末端ノードのヒストグラムを初期化する関数 - 引数 : ノードのアドレス

voteHistograms - 末端ノードのヒストグラムに教師信号を投票する関数 - 引数 : サンプル、ラベルに対する重み、ルートノードのアドレス

normalizeHistograms - 末端ノードのヒストグラムを正規化する関数 - 引数 : ノードのアドレス

traversal - 再帰により決定木を走査する関数 - 引数 : ルートノードのアドレス、サンプル集合 - 末端ノードのヒストグラムを返す