使用 Python 3. 创建Anaconda 环境、下载代码并安装依赖项:
试过的环境:
lcnn-9.2:python=3.6 pytorch==1.2.0 torchvision==0.4.0 cudatoolkit=9.2
1.3.0 0.4.1
vpg-9.2:python=3.6 pytorch==1.4.0 torchvision==0.5.0 cudatoolkit=10.1
dm-b:python=3.8 pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=10.1
conda create --name planercnn python=3.6
source activate planercnn
conda install pytorch==1.4.0 torchvision==0.5.0 cudatoolkit=10.1 -c pytorch
git clone https://github.com/NVlabs/planercnn.git
conda install pip
# 去掉文件中的torch
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
# 离线安装
conda install --offline pytorch-1.4.0-py3.6_cuda10.1.243_cudnn7.6.3_0.tar.bz2
# 安装pytorch0.4.1版本
# 按下面的顺序来,不然会强制让你更新pytorch版本(有点看命)
conda install --offline pytorch-0.4.1-py36_cuda9.2.148_cudnn7.1.4_1.tar.bz2
# conda install pytorch=0.4.1 cuda92 -c pytorch
conda install torchvision=0.2.1 cuda92 -c pytorch
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
# 为了下载setuptools,python3.6版本不行,重建环境3.5
conda create --name planercnn-3.5 python=3.5
# 发现一开始创建环境时setuptools的版本是36.4.0,于是降低其版本至3.5能配的最小版本,然后在配置环境
pip install setuptools==18.3.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
conda install --offline pytorch-0.4.1-py35_cuda9.2.148_cudnn7.1.4_1.tar.bz2
conda install --offline torchvision-0.2.1-py35_1.tar.bz2
# 重头来
conda create --name planercnn python=3.7
source activate planercnn
conda install pytorch==1.4.0 torchvision==0.5.0 cudatoolkit=10.1 -c pytorch
conda install --offline pytorch-1.4.0-py3.7_cuda10.1.243_cudnn7.6.3_0.tar.bz2
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install setuptools==40.6.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
conda create --name planercnn7013 python=3.7
source activate planercnn7013
conda install --offline pytorch-1.3.0-py3.7_cuda10.1.243_cudnn7.6.3_0.tar.bz2
conda install pytorch==1.3.0 torchvision==0.4.1 cudatoolkit=10.1 -c pytorch
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install setuptools==40.6.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
# 说没有pytorch
conda create --name planercnn3.6 python=3.6
source activate planercnn3.6
conda install pytorch==1.4.0 torchvision==0.5.0 cudatoolkit=10.1 -c pytorch
conda install --offline pytorch-1.4.0-py3.6_cuda10.1.243_cudnn7.6.3_0.tar.bz2
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install setuptools==34.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
conda create --name planercnn3.6 python=3.6
source activate planercnn3.6
conda install pytorch==1.3.0 torchvision==0.4.1 cudatoolkit=10.1 -c pytorch
conda install --offline pytorch-1.3.0-py3.6_cuda10.1.243_cudnn7.6.3_0.tar.bz2
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install setuptools==34.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
conda create --name planercnn6914 python=3.6
source activate planercnn6914
conda install pytorch==1.4.0 torchvision==0.5.0 cudatoolkit=9.2 -c pytorch
conda install --offline pytorch-1.4.0-py3.6_cuda9.2.148_cudnn7.6.3_0.tar.bz2
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install setuptools==34.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
注意更改一下环境的cudnn.
Cache entry deserialization failed, entry ignored 解决方法_程序员养成之路的博客-CSDN博客
等效的,你可以使用python虚拟环境来管理依赖项:
pip install virtualenv
# 第一次是python3.7.11
python -m virtualenv planercnn
source planercnn/bin/activate
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install torch==1.2.0+cu92 torchvision==0.4.0+cu92 -f https://download.pytorch.org/whl/torch_stable.html
# 第二次
virtualenv -p /usr/bin/python3.5 planercnn-3.5
source planercnn-3.5/bin/activate
pip install torch==1.4.0+cu92 torchvision==0.4.0+cu92 -f https://download.pytorch.org/whl/torch_stable.html
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
放弃!
接下来编译nms和rroialign.可以使用以下带--arch选项的命令老构建这两个函数。
| GPU | arch |
|---|---|
| TitanX | sm_52 |
| GTX 960M | sm_50 |
| GTX 1070 | sm_61 |
| GTX 1080 (Ti), Titan XP | sm_61 |
计算机的更多细节在NVIDIA
cd nms/src/cuda/
# nvcc -c -o nms_kernel.cu.o nms_kernel.cu -x cu -Xcompiler -fPIC -arch=[arch]
# 这里我用了sm_52
nvcc -c -o nms_kernel.cu.o nms_kernel.cu -x cu -Xcompiler -fPIC -arch=sm_30
cd ../../
python build.py
cd ../
cd roialign/roi_align/src/cuda/
nvcc -c -o crop_and_resize_kernel.cu.o crop_and_resize_kernel.cu -x cu -Xcompiler -fPIC -arch=[arch]
cd ../../
python build.py
cd ../../
注:报错ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead
问题翻译过来就是 torch.utils.ffi被弃用了,需要其他的包来代替(如下方法可解决)
第一步
在build.py文件中的找到语句:
from torch.utils.ffi import create_extension(共一处)
将其改为:
from torch.utils.cpp_extension import BuildExtension
第二步
在build.py文件中的找到语句
ffi = create_extension(…) 共一处
将其改为:
ffi = BuildExtension(…)
注:报错TypeError: dist must be a Distribution instance
问题应该就是setuptools的版本太新。更换较低版本。最后发现是python版本不对,0.9.8要求python2.7。但是环境是python3.6的
pip install setuptools==34.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install setuptools==18.3.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
wget https://pypi.python.org/packages/source/s/setuptools/setuptools-0.9.8.tar.gz
tar zxvf setuptools-0.9.8.tar.gz
cd setuptools-0.9.8/
sudo python setup.py install
cd
sudo easy_install pip
sudo aptitude install libffi-dev
git clone git@github.com:openstack/swift.git
cd swift/
sudo python setup.py install(这句修不好了)
注:报错Please make sure you have the correct access rights and the repository exists.
可以看一下这篇博客:github链接问题

被折叠的 条评论
为什么被折叠?



