Skip to content

Commit 3ed2dfa

Browse files
kentang-mitys-2020
andauthored
v2.1.0 (#209)
* [Major] Update README for v2.1.0 * [Minor] Update README.md * [Minor] Update README.md * [Minor] Update README.md --------- Co-authored-by: ys-2020 <[email protected]>
1 parent 1a10fda commit 3ed2dfa

File tree

3 files changed

+71
-54
lines changed

3 files changed

+71
-54
lines changed

README.md

Lines changed: 71 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,86 +2,88 @@
22

33
TorchSparse is a high-performance neural network library for point cloud processing.
44

5-
### [website](http://torchsparse.mit.edu/) | [paper](https://arxiv.org/abs/2204.10319) | [presentation](https://www.youtube.com/watch?v=IIh4EwmcLUs)
5+
### [website](http://torchsparse.mit.edu/) | [paper](https://arxiv.org/abs/2204.10319) | [presentation](https://www.youtube.com/watch?v=IIh4EwmcLUs) | [documents](http://torchsparse-docs.github.io/) | [pypi server](http://pypi.hanlab.ai/simple/torchsparse)
6+
7+
8+
## Introduction
9+
10+
Point cloud computation has become an increasingly more important workload for autonomous driving and other applications. Unlike dense 2D computation, point cloud convolution has **sparse** and **irregular** computation patterns and thus requires dedicated inference system support with specialized high-performance kernels. While existing point cloud deep learning libraries have developed different dataflows for convolution on point clouds, they assume a single dataflow throughout the execution of the entire model. In this work, we systematically analyze and improve existing dataflows. Our resulting system, TorchSparse, achieves **2.9x**, **3.3x**, **2.2x** and **1.7x** measured end-to-end speedup on an NVIDIA A100 GPU over the state-of-the-art MinkowskiEngine, SpConv 1.2, TorchSparse (MLSys) and SpConv v2 in inference respectively.
611

712
## Installation
813

9-
TorchSparse depends on the [Google Sparse Hash](https://github.com/sparsehash/sparsehash) library.
14+
We provide pre-built torchsparse v2.1.0 packages (recommended) with different PyTorch and CUDA versions to simplify the building for the Linux system.
1015

11-
- On Ubuntu, it can be installed by
16+
1. Ensure at least PyTorch 1.9.0 is installed:
1217

13-
```bash
14-
sudo apt-get install libsparsehash-dev
15-
```
18+
```bash
19+
python -c "import torch; print(torch.__version__)"
20+
>>> 1.10.0
21+
```
1622

17-
- On Mac OS, it can be installed by
23+
1. If you want to use TorchSparse with gpus, please ensure PyTorch was installed with CUDA:
1824

19-
```bash
20-
brew install google-sparsehash
21-
```
25+
```bash
26+
python -c "import torch; print(torch.version.cuda)"
27+
>>> 11.3
28+
```
2229

23-
- You can also compile the library locally (if you do not have the sudo permission) and add the library path to the environment variable `CPLUS_INCLUDE_PATH`.
30+
1. Then the right TorchSparse wheel can be found and installed by running the installation script:
2431

25-
The latest released TorchSparse (v1.4.0) can then be installed by
32+
```bash
33+
python -c "$(curl -fsSL https://raw.githubusercontent.com/mit-han-lab/torchsparse/main/install.py)"
34+
```
35+
2636

27-
```bash
28-
pip install --upgrade git+https://github.com/mit-han-lab/[email protected]
29-
```
37+
If Pypi server does not work as expected, no worries, you can still manually download the wheels. The wheels are listed in [this website](http://pypi.hanlab.ai/simple/torchsparse). One can utilize our installation script to automatically determine the version number used to index the wheels. For example, if you use PyTorch 1.11.0, CUDA 11.5, the version number will end up to be 2.1.0+torch111cu115. You can then select the proper wheel according to your Python version.
3038

31-
If you use TorchSparse in your code, please remember to specify the exact version in your dependencies.
39+
## Benchmarks
3240

33-
For installation help and troubleshooting, please consult the [Frequently Asked Questions](./docs/FAQ.md) before posting an issue.
41+
### Inference benchmarks
3442

35-
## Benchmark
43+
![eval_benchmark.png](./docs/figs/eval_benchmark.png)
3644

37-
We compare TorchSparse with [MinkowskiEngine](https://github.com/NVIDIA/MinkowskiEngine) (where the latency is measured on NVIDIA GTX 1080Ti):
45+
TorchSparse significantly outperforms existing point cloud inference engines in both 3D object detection and LiDAR segmentation benchmarks across three generations of GPU architecture (Pascal, Turing and Ampere) and all precisions (FP16, TF32, FP32). It is up to **1.7x** faster than state-of-the-art SpConv 2.3.5 and is up to **2.2x** faster than
46+
TorchSparse-MLsys on cloud GPUs. It also improves the latency of SpConv 2.3.5 by **1.25×** on Orin.
3847

39-
| | MinkowskiEngine v0.4.3 | TorchSparse v1.0.0 |
40-
| :----------------------- | :--------------------: | :----------------: |
41-
| MinkUNet18C (MACs / 10) | 224.7 ms | 124.3 ms |
42-
| MinkUNet18C (MACs / 4) | 244.3 ms | 160.9 ms |
43-
| MinkUNet18C (MACs / 2.5) | 269.6 ms | 214.3 ms |
44-
| MinkUNet18C | 323.5 ms | 294.0 ms |
48+
### Training benchmarks
4549

46-
## Getting Started
50+
![train_benchmark.png](./docs/figs/train_benchmark.png)
4751

48-
### Sparse Tensor
52+
TorchSparse achieves superior mixed-precision training speed compared with MinkowskiEngine, TorchSparse-MLSys and SpConv 2.3.5. Specifically, it is **1.16x** faster on Tesla A100, **1.27x** faster on RTX 2080 Ti than state-of-the-art SpConv 2.3.5. It also significantly outperforms MinkowskiEngine by **4.6-4.8x*** across seven benchmarks on A100 and 2080 Ti. Measured with batch size = 2.
4953

50-
Sparse tensor (`SparseTensor`) is the main data structure for point cloud, which has two data fields:
5154

52-
- Coordinates (`coords`): a 2D integer tensor with a shape of N x 4, where the first three dimensions correspond to quantized x, y, z coordinates, and the last dimension denotes the batch index.
53-
- Features (`feats`): a 2D tensor with a shape of N x C, where C is the number of feature channels.
55+
## Team
5456

55-
Most existing datasets provide raw point cloud data with float coordinates. We can use `sparse_quantize` (provided in `torchsparse.utils.quantize`) to voxelize x, y, z coordinates and remove duplicates:
57+
TorchSparse is developed by the following wonderful team:
5658

57-
```python
58-
coords -= np.min(coords, axis=0, keepdims=True)
59-
coords, indices = sparse_quantize(coords, voxel_size, return_index=True)
60-
coords = torch.tensor(coords, dtype=torch.int)
61-
feats = torch.tensor(feats[indices], dtype=torch.float)
62-
tensor = SparseTensor(coords=coords, feats=feats)
63-
```
59+
- [Haotian Tang](http://kentang.net): Ph.D. student (2020-) at MIT EECS, project lead, v2.0 and v2.1 lead;
60+
- [Shang Yang](http://ys-2020.github.io): Ph.D. student (2023-) at MIT EECS, project lead, v2.1 lead;
61+
- [Zhijian Liu](http://zhijianliu.com): Ph.D. student (2018-) at MIT EECS, project lead, v2.0 lead;
62+
- [Xiuyu Li](http://xiuyuli.com): Ph.D. student (2022-) at UC Berkeley EECS, v2.0 lead;
63+
- [Ke Hong](https://ieeexplore.ieee.org/author/37089419138): Graduate student (2021-) at Tsinghua University EE, v2.1 core developer, authored PCEngine kernels;
64+
- [Zhongming Yu](https://fishmingyu.github.io/): Ph.D. student (2022-) at UCSD CS, v2.1 core developer, authored PCEngine kernels;
65+
- [Yujun Lin](https://yujunlin.com/): Ph.D. student (2018-) at MIT EECS, v2.0 core developer;
66+
- [Guohao Dai](https://scholar.google.com/citations?user=gz3Tkl0AAAAJ&hl=en): Associate Professor at Shanghai Jiao Tong University, mentor of the project;
67+
- [Yu Wang](http://nicsefc.ee.tsinghua.edu.cn/): Professor at Tsinghua University, mentor of the project;
68+
- [Song Han](https://songhan.mit.edu): Associate Professor at MIT EECS, mentor of the project.
6469

65-
We can then use `sparse_collate_fn` (provided in `torchsparse.utils.collate`) to assemble a batch of `SparseTensor`'s (and add the batch dimension to `coords`). Please refer to [this example](./examples/example.py) for more details.
6670

67-
### Sparse Neural Network
71+
## Citation
6872

69-
The neural network interface in TorchSparse is very similar to PyTorch:
73+
If you use TorchSparse, please use the following BibTeX entries to cite:
7074

71-
```python
72-
from torch import nn
73-
from torchsparse import nn as spnn
75+
Preliminary version of TorchSparse++ (TorchSparse v2.1) is presented at CVPR Workshops 2023:
7476

75-
model = nn.Sequential(
76-
spnn.Conv3d(in_channels, out_channels, kernel_size),
77-
spnn.BatchNorm(out_channels),
78-
spnn.ReLU(True),
79-
)
77+
```bibtex
78+
@inproceedings{tangandyang2023torchsparse++,
79+
title = {{TorchSparse++: Efficient Point Cloud Engine}},
80+
author = {Tang, Haotian and Yang, Shang and Liu, Zhijian and Hong, Ke and Yu, Zhongming and Li, Xiuyu and Dai, Guohao and Wang, Yu and Han, Song},
81+
booktitle = {Computer Vision and Pattern Recognition Workshops (CVPRW)},
82+
year = {2023}
83+
}
8084
```
8185

82-
## Citation
83-
84-
If you use TorchSparse in your research, please use the following BibTeX entries:
86+
TorchSparse is presented at MLSys 2022:
8587

8688
```bibtex
8789
@inproceedings{tang2022torchsparse,
@@ -92,6 +94,8 @@ If you use TorchSparse in your research, please use the following BibTeX entries
9294
}
9395
```
9496

97+
Initial version of TorchSparse is part of the SPVNAS paper at ECCV 2020:
98+
9599
```bibtex
96100
@inproceedings{tang2020searching,
97101
title = {{Searching Efficient 3D Architectures with Sparse Point-Voxel Convolution}},
@@ -101,6 +105,19 @@ If you use TorchSparse in your research, please use the following BibTeX entries
101105
}
102106
```
103107

104-
## Acknowledgements
108+
PCEngine paper is accepted by MLSys 2023:
109+
110+
```bibtex
111+
@inproceedings{hong2023pcengine,
112+
title={{Exploiting Hardware Utilization and Adaptive Dataflow for Efficient Sparse Convolution in 3D Point Clouds}},
113+
author={Hong, Ke and Yu, Zhongming and Dai, Guohao and Yang, Xinhao and Lian, Yaoxiu and Liu, Zehao and Xu, Ningyi and Wang, Yu},
114+
booktitle={Sixth Conference on Machine Learning and Systems (MLSys)},
115+
year={2023}
116+
}
117+
```
118+
119+
## Acknowledgement
120+
121+
We thank Yan Yan from TuSimple for helpful discussions.
105122

106-
TorchSparse is inspired by many existing open-source libraries, including (but not limited to) [MinkowskiEngine](https://github.com/NVIDIA/MinkowskiEngine), [SECOND](https://github.com/traveller59/second.pytorch) and [SparseConvNet](https://github.com/facebookresearch/SparseConvNet).
123+
Please also have a look at the [dgSparse](https://dgsparse.github.io/) library, which is designed for fast and efficient sparse computation on graphs and point clouds. The work from PCEngine (MLSys 2023) team is also highly related to us.

docs/figs/eval_benchmark.png

467 KB
Loading

docs/figs/train_benchmark.png

172 KB
Loading

0 commit comments

Comments
 (0)