Closed tonyf closed 1 year ago
Hi there!
It was actually just a broken assert with the default values. You had to set the parameter quit_at_level
to some value. Could you check again with the updated version.
Maybe you can report a minimal example to reproduce in case it still fails.
The following test should now work:
def test_default_values():
a = np.ones([20] * 3)
b = np.ones([20] * 3)
optflow = farneback3d.Farneback()
rtn = optflow.calc_flow(a, b)
assert rtn is not None
Ah! Thanks for the update. It solved that issue.
Just a heads up the code you posted results in a failed assertion as the bumpy array has type int rather than np.float32. You might want to note that somewhere (implicitly casting would lead to confusion).
Running my code I now run into another error:
pycuda._driver.LogicError: cuMemAlloc failed: invalid device context
Stack trace:
File "farneback_flow.py", line 22, in run return self.optflow.calc_flow(batch[0], batch[1]) File ".../python3.5/site-packages/farneback3d/_farneback3d.py", line 124, in calc_flow imgs = [gpuarray.to_gpu(next_vol), gpuarray.to_gpu(cur_vol)] File ".../python3.5/site-packages/pycuda/gpuarray.py", line 1049, in to_gpu result = GPUArray(ary.shape, ary.dtype, allocator, strides=_compact_strides(ary)) File ".../python3.5/site-packages/pycuda/gpuarray.py", line 210, in __init__ self.gpudata = self.allocator(self.size * self.dtype.itemsize) pycuda._driver.LogicError: cuMemAlloc failed: invalid device context
wherebatch[0]
and batch[1]
are each (1080, 1920, 3) numpy arrays.
Ok, good to know I try to fix that as soon as I have time! :+1:
I was wondering if you could elaborate on the usage. I'm trying to compute the optical flow between two images.
When passing the numpy arrays for the images to calc_flow as follows:
result = optflow.calc_flow(im1, im2)
I get the following error:*** TypeError: unorderable types: NoneType() < int()
Thanks!