sniklaus / pytorch-pwc

a reimplementation of PWC-Net in PyTorch that matches the official Caffe version
GNU General Public License v3.0
621 stars 123 forks source link

optical flow upsampling #13

Closed xiayizhan2017 closed 5 years ago

xiayizhan2017 commented 5 years ago

hi, I would like to ask why the optical flow upsampling is multiplied by 0.65, 1.25, 2.5, 5. The original paper does not seem to mention it. Thank.

sniklaus commented 5 years ago

It is mentioned in the implementation details section: "Note that we do not further scale the supervision signal at each level, the same as [15]. As a result, we need to scale the upsampled flow at each pyramid level for the warping layer. For example, at the second level, we scale the upsampled flow from the third level by a factor of 5 (= 20/4) before warping features of the second image." https://arxiv.org/abs/1709.02371

xiayizhan2017 commented 5 years ago

Thanks for your reply. I understand why the optical flow upsampling is multiplied by 0.65, 1.25, 2.5, 5. In addition, Why does the optical flow upsampling not use linear interpolation, but use nn.ConvTranspose2d, through the layer with variables, the optical flow will not find changes?

sniklaus commented 5 years ago

Different types of upsampling can be implemented using transposed convolutions, one just needs to initialize the kernel appropriately and fix its weights. For a possible kernel that performs bilinear upsampling, you can have a look at: http://caffe.berkeleyvision.org/doxygen/classcaffe_1_1BilinearFiller.html

xiayizhan2017 commented 5 years ago

Thanks for your reply!