Ubuntu18.04+2070s+TF2.x环境,单卡训练PointNet++实战
1. 编译tf_ops文件夹下的三个动态库
该文件夹下定义了一些pointnet++模型中需要使用的cuda核函数,如FPS(最远点采样)、grouping等,所以在训练模型前,需要先编译这些自定义的op
具体操作:
在每一个子文件夹中,运行sh tf_xxx.sh
(每个子文件夹中不一样,tab一下就出来了)。
有可能需要根据自己的环境,对sh文件进行修改,例如我的环境中,cuda、tensorflow的版本、安装位置和作者都不一样,因此进行了一些头文件、库文件的路径修改,如下:
#/bin/bash
/usr/local/cuda/bin/nvcc tf_sampling_g.cu -o tf_sampling_g.cu.o -c -O2 -DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC
# 原命令 /usr/local/cuda-8.0/bin/nvcc tf_sampling_g.cu -o tf_sampling_g.cu.o -c -O2 -DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC
# TF1.2
g++ -std=c++11 tf_sampling.cpp tf_sampling_g.cu.o -o tf_sampling_so.so -shared -fPIC -I /home/hikai/.local/lib/python3.6