spindle-lidar 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. spindle_lidar-1.0.0/LICENSE +202 -0
  2. spindle_lidar-1.0.0/PKG-INFO +259 -0
  3. spindle_lidar-1.0.0/README.md +227 -0
  4. spindle_lidar-1.0.0/pyproject.toml +48 -0
  5. spindle_lidar-1.0.0/setup.cfg +4 -0
  6. spindle_lidar-1.0.0/spindle_lidar/__init__.py +11 -0
  7. spindle_lidar-1.0.0/spindle_lidar/__main__.py +111 -0
  8. spindle_lidar-1.0.0/spindle_lidar/api.py +163 -0
  9. spindle_lidar-1.0.0/spindle_lidar/bright_intensity.py +226 -0
  10. spindle_lidar-1.0.0/spindle_lidar/channels.py +1596 -0
  11. spindle_lidar-1.0.0/spindle_lidar/choices.py +81 -0
  12. spindle_lidar-1.0.0/spindle_lidar/codec.py +2060 -0
  13. spindle_lidar-1.0.0/spindle_lidar/coding.py +678 -0
  14. spindle_lidar-1.0.0/spindle_lidar/configs/av2_vlp32c.json +54 -0
  15. spindle_lidar-1.0.0/spindle_lidar/configs/kitscenes_ot128.json +106 -0
  16. spindle_lidar-1.0.0/spindle_lidar/configs/kitscenes_vls128.json +65 -0
  17. spindle_lidar-1.0.0/spindle_lidar/configs/kitti360_hdl64e.json +46 -0
  18. spindle_lidar-1.0.0/spindle_lidar/configs/kitti_hdl64e.json +46 -0
  19. spindle_lidar-1.0.0/spindle_lidar/configs/nuscenes_hdl32e.json +37 -0
  20. spindle_lidar-1.0.0/spindle_lidar/configs/once_40beam.json +91 -0
  21. spindle_lidar-1.0.0/spindle_lidar/configs/truckscenes_pandar64.json +86 -0
  22. spindle_lidar-1.0.0/spindle_lidar/configs/truckscenes_top_front.json +53 -0
  23. spindle_lidar-1.0.0/spindle_lidar/configs/vod_hdl64.json +94 -0
  24. spindle_lidar-1.0.0/spindle_lidar/configs/waymo_top.json +83 -0
  25. spindle_lidar-1.0.0/spindle_lidar/configs/zod_file.json +32 -0
  26. spindle_lidar-1.0.0/spindle_lidar/configs/zod_vlp16.json +102 -0
  27. spindle_lidar-1.0.0/spindle_lidar/configs/zod_vls128.json +54 -0
  28. spindle_lidar-1.0.0/spindle_lidar/describe.py +886 -0
  29. spindle_lidar-1.0.0/spindle_lidar/direction.py +224 -0
  30. spindle_lidar-1.0.0/spindle_lidar/encode_streams.py +464 -0
  31. spindle_lidar-1.0.0/spindle_lidar/entropy.py +214 -0
  32. spindle_lidar-1.0.0/spindle_lidar/figures.py +263 -0
  33. spindle_lidar-1.0.0/spindle_lidar/fit.py +703 -0
  34. spindle_lidar-1.0.0/spindle_lidar/formats.py +287 -0
  35. spindle_lidar-1.0.0/spindle_lidar/intensity_rdo.py +286 -0
  36. spindle_lidar-1.0.0/spindle_lidar/kernels_decode.py +452 -0
  37. spindle_lidar-1.0.0/spindle_lidar/kernels_encode.py +453 -0
  38. spindle_lidar-1.0.0/spindle_lidar/laser_blocks.py +1111 -0
  39. spindle_lidar-1.0.0/spindle_lidar/mixing.py +134 -0
  40. spindle_lidar-1.0.0/spindle_lidar/one_pass.py +1059 -0
  41. spindle_lidar-1.0.0/spindle_lidar/packing.py +78 -0
  42. spindle_lidar-1.0.0/spindle_lidar/pcd.py +74 -0
  43. spindle_lidar-1.0.0/spindle_lidar/plot.py +54 -0
  44. spindle_lidar-1.0.0/spindle_lidar/py123d_codec.py +659 -0
  45. spindle_lidar-1.0.0/spindle_lidar/readers.py +1239 -0
  46. spindle_lidar-1.0.0/spindle_lidar/scan.py +1224 -0
  47. spindle_lidar-1.0.0/spindle_lidar/sweeps.py +83 -0
  48. spindle_lidar-1.0.0/spindle_lidar/waymo.py +183 -0
  49. spindle_lidar-1.0.0/spindle_lidar.egg-info/PKG-INFO +259 -0
  50. spindle_lidar-1.0.0/spindle_lidar.egg-info/SOURCES.txt +53 -0
  51. spindle_lidar-1.0.0/spindle_lidar.egg-info/dependency_links.txt +1 -0
  52. spindle_lidar-1.0.0/spindle_lidar.egg-info/entry_points.txt +2 -0
  53. spindle_lidar-1.0.0/spindle_lidar.egg-info/requires.txt +17 -0
  54. spindle_lidar-1.0.0/spindle_lidar.egg-info/top_level.txt +1 -0
  55. spindle_lidar-1.0.0/tests/test_spindle.py +258 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,259 @@
