anuragranj / spynet

Spatial Pyramid Network for Optical Flow
Other
236 stars 48 forks source link

Error:bad argument #1 to 'copy' (sizes do not match #19

Open Lucksong opened 4 years ago

Lucksong commented 4 years ago

I want to compute flow according to github, my code looks like this:

1 spynet = require('spynet')
  2 flowX = require 'flowExtensions'
  3 computeFlow = spynet.setup(960, 720, 'sintelFinal')
  4 img1 = '/data/deblur/model/testdata/20200116_2/01/960x720/undistort/Sony/00010.png'
  5 img2 = '/data/deblur/model/testdata/20200116_2/01/960x720/undistort/Sony/00011.png'
  6 im1 = image.load(img1 )
  7 im2 = image.load(img2 )
  8 im = torch.cat(im1, im2, 1)
  9 print(#im)
 10 im = spynet.normalize(im)
 11 im = im:resize(1, im:size(1), im:size(2), im:size(3)):cuda()
 12 print(#im)
 13 flow = computeFlow(im)
 14 print(#flow)
 15 flow = flow:resize(flow:size(2), flow:size(3), flow:size(4)):float()
 16 print(#flow)
 17 flowX.writeFLO('Sony.flo', flow)

But it reports error like this: /home/torch/install/bin/luajit: ./spynet.lua:136: bad argument #1 to 'copy' (sizes do not match at /home/torch/extra/cutorch/lib/THC/THCTensorCopy.cu:31) stack traceback: [C]: in function 'copy' ./spynet.lua:136: in function 'computeInitFlowL2' ./spynet.lua:147: in function 'computeInitFlowL3' ./spynet.lua:160: in function 'computeInitFlowL4' ./spynet.lua:173: in function 'computeInitFlowL5' ./spynet.lua:187: in function 'computeFlow' opt_zs.lua:13: in main chunk [C]: in function 'dofile' ...time/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: at 0x00405d50

anuragranj commented 4 years ago

Where is the error? As in while line? Could you also print the sizes of your intermediate variables?