本文介绍Ubuntu下配置车道线检测算法LaneATT代码运行环境,步骤如下。
1. 从LaneATT官方代码仓库下载源码。也可git直接拉取。
2. 安装Anaconda或miniconda 。
参考:https://docs.anaconda.com/miniconda/
3. 创建conda虚拟环境LaneATT(环境名可自定义)
conda create -n LaneATT python=3.8
4. 进入虚拟环境
conda activate LaneATT
5. 安装Pytorch 1.6.0、torchvision 0.7.0、cuda 10.2
conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.2 -c pytorch
6. 在工作目录下创建LaneATT文件夹(名字可自定义),将LaneATT代码上传到该文件夹内。
7. 在命令行中切换工作目录到代码文件夹
8. 安装依赖库
pip install -r requirements.txt
9. 修改setuptools版本,否则可能报错
pip install setuptools==58.2.0
10. 切换到lib/nms路径
cd lib/nms
11. 运行setup.py
python setup.py
12. 若安装过程出现gcc报错:“gcc: error trying to exec 'cc1plus': execvp: 没有那个文件或目录,”则在虚拟环境中重新安装gcc和g++,确保两者版本一致(该错误就是gcc和g++版本不一致导致的),以下以从清华镜像源安装以8.5.0版本为例。
conda install -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main gcc_impl_linux-64=8.5.0
conda install -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main gxx_impl_linux-64=8.5.0
13. 切换回工作目录
cd –
14. 运行main.py打印help信息,若出现下图信息,则说明配置成功。
python main.py –help
15. 若出现以下numpy报错,则将numpy版本降级到1.20以下。
pip install numpy==1.18.5 -i https://pypi.tuna.tsinghua.edu.cn/simple
16. 若出现以下报错,则将protobuf降级到3.20以下。
pip install protobuf==3.19.0 -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn