{"id":13443880,"url":"https://github.com/lucidrains/point-transformer-pytorch","last_synced_at":"2025-04-13T02:15:43.834Z","repository":{"id":38795675,"uuid":"322674206","full_name":"lucidrains/point-transformer-pytorch","owner":"lucidrains","description":"Implementation of the Point Transformer layer, in Pytorch","archived":false,"fork":false,"pushed_at":"2022-02-12T15:40:46.000Z","size":45,"stargazers_count":595,"open_issues_count":11,"forks_count":57,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-04-13T02:14:43.353Z","etag":null,"topics":["artificial-intelligence","attention-mechanism","deep-learning","point-cloud"],"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/lucidrains.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}},"created_at":"2020-12-18T18:27:00.000Z","updated_at":"2025-03-30T10:56:08.000Z","dependencies_parsed_at":"2022-07-09T13:30:41.460Z","dependency_job_id":null,"html_url":"https://github.com/lucidrains/point-transformer-pytorch","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fpoint-transformer-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fpoint-transformer-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fpoint-transformer-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fpoint-transformer-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucidrains","download_url":"https://codeload.github.com/lucidrains/point-transformer-pytorch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248654095,"owners_count":21140236,"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","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":["artificial-intelligence","attention-mechanism","deep-learning","point-cloud"],"created_at":"2024-07-31T03:02:12.789Z","updated_at":"2025-04-13T02:15:43.799Z","avatar_url":"https://github.com/lucidrains.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\u003cimg src=\"./point-transformer-layer.png\" width=\"300px\"\u003e\u003c/img\u003e\n\n## Point Transformer - Pytorch\n\nImplementation of the \u003ca href=\"https://arxiv.org/abs/2012.09164\"\u003ePoint Transformer\u003c/a\u003e self-attention layer, in Pytorch. The simple circuit above seemed to have allowed their group to outperform all previous methods in point cloud classification and segmentation.\n\n## Install\n\n```bash\n$ pip install point-transformer-pytorch\n```\n\n## Usage\n\n```python\nimport torch\nfrom point_transformer_pytorch import PointTransformerLayer\n\nattn = PointTransformerLayer(\n    dim = 128,\n    pos_mlp_hidden_dim = 64,\n    attn_mlp_hidden_mult = 4\n)\n\nfeats = torch.randn(1, 16, 128)\npos = torch.randn(1, 16, 3)\nmask = torch.ones(1, 16).bool()\n\nattn(feats, pos, mask = mask) # (1, 16, 128)\n```\n\nThis type of vector attention is much more expensive than the traditional one. In the paper, they used k-nearest neighbors on the points to exclude attention on faraway points. You can do the same with a single extra setting.\n\n```python\nimport torch\nfrom point_transformer_pytorch import PointTransformerLayer\n\nattn = PointTransformerLayer(\n    dim = 128,\n    pos_mlp_hidden_dim = 64,\n    attn_mlp_hidden_mult = 4,\n    num_neighbors = 16          # only the 16 nearest neighbors would be attended to for each point\n)\n\nfeats = torch.randn(1, 2048, 128)\npos = torch.randn(1, 2048, 3)\nmask = torch.ones(1, 2048).bool()\n\nattn(feats, pos, mask = mask) # (1, 16, 128)\n```\n\n## Citations\n\n```bibtex\n@misc{zhao2020point,\n    title={Point Transformer}, \n    author={Hengshuang Zhao and Li Jiang and Jiaya Jia and Philip Torr and Vladlen Koltun},\n    year={2020},\n    eprint={2012.09164},\n    archivePrefix={arXiv},\n    primaryClass={cs.CV}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Fpoint-transformer-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucidrains%2Fpoint-transformer-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Fpoint-transformer-pytorch/lists"}