NVIDIA / flownet2-pytorch

Pytorch implementation of FlowNet 2.0: Evolution of Optical Flow Estimation with Deep Networks
Other
3.08k stars 738 forks source link

Why the outputs of resample2d and channelnorm are always zero? #240

Open Lifedecoder opened 3 years ago

Lifedecoder commented 3 years ago

I try to use Optical Flow to predict adjacent frames, how can I get the predicted frame by warping original frame & optical flow?

It seems in the code, warping is achieved by function resample2d: resampled_img1 = self.resample1(x[:,3:,:,:], flownetc_flow)

But I found the result is always zero!!! And the output of channelnorm is zero too.

Is there any problems in the function resample2d and channelnorm??? I found that import resample2d always have problems when using pytorch==0.4.1, but can work when pytorch==1.0.1, so the version of my torch is 1.0.1.

ghost commented 3 years ago

I encounter the same issue. However, after I tried putting all the inputs into GPU using .cuda(), the output of resample2d gets what I expected. I think it is because resample2d only works in GPU in the code.

Take a look at resample2d_cuda.forward(input1, input2, output, kernel_size, bilinear) in resample2d.py.