This repository contains the implementation of OctFormer. The code is released under the MIT license.
OctFormer: Octree-based Transformers for 3D Point Clouds
Peng-Shuai Wang
ACM Transactions on Graphics (SIGGRAPH), 42(4), 2023
The code has been tested on Ubuntu 20.04 with 4 Nvidia 3090 GPUs (24GB memory).
-
Install Conda and create a
Conda
environment.conda create --name octformer python=3.8 conda activate octformer
-
Install PyTorch-1.12.1 with conda according to the official documentation.
conda install pytorch==1.12.1 torchvision torchaudio cudatoolkit=11.3 -c pytorch
-
Clone this repository and install the requirements.
git clone https://github.com/octree-nn/octformer.git cd octformer pip install -r requirements.txt
-
Install the library for octree-based depthwise convolution.
git clone https://github.com/octree-nn/dwconv.git pip install ./dwconv
-
To run the detection experiments, mmdetection is required. Please refer to the official documentation for installation.
-
Data: Download the data from the ScanNet benchmark. Unzip the data and place it to the folder <scannet_folder>. Run the following command to prepare the dataset.
python tools/seg_scannet.py --run process_scannet --path_in <scannet_folder>
-
Train: Run the following command to train the network with 4 GPUs and port 10001. The mIoU on the validation set without voting is 74.8, the training log and weights can be downloaded here.
python scripts/run_seg_scannet.py --gpu 0,1,2,3 --alias scannet --port 10001
-
Evaluate: Run the following command to get the per-point predictions for the validation dataset with a voting strategy. And after voting, the mIoU is 76.3 on the validation dataset.
python scripts/run_seg_scannet.py --gpu 0 --alias scannet --run validate
-
Data: Run the following command to prepare the dataset.
python tools/cls_modelnet.py
-
Train: Run the following command to train the network with 1 GPU. The classification accuracy on the testing set without voting is 92.7%. And the training log and weights can be downloaded here.
python classification.py --config configs/cls_m40.yaml SOLVER.gpu 0,