深度学习之旅---Pytorch搭建Faster RCNN目标检测平台(环境搭建篇)

深度学习之旅---Pytorch搭建Faster RCNN目标检测平台(环境搭建CUDA、torch、cupy)

安装Cudnn和CUDA

我这里使用的是torch=1.2.0,官方推荐的Cuda版本是10.0,因此会用到cuda10.0,与cuda10.0对应的cudnn是7.4.1.5,这个组合我实验过了,绝对是可以用的。

cuda10.0官网的地址是:
cuda10.0官网地址
cudnn官网的地址是:需要大家进去后寻找7.4.1.5。
cudnn官网地址

下载好之后可以打开cuda_10的exe文件进行安装。
在这里插入图片描述
这里选择自定义。
在这里插入图片描述
然后直接点下一步就行了。
在这里插入图片描述
安装完后在C盘这个位置可以找到根目录。
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0
然后大家把Cudnn的内容进行解压。
在这里插入图片描述
把这里面的内容直接复制到C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0下就可以了。
在这里插入图片描述

安装torch

打开pytorch的官方安装方法:
https://pytorch.org/get-started/previous-versions/
官网推荐的安装代码如下,我使用的是Cuda10的版本:

# CUDA 10.0
pip install torch===1.2.0 torchvision===0.4.0 -f https://download.pytorch.org/whl/torch_stable.html

# CUDA 9.2
pip install torch==1.2.0+cu92 torchvision==0.4.0+cu92 -f https://download.pytorch.org/whl/torch_stable.html

# CPU only
pip install torch==1.2.0+cpu torchvision==0.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html

安装cupy

CuPy是一个开源矩阵库,使用NVIDIA CUDA加速。CuPy使用Python提供GPU加速计算。CUPY使用CUDA相关库,包括 CuBLAS、CUDNN、Curand、CuoSver、CuPaSeSE、Cufft和NCCL,以充分利用GPU架构。图中显示库比比纽比加速。他们中的大多数人在使用CuPy开箱即用的GPU上表现良好。CuPy加速了一些超过100倍的操作,你可以在单个GPU中阅读原始的基准文章CuPy加速(RAPIDS AI)。

# For CUDA 8.0
pip install cupy-cuda80
 
# For CUDA 9.0
pip install cupy-cuda90
 
# For CUDA 9.1
pip install cupy-cuda91
 
# For CUDA 9.2
pip install cupy-cuda92
 
# For CUDA 10.0
pip install cupy-cuda100
 
# For CUDA 10.1
pip install cupy-cuda101
 
# Install CuPy from source
pip install cupy

安装其他所需库

# numpy
pip install numpy

# cv2
pip install opencv-python

# matplotlib
pip install matplotlib

# tqdm
pip install tqdm

Faster RCNN车辆预测结果展示

在这里插入图片描述


版权声明:本文为qq_37972108原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。