【自动驾驶】PETR 环境安装与测试

1.环境安装

该工程依赖MMCV, MMDetection, MMDetection3d,MMSegmentation

Install MMCV

pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html

examples:

pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html

Install MMDetection

git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
git checkout v2.24.1 
sudo pip install -r requirements/build.txt
sudo python3 setup.py develop
cd ..

Install MMSegmentation.

sudo pip install mmsegmentation==0.20.2

Install MMDetection3D

git clone  https://github.com/open-mmlab/mmdetection3d.git
cd mmdetection3d
git checkout v0.17.1 
sudo pip install -r requirements/build.txt
sudo python3 setup.py develop
cd ..

Install PETR

git clone https://github.com/megvii-research/PETR.git
cd PETR
mkdir ckpts
mkdir data
ln -s {mmdetection3d_path} ./mmdetection3d
ln -s {nuscenes_path} ./data/nuscenes

examples

git clone https://github.com/megvii-research/PETR.git
cd PETR
mkdir ckpts ###pretrain weights
mkdir data ###dataset
ln -s ../mmdetection3d ./mmdetection3d
ln -s /data/Dataset/nuScenes ./data/nuscenes

问题

1.如果git 下载不了,就找到相应的版本下载,在放在目录,本地编译
2.中间有安装失败的情况就换个镜像源,清华,阿里,豆瓣都试试;遇到某个库安装失败,同样试试换个镜像源。

2.数据准备

先下载 nuScenes数据备用

目标检测数据

python tools/create_data.py nuscenes --root-path ./data/nuscenes --out-dir ./data/nuscenes --extra-tag nuscenes

分割数据

python tools/create_data.py nuscenes --root-path ./data/nuscenes --out-dir ./data/nuscenes --extra-tag nuscenes

问题

脚本运行出错:

  File "/opt/conda/envs/PETR/lib/python3.6/site-packages/shapely/geos.py", line 94, in 
   _lgeos = CDLL(os.path.join(sys.prefix, 'lib', 'libgeos_c.so'))
 File "/opt/conda/envs/PETR/lib/python3.6/ctypes/__init__.py", line 348, in __init__
   self._handle = _dlopen(self._name, mode)
OSError: /opt/conda/envs/PETR/lib/libgeos_c.so: cannot open shared object file: No such file or directory

解决

(PETR) root@0943aeca2165:/data/work/PETR/tools# find / -name libgeos*
/usr/share/doc/libgeos-dev
/usr/share/doc/libgeos-c1v5
/usr/share/doc/libgeos-3.5.0
/usr/lib/x86_64-linux-gnu/libgeos_c.so
/usr/lib/x86_64-linux-gnu/libgeos_c.so.1
/usr/lib/x86_64-linux-gnu/libgeos_c.a
/usr/lib/x86_64-linux-gnu/libgeos-3.5.0.so
/usr/lib/x86_64-linux-gnu/libgeos_c.so.1.9.0
/opt/conda/lib/python3.6/site-packages/shapely/.libs/libgeos--no-undefined-b94097bf.so
/opt/conda/lib/python3.6/site-packages/shapely/.libs/libgeos_c-a68605fd.so.1.13.1
/var/lib/dpkg/info/libgeos-dev.md5sums
/var/lib/dpkg/info/libgeos-3.5.0.list
/var/lib/dpkg/info/libgeos-3.5.0.symbols
/var/lib/dpkg/info/libgeos-c1v5.triggers
/var/lib/dpkg/info/libgeos-c1v5.shlibs
/var/lib/dpkg/info/libgeos-3.5.0.triggers
/var/lib/dpkg/info/libgeos-dev.list
/var/lib/dpkg/info/libgeos-c1v5.list
/var/lib/dpkg/info/libgeos-c1v5.md5sums
/var/lib/dpkg/info/libgeos-3.5.0.shlibs
/var/lib/dpkg/info/libgeos-3.5.0.md5sums
/var/lib/dpkg/info/libgeos-c1v5.symbols
(PETR) root@0943aeca2165:/data/work/PETR/tools# ln -s /usr/lib/x86_64-linux-gnu/libgeos_c.so  /opt/conda/envs/PETR/lib/libgeos_c.so

3.可视化测试

./tools/dist_test.sh projects/configs/petr/petr_vovnet_gridmask_p4_800x320.py ./ckpts/PETR-vov-p4-800x320/epoch24.pth 8 --out work_dirs/pp-nus/results_eval.pkl --format-only --eval-options 'jsonfile_prefix=work_dirs/pp-nus/results_eval'
python3 tools/visualize.py

【自动驾驶】PETR 环境安装与测试_第1张图片

你可能感兴趣的:(自动驾驶与3D视觉,自动驾驶,人工智能,机器学习)