RAFT: Recurrent All-Pairs Field Transforms
for Optical Flow
Zachary Teed and Jia Deng
Princeton University
wkpeco
RAFT: Recurrent All-Pairs Field Transforms for Optical Flow
• ECCVʼ20 Best Paper Award
• ⾼速かつ⾼精度なオプティカルフロー推定
• 汎化性能も優れている
2
RAFT
Input InputOutput Output
以下の3つの要素で構成
• Feature extraction
• Computing visual similarity
• Iterative updates
3
RAFTの概要
• !" # : ℝ&×(×)→ ℝ
+
,
×
-
,
×./0
• ⼊⼒:RGB画像 # ∈ ℝ&×(×)
• 出⼒:特徴マップ ∈ ℝ
+
,
×
-
,
×./0
• !"は2層Conv+6層Residual blockで構成(左下図参照)
4
Feature extraction
• ⾏列積によって4次元の相関マップ!を⽣成
• ! "# $% , "# $' ∈ ℝ*+×-+×*.×-.
• $% ∶ 01234 1, $' : 01234 2
• $%の各位置における$'の全位置への相関情報を計算している(右下にイメージ図)
5
Computing visual similarity
8%
9% 9'
8'
(;, <)
(>, ?)
@@
"#($%) "#($')
…
…
…
…
…
…
…
8'
9'
8%
9%
8'
9'
ABCDE = G
H
"# $% BCH I "# $' DEH
• !"×$"次元に対して,カーネルサイズ % ∈ {1,2,4,8}のaverage poolingを
適⽤することで,4つの相関マップ ./, .0, .1, .2 を⽣成
• ⼤きな動き,⼩さな動きの両者に対応可能にするため
6
Computing visual similarity - Correlation pyramid -
…
…
…
…
…
…
…
!"
$"
!3
$3
!"
$"
…
…
…
…
…
…
…
!"
24
$"
24
!3
$3
Correlation lookup !"
• 4D相関マップから現時点のオプティカルフローに基づいた,より局所的な情報抽出を⾏う
• 現時点でのオプティカルフロー ($%, $')を⽤いて,)%を)'へワープする
7
Computing visual similarity - Correlation lookup -
*+
*
• *+ = - + /% - , 0 + /' 0
• * = -, 0 ∈ )%, *+ = -+, 0+ ∈ correspondence pixel in )'
• *′に基づいて,半径3の局所領域 4 *+
5を抽出
• 4 *+
5 = {*+ + 7*|7* ∈ ℤ', 7* % ≤ 3}
• サブピクセルに対しては,Bilinear補間で対処
3 = 2のときの4 *+
5
Correlation lookup !"
• 4D相関マップ #$, #&, #', #(のすべての)*×,*の要素に対して,- ./
0 を抽出
• 結果として,()*, ,*, 234567 - ./
0 , 4) の特徴マップを算出
8
Computing visual similarity - Correlation lookup -
Correlation lookup !"
• 4D相関マップのすべての#$×&'の要素に対して,( )*
+ を抽出
11
Computing visual similarity - Correlation lookup -
)*
)
)*
)
)*
)
Correlation lookup !"
• 4D相関マップのすべての#$×&'の要素に対して,( )*
+ を抽出
11
Computing visual similarity - Correlation lookup -
)*
)
)*
)
)*
)
…)*
,*
• Correlation lookupとUpdate operatorを⽤いて,
オプティカルフローを逐次的に更新していく
• !" → !$ → ⋯ → !& (!" = ))
• Update operator
• GRU+Conv
• ⼊⼒:フロー!+, context encoderの出⼒ ,-., Correlation map /(0′)2
• 出⼒:Δ! (!+4$ = Δ! + !+ でフローを更新していく)
9
Iterative updates
Δ! = Conv:×:(Conv$×$ ℎ+ )
0+: Concat[>+, ,-., / 0@
2]
Update operatorの中⾝
• オプティカルフローは
!
"
×
$
"
のスケールで算出されるため,アップサンプリング
することで,もとの解像度に合わせる
• アップサンプリングには,Convex upsamplingを使⽤
• 2層の畳込み層を⽤いて,
!
"
×
$
"
×(8×8×9)の重みマップを⽣成し,9近傍との線形和で拡⼤
10
Upsampling of opticaflow
Convex upsampling Bilinear upsampling vs Convex upsampling
損失関数:Ground truthと各ステップでの推定フロー間のL1距離
• ℒ = ∑$%&
'
(')&
*+$ − *$ &
( = 0.8, 1 = 32
Implementation details
• Optimizer: AdamW [1]
• Two 2080Ti GPUs
11
学習⽅法
[1] Loshchilov, I., Hutter, F.: Decoupled weight decay regularization. arXiv:1711.05101, 2017
Dataset for training C: FlyingChairs, T: FlyingThings, S: Sintel, K: KITTI, H: HD1K
12
定量評価
estimated flow
GT flow
End-point-Error
end-point-error
C: FlyingChairs
T: FlyingThings
S: Sintel
K: KITTI
優れた汎化性能
RAFTはパラメータ数,推論速度,学習時間のいずれに対しても
既存研究よりも優れた性能を⽰す
13
パラメータ数,推論速度,学習時間
14
出⼒結果例
Sintel
KITTI
• RAFTで使⽤されてい
る各要素が性能にどれ
ほど貢献しているかを
検証
• Lookup radiusの
ハイパーパラメータの
影響が⼤きい
• 相関マップ⽣成時の
受容野も⼤きくするこ
とで性能向上に貢献
15
Ablation study
• End-to-Endで学習可能なオプティカルフロー推定⼿法の提案
• フローの推定性能,推論速度,モデルのパラメータ数,学習時間に
おいて既存研究よりも優れた結果を⽰した
• また,FlyingChairs+FlyingThingsdでの学習+Sintel or KITTIでの
評価結果から,汎化性能も優れていることがわかる
16
まとめ

RAFT: Recurrent All-Pairs Field Transforms for Optical Flow