griegler/octnet

Unable to run example 00_create_data

siddharthm28 opened this issue · 2 comments

Hi, I tried to run the create_data.py file in examples/00_create_data and I got the following error :

  [OctreeCreateCpu] create octree structure
  [OctreeCreateCpu] update octree data structure
  [OctreeCreateCpu] fill data
  [OctreeCreateCpu] done
Traceback (most recent call last):
  File "./create_data.py", line 32, in <module>
    oc_from_dense2 = pyoctnet.Octree.create_from_dense2(dense, dense[np.newaxis,...], n_threads=n_threads)
  File "pyoctnet.pyx", line 644, in pyoctnet.Octree.create_from_dense2 (pyoctnet.cpp:8776)
    def create_from_dense2(cls, float[:,:,::1] occupancy, float[:,:,:,::1] features, bool fit=False, int fit_multiply=1, bool pack=False, int n_threads=1):
  File "stringsource", line 644, in View.MemoryView.memoryview_cwrapper (pyoctnet.cpp:23565)
  File "stringsource", line 345, in View.MemoryView.memoryview.__cinit__ (pyoctnet.cpp:19800)
ValueError: ndarray is not C-contiguous

Thanks for the help !

Just to complete this example, I commented out the statement that was causing the error and everything worked fine.

  [OctreeCreateCpu] create octree structure
  [OctreeCreateCpu] update octree data structure
  [OctreeCreateCpu] fill data
  [OctreeCreateCpu] done
pc - n_pts: 100, feature_size: 3
  [OctreeFromPC] normalize inplace
create octree
  [OctreeFromPC] determine block pts intersections for grid 8,8,8 - 100 pts
  [OctreeCreateCpu] create octree structure
  [OctreeCreateCpu] update octree data structure
  [OctreeCreateCpu] fill data
  [OctreeCreateCpu] done
pc - n_pts: 100, feature_size: 3
create octree
  [OctreeFromPC] determine block pts intersections for grid 8,8,8 - 100 pts
  [OctreeCreateCpu] create octree structure
  [OctreeCreateCpu] update octree data structure
  [OctreeCreateCpu] fill data
  [OctreeCreateCpu] done

There seems to be a problem with some versions of Python/Cython. On my machine dense[np.newaxis,...] produces a contiguous array. However, using Anaconda it gives the error described above. I added a copy to the example to ensure a contiguous array.