I wrote a article to explain how sparse convolution works with detail.
Implementation of sparse convolution is quite different from traditional dense convolution in GPU level.
this project is a lightweight version of spconv project by Yan Yan
The work in this repository is mainly involved with following papers:
I made following major changes:
Github do not support math rendering, this document can be rendered by e.g. MathJax.
this library has been used in my repo second_lite
My results
python setup.py bdist_wheel
pull the builder container
docker pull masszhou/toolchains:dev-spconv-lite-1.0
to build spconv_lite, under the root path of this project {spconv_lite_root}/
run
docker build -t masszhou/spconv_lite:1.0 -f docker/build_spconv_lite.Dockerfile .
start a container by
docker run -d masszhou/spconv_lite:1.0
copy pip package to host, then install package in your virtualenv
docker cp <CONTAINER_ID>:/root/spconv_lite/dist/spconv_lite-1.0.0-cp38-cp38-linux_x86_64.whl .
pip install spconv_lite-1.0.0-cp38-cp38-linux_x86_64.whl
shutdown container
docker stop <CONTAINER_ID>
run unittest under {spconv_lite_root}/unittest
python -m test.test_all
here we asumme the input siginal is 2D with channel=3, like a image. 2D signal is easier to draw the tensor. There is no essential difference for the convolution between 2D and 3D signals.
consider a image similar signal, which contains only sparse data. P1, P2 are data points. other cells are zeros.
notation:
notation:
as we can see from the figure. the output is also sparse. there are two kinds of definitions, which proposed by 3D Semantic Segmentation with Submanifold Sparse Convolutional Networks
In the program, we can choose either of these definitions, depends on the application.
The project is derived from spconv
The spconv code is licensed under Apache-2.0 License The CUDPP hash code is licensed under BSD License. The robin-map code is licensed under MIT license.
Besides, if you want directly use any of the figures for algorithm explanation, which were my original works and could be used in my future publications, so please cite this repo for these figures.
Thanks