匹配代价卷:
与使用距离测定方法不同,MC-CNN和GC-Net方法都结合左右图特征使用深层网络来学习匹配代价的估计。跟随GC-Net的方法,我们通过结合左右图中每个视差值对应的特征图,采用SPP特征来构成一个四维的匹配代价卷(高*宽*视差*特征大小)
cost = Variable(torch.FloatTensor(refimg_fea.size()[0], refimg_fea.size()[1]*2, self.maxdisp/4, refimg_fea.size()[2], refimg_fea.size()[3]).zero_(), volatile= not self.training)
for i in range(self.maxdisp/4):
if i > 0 :
cost[:, :refimg_fea.size()[1], i, :,i:] = refimg_fea[:,:,:,i:]
cost[:, refimg_fea.size()[1]:, i, :,i:] = targetimg_fea[:,:,:,:-i]
else:
cost[:, :refimg_fea.size()[1], i, :,:] = refimg_fea
cost[:, refimg_fea.size()[1]:, i, :,:] = targetimg_fea
cost = cost.contiguous()
1.
for i in range(self.maxdisp/4):#48*4 = 192
#print(i)
if i > 0 :