ajhynes7/scikit-spatial

init_gessd failed init on Plane.best_fit

Closed this issue · 3 comments

I've been using this package to apply best-fit algorithms on point clouds. In this particular case, I want to apply the Plane.best_fit algorithm on a (very dense) point cloud of a piece of floor (maybe around 2 x 2 meters). The .e57 point cloud file is ~ 63.1 MB in size, so I currently struggle to put it here for a reproduction of my steps.

As soon as the function is called, I get a message printed to the screen saying:

init_gesdd failed init

followed by a wrong calculation of the planes normals vector:

[-0.19614877, 0.9805681, 0.00344324]

The correct output for the normals vector should have been:

[-0.00061294  0.00036945  0.99999974]

I've tried the function on several Windows and Ubuntu machines (all x86, 64 bit), so far it only seems to affect Windows machines that do not have a GPU installed.

Installed packages:

  • scikit-spatial: 7.2.0
  • numpy: 1.26.4

I hope to understand what causes this error and would deeply thank you for helping out!

Hi! Could you share the file using a cloud storage service, please?

The best_fit classmethod leverages np.linalg.svd and the problem should arise from memory issues when computing u, s and v. I have not found much regarding this issue online, it seems that those who got this error eventually reduced the size of the matrix, but probably downsampling is not a viable option for you, right?

I've tried to downsample the floor point cloud by a factor of 10 (i.e., currently only every 1000th point of the point cloud is used), which seems to work fine. I would observe the future uses of this in detail and check if I can also keep this downsampling factor for now.

When I try to change the downsampling factor to point_cloud[::(1/0.8)] as an example, I get an error message that it cannot allocate 71.8TiB of storage. So in this case, the memory issue is directly pointed out instead of a somewhat vague init_gessd failed init message. If these two errors are even related to each other.

But this seems to be a pure numpy issue then and has nothing to do with this package, right?

Yes, you are right IMHO. The best_fit classmethod is just doing the following:

points_centered, centroid = points.mean_center(return_centroid=True)

u, _, _ = np.linalg.svd(points_centered.T, **kwargs)
normal = Vector(u[:, 2])

so, I think it's a numpy related issue.