1 创建 python3.9 环境

1
2
conda create -n pointnet2_ops python=3.9
source activate pointnet2_ops

2 更改 nvcc 版本

1
2
3
4
cd /M3DM
conda search cuda-nvcc -c nvidia
conda install cuda-nvcc=11.3.58 -c nvidia
nvcc -V

3 安装 pytorch

1
pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

或 (为使用 torch.frombuffer,推荐兼容性更高的新版本)

1
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113

4 安装通用工具包

1
2
3
4
pip install -r requirements.txt
pip install numpy==1.26 (要求python≥3.9)
pip install ninja
pip install open3d (要求python≤3.11)

5 安装老版本 GCC (≤8)

1
2
3
4
sudo apt-get install g++-8
sudo apt-get install gcc-8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 20

6 安装 pointnet2_ops_lib

1
2
3
4
5
6
pip install --upgrade pip
pip install --upgrade setuptools
pip install Pointnet2_PyTorch/pointnet2_ops_lib/.
Successfully built pointnet2-ops
Installing collected packages: pointnet2-ops
Successfully installed pointnet2-ops-3.0.0

7 安装 KNN-CUDA

1
2
3
cd packages
wget https://github.com/unlimblue/KNN_CUDA/releases/download/0.2/KNN_CUDA-0.2-py3-none-any.whl
pip install pakages/KNN_CUDA-0.2-py3-none-any.whl

参考文献

[1] Wang Y, Peng J, Zhang J, et al. Multimodal industrial anomaly detection via hybrid fusion[C]//Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2023: 8032-8041.
[2] Costanzino A, Ramirez P Z, Lisanti G, et al. Multimodal industrial anomaly detection by crossmodal feature mapping[C]//Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2024: 17234-17243.
[3] Chu Y M, Liu C, Hsieh T I, et al. Shape-Guided Dual-Memory Learning for 3D Anomaly Detection[C]//International Conference on Machine Learning. PMLR, 2023: 6185-6194.