{"id":21427882,"url":"https://github.com/harrydobbs/torch_ransac3d","last_synced_at":"2025-10-03T14:15:02.541Z","repository":{"id":257792358,"uuid":"862043904","full_name":"harrydobbs/torch_ransac3d","owner":"harrydobbs","description":"A high-performance implementation of 3D RANSAC (Random Sample Consensus) algorithm using PyTorch and CUDA.","archived":false,"fork":false,"pushed_at":"2025-02-01T07:13:03.000Z","size":6952,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-01T10:24:11.472Z","etag":null,"topics":["3d","cloud","cubiod","cuda","cylinder","plane","plane-detection","point","point-cloud","ransac","segmentation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/harrydobbs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-24T00:03:23.000Z","updated_at":"2025-08-27T19:53:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"1f97860e-999a-465f-8b6b-9d840a1c0f6f","html_url":"https://github.com/harrydobbs/torch_ransac3d","commit_stats":null,"previous_names":["harrydobbs/torch_ransac3d"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/harrydobbs/torch_ransac3d","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harrydobbs%2Ftorch_ransac3d","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harrydobbs%2Ftorch_ransac3d/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harrydobbs%2Ftorch_ransac3d/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harrydobbs%2Ftorch_ransac3d/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harrydobbs","download_url":"https://codeload.github.com/harrydobbs/torch_ransac3d/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harrydobbs%2Ftorch_ransac3d/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278173595,"owners_count":25942338,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-03T02:00:06.070Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d","cloud","cubiod","cuda","cylinder","plane","plane-detection","point","point-cloud","ransac","segmentation"],"created_at":"2024-11-22T22:08:15.744Z","updated_at":"2025-10-03T14:15:02.500Z","avatar_url":"https://github.com/harrydobbs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- PROJECT LOGO --\u003e\n\u003cbr /\u003e\n\u003cdiv align=\"center\"\u003e\n\u003ca href=\"https://github.com/harrydobbs/torch_ransac3d\"\u003e\n\u003cimg src=\"images/logo.png\"\u003e\n\u003c/a\u003e\n\u003cbr\u003e\u003cbr\u003e\n\u003c!-- \u003ch3 align=\"center\"\u003etorch_ransac3d\u003c/h3\u003e --\u003e\n\u003cp align=\"center\"\u003e\n A high-performance implementation of 3D RANSAC algorithm using PyTorch and CUDA.\n\u003cbr /\u003e\n\u003ca href=\"https://harrydobbs.github.io/torch_ransac3d/\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e \u003cbr /\u003e\n\u003cbr /\u003e\n\u003cbr /\u003e\n\u003ca href=\"https://github.com/harrydobbs/torch_ransac3d/\"\u003eView Demo\u003c/a\u003e\n ·\n\u003ca href=\"https://github.com/harrydobbs/torch_ransac3d//issues/new?labels=bug\u0026template=bug-report---.md\"\u003eReport Bug\u003c/a\u003e\n ·\n\u003ca href=\"https://github.com/harrydobbs/torch_ransac3d//issues/new?labels=enhancement\u0026template=feature-request---.md\"\u003eRequest Feature\u003c/a\u003e\n\u003c/p\u003e\n\u003c/div\u003e\n\n## Installation\n\nRequirements: torch, numpy\n\nInstall with \u003ca href=\"https://pypi.org/project/torch-ransac3d\"\u003e PyPI \u003c/a\u003e:\n```\npip install torch-ransac3d\n```\n\n## Features\n\n- High-performance RANSAC implementation using PyTorch and CUDA\n- Supports fitting of multiple geometric primitives:\n  - Lines\n  - Planes\n  - Spheres\n  - Circles\n  - Cylinders\n  - Cuboids\n  - Points\n- Batch processing capability for improved efficiency\n- Support for both PyTorch tensors and NumPy arrays as input\n- Clean dataclass return types for all fitting functions\n\n## Example Usage\n\n### Line Fitting\n\n```python\nimport torch\nimport numpy as np\nfrom torch_ransac3d.line import line_fit\n\n# Using PyTorch tensor\npoints_torch = torch.rand(1000, 3)\nresult = line_fit(\n    pts=points_torch,\n    thresh=0.01,\n    max_iterations=1000,\n    iterations_per_batch=100,\n    epsilon=1e-8,\n    device=torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n)\nprint(f\"Direction: {result.direction}\")\nprint(f\"Point: {result.point}\")\nprint(f\"Number of inliers: {len(result.inliers)}\")\n\n# Using NumPy array\npoints_numpy = np.random.rand(1000, 3)\nresult = line_fit(\n    pts=points_numpy,\n    thresh=0.01,\n    max_iterations=1000,\n    iterations_per_batch=100,\n    epsilon=1e-8,\n    device=torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n)\n```\n\n### Plane Fitting\n\n```python\nfrom torch_ransac3d.plane import plane_fit\n\n# Works with both PyTorch tensors and NumPy arrays\npoints = torch.rand(1000, 3)  # or np.random.rand(1000, 3)\nresult = plane_fit(\n    pts=points,\n    thresh=0.05,\n    max_iterations=1000,\n    iterations_per_batch=100,\n    epsilon=1e-8,\n    device=torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n)\nprint(f\"Plane equation: {result.equation}\")  # [a, b, c, d] for ax + by + cz + d = 0\nprint(f\"Number of inliers: {len(result.inliers)}\")\n```\n\n### Sphere Fitting\n\n```python\nfrom torch_ransac3d.sphere import sphere_fit\n\n# Works with both PyTorch tensors and NumPy arrays\npoints = torch.rand(1000, 3)  # or np.random.rand(1000, 3)\nresult = sphere_fit(\n    pts=points,\n    thresh=0.05,\n    max_iterations=1000,\n    iterations_per_batch=100,\n    epsilon=1e-8,\n    device=torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n)\nprint(f\"Center: {result.center}\")\nprint(f\"Radius: {result.radius}\")\nprint(f\"Number of inliers: {len(result.inliers)}\")\n```\n\n## Parameters\n\n- `pts`: Input point cloud (torch.Tensor or numpy.ndarray of shape (N, 3))\n- `thresh`: Distance threshold for considering a point as an inlier\n- `max_iterations`: Maximum number of RANSAC iterations\n- `iterations_per_batch`: Number of iterations to process in parallel\n- `epsilon`: Small value to avoid division by zero\n- `device`: Torch device to run computations on (CPU or CUDA)\n\n## Input Flexibility\n\nAll fitting functions support both PyTorch tensors and NumPy arrays as input. The library automatically converts NumPy arrays to PyTorch tensors internally, allowing for seamless integration with various data formats.\n\n## Batch Processing\n\nAll fitting functions support batch processing to improve performance. The `iterations_per_batch` parameter determines how many RANSAC iterations are processed in parallel, leading to significant speedups on GPU hardware.\n\n## Credit\n\nThis project is based on the work done at https://github.com/leomariga/pyRANSAC-3D/\n\n## Citation\n```\n@software{Dobbs_torch_ransac3d,\n  author       = {Dobbs, Harry},\n  title        = {torch\\_ransac3d: A high-performance implementation of 3D RANSAC algorithm using PyTorch and CUDA},\n  year         = {2024},\n  publisher    = {GitHub},\n  journal      = {GitHub repository},\n  url          = {https://github.com/harrydobbs/torch_ransac3d},\n}\n```\n\n\n\n## Contact\n\n**Maintainer:** Harry Dobbs\n**Email:** harrydobbs87@gmail.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharrydobbs%2Ftorch_ransac3d","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharrydobbs%2Ftorch_ransac3d","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharrydobbs%2Ftorch_ransac3d/lists"}