yzcjtr / GeoNet

Code for GeoNet: Unsupervised Learning of Dense Depth, Optical Flow and Camera Pose (CVPR 2018)
MIT License
726 stars 181 forks source link

calculate flow consistency #40

Closed huagl closed 5 years ago

huagl commented 5 years ago

Hi, I read your paper recently and found your code here. It's really a fantastic work. I have a question about the part of calculating flow consistency. `self.fwd_flow_diff_pyramid = [tf.abs(self.bwd2fwd_flow_pyramid[s] + self.fwd_full_flow_pyramid[s]) for s in range(opt.num_scales)]

self.bwd_flow_diff_pyramid = [tf.abs(self.fwd2bwd_flow_pyramid[s] + self.bwd_full_flow_pyramid[s]) for s in range(opt.num_scales)]` Does this mean to compute the full flow difference by forward-backward consistency check? Then, why the operation is '+' to calculate the difference, instead of '-' ?

yzcjtr commented 5 years ago

Hi @huagl, thanks for your interest. Actually, the forward and backward flows have different directions. That is, for point x1 in image1 and its correspondence x2 in image2, the forward flow is x2-x1 while the backward flow is x1-x2. Thus we adopt plus here.

huagl commented 5 years ago

Thanks for your reply! self.bwd2fwd_flow_pyramid = [flow_warp(self.bwd_full_flow_pyramid[s], self.fwd_full_flow_pyramid[s]) \ for s in range(opt.num_scales)] I asked question because I thought that self.bwd2fwd_flow_pyramid is the forward flow warped from the backward flow. Thus I thought it's reasonable to use '-'. So, the function 'flap_warp' doesn't convert backward flows into forward flows? Sorry to bother you a lot.

yzcjtr commented 5 years ago

No. bwd2fwd_flow actually means sampling backward flow according to forward flow.

huagl commented 5 years ago

Get it. Thanks for your kind reply.