1
+ Metadata-Version: 2.4
2
+ Name: spindle-lidar
3
+ Version: 1.0.0
4
+ Summary: Spindle, a lidar codec for spinning lidars: every point within a bound, in its order, with all channels.
5
+ Author: Holger Caesar
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/nightrome/spindle-lidar
8
+ Project-URL: Paper, https://arxiv.org/abs/2611.37689
9
+ Keywords: lidar,point cloud,compression,codec,autonomous driving
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Topic :: Scientific/Engineering
14
+ Classifier: Topic :: System :: Archiving :: Compression
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: numpy>=1.22
19
+ Requires-Dist: numba>=0.57
20
+ Requires-Dist: scipy>=1.9
21
+ Requires-Dist: zstandard==0.25.0
22
+ Provides-Extra: datasets
23
+ Requires-Dist: pyarrow>=10; extra == "datasets"
24
+ Requires-Dist: laspy[lazrs]>=2; extra == "datasets"
25
+ Provides-Extra: plot
26
+ Requires-Dist: matplotlib>=3.5; extra == "plot"
27
+ Provides-Extra: py123d
28
+ Requires-Dist: py123d==0.7.0; extra == "py123d"
29
+ Provides-Extra: test
30
+ Requires-Dist: pytest>=7; extra == "test"
31
+ Dynamic: license-file
32
+
33
+ <p align="center">
34
+ <img src="https://raw.githubusercontent.com/nightrome/spindle-lidar/main/docs/logos/spindle.svg" alt="Spindle" width="340">
35
+ </p>
36
+
37
+ <p align="center">
38
+ <a href="https://github.com/nightrome/spindle-lidar/actions/workflows/tests.yml"><img src="https://github.com/nightrome/spindle-lidar/actions/workflows/tests.yml/badge.svg?branch=main" alt="Tests"></a>
39
+ <a href="https://arxiv.org/abs/2611.37689"><img src="https://img.shields.io/badge/arXiv-2611.37689-b31b1b.svg" alt="arXiv"></a>
40
+ <a href="https://github.com/nightrome/spindle-lidar/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache_2.0-blue.svg" alt="License"></a>
41
+ <img src="https://img.shields.io/badge/python-3.10%2B-blue.svg" alt="Python 3.10+">
42
+ <a href="#123d"><img src="https://img.shields.io/badge/123D-supported-2a78d6.svg" alt="123D"></a>
43
+ </p>
44
+
45
+ <p align="center">
46
+ <b>The Spindle Lidar Codec: Point Cloud Compression for Spinning Lidars</b><br>
47
+ Holger Caesar<br>
48
+ Intelligent Vehicles group, Delft University of Technology<br>
49
+ <a href="https://arxiv.org/abs/2611.37689">Paper</a> | <a href="#citation">BibTeX</a>
50
+ </p>
51
+
52
+ <p align="center">
53
+ <a href="https://www.tudelft.nl">
54
+ <picture>
55
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nightrome/spindle-lidar/main/docs/logos/tudelft_dark.png">
56
+ <img src="https://raw.githubusercontent.com/nightrome/spindle-lidar/main/docs/logos/tudelft.png" alt="TU Delft" width="160">
57
+ </picture>
58
+ </a>
59
+ </p>
60
+
61
+ Spindle compresses the point clouds of spinning lidars, such as the lidars of nuScenes, KITTI and Waymo.
62
+ You choose an error bound, 2 cm by default, and every decoded point lies within this distance of the original point.
63
+ All points are kept in their original order, with their laser index, intensity and all other channels.
64
+ A decoded sweep can therefore replace the original data, and labels that refer to points by their index stay valid.
65
+
66
+ On nuScenes the lidar data takes 6.3 GB instead of 199 GB, and a sweep decodes in 2 ms on one CPU core.
67
+ For the geometry Spindle needs 20% fewer bits than PACE, the published codec with the fewest bits, and 33% fewer than
68
+ G-PCC, the point cloud standard of MPEG (see the [comparison](#comparison-with-other-codecs) below).
69
+ Networks for segmentation and detection keep 99% of their accuracy on the decoded data, without retraining.
70
+ When the data is read from remote storage over 100 Mbit/s, CenterPoint trains at 9.2 instead of 1.8 samples per
71
+ second, the full speed of the GPU.
72
+
73
+ ![Figure 1 of the paper](https://raw.githubusercontent.com/nightrome/spindle-lidar/main/docs/figures/teaser.png)
74
+
75
+ *Figure 1 of the paper.* (a) Bits per point of 13 lidars in 10 datasets at 2 cm, split into geometry, intensity and
76
+ the other channels. The number after each bar is the compression ratio over the original data.
77
+ (b) Geometry bits per point on nuScenes and the share of points that each codec returns. (c) Decoding time per sweep.
78
+
79
+ ## Installation
80
+ ```
81
+ git clone https://github.com/nightrome/spindle-lidar.git
82
+ cd spindle-lidar
83
+ pip install -e ".[datasets,plot,test]"
84
+ ```
85
+ The extra `datasets` installs the readers of Argoverse 2, KITScenes and LAZ files, `plot` the figures and `test` the tests.
86
+ The first call compiles the codec with numba, which takes about a minute.
87
+
88
+ ## Getting started
89
+ From the command line:
90
+ ```
91
+ spindle lidars # The lidars with a tested configuration
92
+ spindle encode kitti_hdl64e /data/kitti/dataset/sequences/00/velodyne/000000.bin -o 000000.spdl
93
+ spindle decode 000000.spdl -o 000000.npy
94
+ spindle plot kitti_hdl64e /data/kitti/dataset/sequences/00/velodyne/000000.bin -o sweep.png
95
+ ```
96
+ The decoded `.npy` holds x, y, z, intensity and the laser index as float32.
97
+ `--bound` sets the error bound in meters, e.g. `--bound 0.04` for 4 cm.
98
+
99
+ From Python:
100
+ ```python
101
+ from spindle_lidar import api
102
+
103
+ config = api.load_config('kitti_hdl64e')
104
+ sweep = api.read_sweep(config, '/data/kitti/dataset/sequences/00/velodyne/000000.bin')
105
+ data = api.encode(config, sweep, bound=0.02) # bytes
106
+ decoded = api.decode(data) # A dict with 'points' (N x 5), 'extra', 'lidar' and 'bound'
107
+ ```
108
+ The [tutorial notebook](https://github.com/nightrome/spindle-lidar/blob/main/notebooks/tutorial.ipynb) goes through
109
+ these steps on a KITTI sweep and checks what was kept.
110
+
111
+ ## How it works
112
+ A spinning lidar fires its lasers in a fixed pattern, so most of a sweep follows from a short description of the
113
+ sensor. Spindle measures this description from a few sweeps, stores it once per lidar, and per point codes only what
114
+ the description does not predict.
115
+
116
+ ![How Spindle codes a sweep](https://raw.githubusercontent.com/nightrome/spindle-lidar/main/docs/figures/pipeline.png)
117
+
118
+ Every point is a cell in a grid of firings and lasers (1), so the order of the points and their laser index cost no
119
+ bits. The sensor model (2) gives the direction of each cell from the angles of the lasers and the rotation of the
120
+ sensor, which leaves the range and two small corrections per point. These are quantized with steps that follow from
121
+ the bound (3), predicted from earlier points of the scan (4) and written with an adaptive arithmetic coder (6).
122
+ The intensity is coded in levels that keep the ranking of the returns (5), and other channels, such as timestamps or
123
+ second returns, are coded as extra streams. Before it returns, the encoder decodes its own output and checks the bound.
124
+ The [paper](https://arxiv.org/abs/2611.37689) explains each step, and
125
+ [docs/FORMAT.md](https://github.com/nightrome/spindle-lidar/blob/main/docs/FORMAT.md) describes the byte layout of a
126
+ Spindle file.
127
+
128
+ ## Supported lidars
129
+ Spindle comes with a tested configuration for 13 lidars in 10 datasets, and reads the data of each dataset as it is
130
+ downloaded.
131
+
132
+ | Configuration | Lidar | Dataset | Folder to give |
133
+ |---|---|---|---|
134
+ | `nuscenes_hdl32e` | Velodyne HDL-32E | nuScenes | the nuScenes folder, with `samples/LIDAR_TOP` and `sweeps/LIDAR_TOP` |
135
+ | `kitti_hdl64e` | Velodyne HDL-64E | KITTI odometry, SemanticKITTI | `dataset/sequences` |
136
+ | `kitti360_hdl64e` | Velodyne HDL-64E | KITTI-360 | `data_3d_raw` |
137
+ | `waymo_top` | Waymo top lidar (64 beams) | Waymo Open Dataset v1.4 | a folder with the `.tfrecord` segments |
138
+ | `av2_vlp32c` | 2 x Velodyne VLP-32C | Argoverse 2 sensor | the dataset folder, with `train/<log>/sensors/lidar` |
139
+ | `once_40beam` | 40-beam roof lidar | ONCE | `data` |
140
+ | `vod_hdl64` | Velodyne HDL-64 S3 | View-of-Delft | `lidar`, with `training/velodyne` |
141
+ | `zod_vls128` | Velodyne VLS-128 | Zenseact Open Dataset | the dataset folder, with `single_frames` |
142
+ | `zod_vlp16` | 2 x Velodyne VLP-16 | Zenseact Open Dataset | the dataset folder, with `single_frames` |
143
+ | `zod_file` | all three lidars of a ZOD sweep | Zenseact Open Dataset | the dataset folder, with `single_frames` |
144
+ | `truckscenes_pandar64` | Hesai Pandar64 | MAN TruckScenes | `samples`, with `LIDAR_LEFT` |
145
+ | `truckscenes_top_front` | 64-beam lidar | MAN TruckScenes | `samples`, with `LIDAR_TOP_FRONT` |
146
+ | `kitscenes_vls128` | Velodyne VLS-128 | KITScenes | the dataset folder, with `data/<split>/<log>.tar` |
147
+ | `kitscenes_ot128` | Hesai OT128, two returns | KITScenes | the dataset folder, with `data/<split>/<log>.tar` |
148
+
149
+ To list the sweeps of a dataset, give its folder: `api.list_sweeps(config, '/data/kitti/dataset/sequences')`.
150
+ Waymo is read without TensorFlow. For nuScenes, Spindle codes the points that the nuScenes devkit keeps.
151
+ Argoverse 2 and Zenseact store points of the same time in no fixed order, so Spindle sorts these points by lidar and
152
+ laser.
153
+
154
+ ![Decoded sweeps of six lidars](https://raw.githubusercontent.com/nightrome/spindle-lidar/main/docs/figures/gallery.png)
155
+
156
+ ### Other lidars
157
+ For another spinning lidar, `spindle fit /data/my_lidar/sweeps --name my_lidar` measures a configuration from a few
158
+ sweeps and writes it to `my_lidar.json` in the current folder. Use it with `spindle encode my_lidar.json <sweep>` and
159
+ `spindle decode <file.spdl> --config my_lidar.json`, or in Python with `api.load_config('my_lidar.json')`.
160
+ We have not tested such configurations, so please check the results on your own data.
161
+
162
+ ### Limitations
163
+ Spindle is made for single sweeps of spinning lidars. It does not code solid-state lidars or point clouds merged from
164
+ several sweeps. A file made with a configuration of `spindle fit` can only be decoded with that configuration file.
165
+ There is no decoder outside this package yet.
166
+
167
+ ## Comparison with other codecs
168
+ The table comes from the paper, which compares more codecs. Every codec codes the same 300 keyframes of the nuScenes
169
+ test split with its setting for a 2 cm bound. RENO, AnyPcc and PACE code only the geometry, while zstd, LAZ and
170
+ Cloudini code all channels together.
171
+
172
+ | Codec | Max. error (cm) | Points kept (%) | Ordered | Geometry (bits per point) | All channels (bits per point) | Decode (ms) | Device |
173
+ |---|---:|---:|:---:|---:|---:|---:|---|
174
+ | Raw points (float32) | 0.00 | 100.0 | yes | 96.00 | 160.00 | 0 | |
175
+ | zstd | 0.00 | 100.0 | yes | | 93.31 | 0.5 | CPU |
176
+ | LAZ | 1.73 | 100.0 | yes | | 27.77 | 6 | CPU |
177
+ | Cloudini | 1.99 | 100.0 | yes | | 22.53 | 0.9 | CPU |
178
+ | G-PCC, octree | 1.99 | 100.0 | no | 10.25 | 14.25 | 41 | CPU |
179
+ | RENO, retrained on nuScenes | 1.99 | 98.5 | no | 7.68 | | 36 | GPU |
180
+ | AnyPcc | 1.99 | 98.5 | no | 6.95 | | 154 | GPU |
181
+ | PACE, autoregressive | 1.94 | 99.998 | no | 4.72 | | 23,852 | GPU |
182
+ | G-PCC, predictive | 1.74 | 100.0 | no | 5.60 | 9.68 | 29 | CPU |
183
+ | Spindle | 1.99 | 100.0 | yes | 3.77 | 5.03 | 2 | CPU |
184
+
185
+ The codecs that keep the order of the points, such as LAZ and Cloudini, need more than four times the bits of Spindle.
186
+ All others return the points in an order of their own, and RENO, AnyPcc and PACE also drop points and need a GPU.
187
+ Of these, PACE needs the fewest geometry bits, and Spindle needs 20% fewer. The predictive mode of G-PCC, the point
188
+ cloud standard of MPEG, is the closest fast codec. Spindle needs 33% fewer bits and decodes more than ten times faster.
189
+
190
+ ## Reproducing the paper
191
+ This code gives byte-identical output to the code of the paper. To reproduce the numbers of the paper, code the same
192
+ sweeps with
193
+ ```
194
+ python tools/reproduce_paper.py --lidar kitti_hdl64e --root /data/kitti/dataset/sequences
195
+ ```
196
+ The script compares every sweep with the size that the paper measured. Like the paper, it counts the payload without
197
+ the header of a file. The paper uses 1,000 sweeps per lidar, drawn at random over all sequences, and for nuScenes all
198
+ 6,008 keyframes of the test split. For ZOD the script may code another sweep of the same frame than the paper (see the
199
+ script). On our copy of ZOD it gives 7.48 and 6.33 bits per point, the paper 7.48 and 6.32.
200
+
201
+ The figures below are made with `python -m spindle_lidar.figures` from 5 sweeps per lidar (KITScenes VLS-128: one
202
+ sweep from each of 64 logs). The size of a sweep depends on the scene, as open roads, dense traffic and vegetation give
203
+ different sizes. With 5 sweeps the sizes therefore differ from the paper by up to 13% (ONCE 6.74 instead of 5.98 bits
204
+ per point, nuScenes 5.59 instead of 5.04), and 8 of the 13 lidars are within 5%.
205
+
206
+ <p>
207
+ <img src="https://raw.githubusercontent.com/nightrome/spindle-lidar/main/docs/figures/bits_vs_bound.png" alt="Bits per point against the bound" width="49%">
208
+ <img src="https://raw.githubusercontent.com/nightrome/spindle-lidar/main/docs/figures/errors.png" alt="The error of every point" width="49%">
209
+ </p>
210
+
211
+ ## 123D
212
+ [123D](https://github.com/kesai-labs/py123d) stores many driving datasets in one format. Spindle adds itself as a lidar
213
+ codec of py123d 0.7.0 (`pip install -e ".[py123d]"`):
214
+ ```python
215
+ from spindle_lidar import py123d_codec
216
+
217
+ py123d_codec.install() # Once, before 123D writes or reads a log
218
+ writer_config = py123d_codec.log_writer_config(bound=0.02)
219
+ ```
220
+ Pass `writer_config` where 123D takes its `LogWriterConfig`. The reader of 123D then decodes Spindle sweeps by itself.
221
+ This works for nuScenes, KITTI-360, Argoverse 2 and Waymo, and every row and feature of 123D comes back.
222
+
223
+ ### Why the sizes in 123D differ
224
+ Through 123D some sweeps are larger than in the paper, because 123D changes the data and the adapter must give back
225
+ everything that 123D stores. Bits per point at 2 cm on 6 sweeps of each dataset (nuScenes: 294 sweeps of 3 scenes):
226
+
227
+ | Dataset | Original data | Through 123D | Why |
228
+ |---|---|---|---|
229
+ | KITTI-360 | 6.79 | 6.79 | |
230
+ | Argoverse 2 | 9.70 | 9.82 | 123D rounds the timestamps to microseconds, which code less well than the original nanoseconds. |
231
+ | Waymo | 10.58 | 12.28 | 123D includes four short-range lidars (10% of the points) without a tested configuration, stored at about 26 bits per point. The top lidar alone takes 10.71: 123D moves every point with the pose of the car, so Spindle codes it with a slightly tighter bound. |
232
+ | nuScenes | 4.97 | 4.97 (`near='drop'`), 7.28 (`near='keep'`) | 123D keeps the points within 1 m of the sensor, which the nuScenes devkit removes. `near='keep'` (the default) stores them as well. |
233
+
234
+ The sizes leave out a fixed header of 140 to 700 bytes per sweep (the configuration, the bound, the pose of the lidar
235
+ and the list of features), which the reader of 123D needs because it gets only the stored bytes of a sweep.
236
+
237
+ For Waymo, 123D stores the intensity as 8 bits, which wraps around for the brightest returns. Against this intensity
238
+ the rank correlation of Spindle can be slightly below 0.98 (0.9797 at worst on our test frames).
239
+
240
+ ## Tests
241
+ ```
242
+ python -m pytest tests
243
+ ```
244
+ The tests use synthetic sweeps and need no data. They run on Linux, Windows and macOS for every push. To test on a
245
+ dataset, set `SPINDLE_DATA_<CONFIGURATION>` to its folder, e.g. `SPINDLE_DATA_KITTI_HDL64E=/data/kitti/dataset/sequences`.
246
+
247
+ ## Citation
248
+ Please use the following citation when referencing Spindle:
249
+ ```bibtex
250
+ @article{caesar2026spindle,
251
+ title = {The Spindle Lidar Codec: Point Cloud Compression for Spinning Lidars},
252
+ author = {Caesar, Holger},
253
+ journal = {arXiv preprint arXiv:2611.37689},
254
+ year = {2026}
255
+ }
256
+ ```
257
+
258
+ ## License
259
+ Apache License 2.0, see [LICENSE](https://github.com/nightrome/spindle-lidar/blob/main/LICENSE). The datasets keep their own licenses.