Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tvercaut/d210ed103f64ebb24606eb032b38de0a to your computer and use it in GitHub Desktop.
Save tvercaut/d210ed103f64ebb24606eb032b38de0a to your computer and use it in GitHub Desktop.
torch-fit-plane.ipynb

A simple PyTorch implementation of plane fitting with RANSAC. Some ideas are taken from: https://github.com/leomariga/pyRANSAC-3D.

In each (batched-)RANSAC iteration, a batch of triplets is sampled and assessed in parallel. A cross-product is used to get plane equations from triplets. The refinement, post identification of inliers, is done with an eigen decomposition of P.T @ P where P is the matrix of points in homogeneous coordinates. Classicially, an SVD decomposition of P is used but this can be slow and memory intensive with large number of points. We thus opted for the eigen decomposition approach despite it being less numerically stable.

Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment