1. 程式人生 > >立體匹配之(二):[MC-CNN] 2015CVPR: Stereo Matching by Training a Convolutional Neural Netw

立體匹配之(二):[MC-CNN] 2015CVPR: Stereo Matching by Training a Convolutional Neural Netw

1 摘要

  • 基於patch的提取與比較,學習其相似性得到一個matching cost,並將正確匹配的patch定義為正樣本,其他為負樣本。
  • 後處理包括:cross-based cost aggregation, semiglobal matching, a left-right consistency check, subpixel enhancement, a median filter, and a bilateral lter.
  • fast 和accurate兩個版本

2 介紹和相關工作

類似的有:[1] ,[2] (都是基於patches), 主要差別在於包括了pooling和subsampling 以引入更大的patch sizes and larger variation in viewpoint

3 匹配代價

A. 資料集正負樣本建立

左圖的點P(x,y)對應右圖匹配點為q
正樣本: q = (x - d + Opos, y);
負樣本: q = (x - d + Oneg, y);
其中Oneg從[-dataset_neg_high, - dataset_neg_low] 以及[dataset_neg_low, dataset_neg_high]中選。Opos理論上是0,但實際選取一個不超過1 的值。

B. 網路架構

1. fast architecture

siamese network
這裡寫圖片描述
特點:

  1. the cosine similarity computation is split in two steps: normalization and dot product.

  2. loss: hinge loss :定義為max(0;m+負樣本的相似度 -正樣本的相似度) ,只有當正樣本的相似度比負樣本的相似度大了超過m時, loss才是0 ,m=0.2.

  3. 其他引數:每個branch的卷積層數:num_conv_layers,卷積核大小:conv_kernel_size,每一層的feature maps的數目num_conv_feature_maps以及輸入的patch大小:input_patch_size。

2. accurate architecture

  1. loss : binary cross-entropy loss : t log(s) + (1 - t) log(1 - s).其中s是網路的輸出,t是其實際的樣本標籤,正樣本為1,負樣本為0
  2. 引數:每個branch的卷積層數:num_conv_layers,卷積核大小:conv_kernel_size,每一層的feature maps的數目num_conv_feature_maps以及輸入的patch大小:input_patch_size,每個fc層的單元數num_fc_units,
    全連線層的層數num_fc_layers
    這裡寫圖片描述

3. 計算匹配代價

網路的輸出用來初始化cost
這裡寫圖片描述
其實就是對score求反,score越高,代價cost越小。
架構的特點:
1. 對於兩個sub-network,每個pixel只需要被計算一次,不需要每個視差都算一遍。
2. 對兩個sub-network ,可以通過輸入全圖一次前向傳播得到所有畫素的輸出(這一點還沒理解)
3. 全連線層的輸出也可在一個前向pass中得到,方法是替換fc層為1*1的卷積層,但我們需要對每個視差都計算一遍forward pass (還沒啃透)。
那麼,對每幅圖我們需要計算一次sub-network ,而fc層需要run d次(d是disparity range)(而在fast 結構中,只有dot product需要被執行d次)

4 stereo method

下面的部分就不細說了,只列出主要方法:

4.1 cross-based cost aggregation

迭代i次

4.2 semiglobal matching

4.3 插值

For positions marked as occlusion, we want the new disparity value to come from the
background. We interpolate by moving left until we nd a position labeled correct and
use its value. For positions marked as mismatch, we nd the nearest correct pixels in 16 dierent directions and use the median of their disparities for interpolation。

4.4 亞畫素增強

4.5 refinement

5*5 median filter + bilateral filter

5 實驗

5.1 資料集

對於KITTI: 30%畫素標了ground truth
error : >3

對Middlebury
error : >2 對full size

5.2 learning details

訓練階段,batchsize=128
測試階段:輸入全圖
為何在訓練的時候採用patch呢?作者做出來解釋:
(1)更方便控制batch size
(2)可以隨機化這些patch使得一個batch裡面的patch可以來自不同的圖片。
(3)可以保證一個batch中正負樣本的數目相同。
這裡寫圖片描述
momentum=0.9
lr=0.003/ 0.002

5.3 資料augmentation

rotate
scale
shear
change brightness and contrast
attention: 這些變換都是在patch被提取之後做的。
這裡寫圖片描述

參考文獻:

[1] Sergey Zagoruyko and Nikos Komodakis. Learning to compare image patches via convolutional neural networks. IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2015
[2] Xufeng Han, Thomas Leung, Yangqing Jia, Rahul Sukthankar, and Alexander C Berg. MatchNet: Unifying feature and metric learning for patch-based matching. IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2015.