frustum-pointnets復現過程+遇到的問題+解決方法
系統Ubuntu16.04
1.下載KITTI數據集:
並按照README中的格式解壓並重組數據集:
2.運行環境配置:
在復現KPConv的環境(‘python3’)下繼續,首先安裝一些包,已經安裝的包不再安裝(可KPConv復現鏈接中查看):
conda install pillow
pip install opencv-python
3.數據準備
在對應目錄終端下,運行sh scripts/command_prep_data.sh
4.修改部分代碼
(1)frustum-pointnets/train/provider.py
import cPickle as pickle ----> import _pickle as pickle
將self.id_list = pickle.load(fp)
等涉及pickle.load
的函數,修改爲
self.id_list = pickle.load(fp, encoding='latin1') # or “ encoding='iso-8859-1' ”
(2)frustum-pointnets/kitti/kitti_util.py
將cv2.CV_AA
修改爲cv2.LINE_AA
(因爲opencv-python==4.1.0.25)
(3)frustum-pointnets/kitti/prepare_data.py
import cPickle as pickle ----> import _pickle as pickle
(4)遇到問題:TypeError: 'float' object cannot be interpreted as an integer
解決辦法:frustum-pointnets/train/train.py
train_one_epoch函數和eval_one_epoch函數中:
num_batches = len(TRAIN_DATASET)/BATCH_SIZE
---->
num_batches = len(TRAIN_DATASET)//BATCH_SIZE
5.運行CUDA_VISIBLE_DEVICES=0 sh scripts/command_train_v1.sh
6.修改部分代碼
(1)遇到問題:TabError: inconsistent use of tabs and spaces in indentation
解決辦法:frustum-pointnets/train/test.py
修改line 231
和line 310
中的batch_output, batch_center_pred, \
語句,將該語句前面的tab換成空格。
(2)frustum-pointnets/train/test.py
import cPickle as pickle ----> import _pickle as pickle
(3)frustum-pointnets/train/test.py
在 def inference(sess, ops, pc, one_hot_vec, batch_size)中:
num_batches = pc.shape[0]/batch_size
---->
num_batches = pc.shape[0]//batch_size
(4)需要重新編譯frustum-pointnets/train/kitti_eval/evaluate_object_3d_offline:
g++ evaluate_object_3d_offline.cpp
遇到問題:
fatal error: boost/numeric/ublas/matrix.hpp: No such file or directory
解決辦法:
sudo apt-get update
sudo apt-get install libboost-all-dev
(5)遇到問題:
sh: 1: gnuplot: not found
sh: 1: pdfcrop: not found
解決辦法:
sudo apt-get install libx11-dev
sudo apt-get install gnuplot
sudo apt install texlive-extra-utils
7.運行CUDA_VISIBLE_DEVICES=0 sh scripts/command_test_v1.sh
8.修改部分代碼
(1)遇到問題:
tf_sampling_compile.sh: 2: tf_sampling_compile.sh: /usr/local/cuda-8.0/bin/nvcc: not found
g++: error: tf_sampling_g.cu.o: No such file or directory
解決辦法:
在frustum-pointnets/model/tf_ops/sampling/下打開終端:
conda activate python3
(2)
9.運行CUDA_VISIBLE_DEVICES=0 sh scripts/command_test_v2.sh
10.git上下載frustum-pointnets-view-results,然後修改view_results.py中:
找到line 32
、line 40
、line 41
、line 213
、line 216
的語句,將該語句前面的tab換成空格,然後運行python kitti/view_results.py
未完待續…