After configuring the most basic environment, start our formal yoloV5 test.
For details on the basic configuration tutorial: https://blog.csdn.net/u010416569/article/details/125981012
3. Check the cuda and cudnn versions suitable for your graphics card
1. Check the CUDA suitable for your graphics card
Open the Nvidia control panel,
enter the system information in the lower left corner,
click on the component to see the CUDA version suitable for your Nvidia graphics card
2. Check the cudnn corresponding to your cuda version
If there is no version you need in the picture, you can check CUDNN on Nvidia official website
4. Download the corresponding pytorch, cuda and cudnn versions
Change channel (for faster download)
1. Open the .condarc file in the directory of C:\Users\SKY in txt format
2. Copy all the following codes into the txt
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud`
Download the corresponding pytorch, cuda and cudnn
-1. Enter the official website to find the corresponding pytorch version
Official website link: https://pytorch.org/get-started/locally/
Choose according to your needs, as shown in the figure, we use cuda11.1 as an example
conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge
-2. Open cmd and activate the environment you configured for yolov5
activate 你的环境名
-3. Download pytorch
and enter the code copied in the previous step
downloading
Download completed
3. View the configuration in the environment
Enter the following code to view the configuration in the environment
conda list
The following is the configuration that should be in the environment at this step, mainly looking at these two
cudatoolkit 11.1.1 heb2d755_7 conda-forge
pytorch 1.9.0 py3.8_cuda11.1_cudnn8_0 pytorch
(This cudatoolkit is included in the pytorch package downloaded from the official website, so there is no need to download another CUDA)
(yolo) C:\Users\SKY>conda list
packages in environment at C:\me\Anaconda3\envs\yolo:
Name Version Build Channel
blas 2.111 mkl conda-forge
blas-devel 3.9.0 11_win64_mkl conda-forge
ca-certificates 2021.7.5 haa95532_1 https://repo.anaconda.com/pkgs/main
certifi 2021.5.30 py38haa95532_0 https://repo.anaconda.com/pkgs/main
cudatoolkit 11.1.1 heb2d755_7 conda-forge
freetype 2.10.4 h546665d_1 conda-forge
intel-openmp 2021.3.0 h57928b3_3372 conda-forge
jpeg 9b hb83a4c4_2 defaults
libblas 3.9.0 11_win64_mkl conda-forge
libcblas 3.9.0 11_win64_mkl conda-forge
liblapack 3.9.0 11_win64_mkl conda-forge
liblapacke 3.9.0 11_win64_mkl conda-forge
libpng 1.6.37 h1d00b33_2 conda-forge
libtiff 4.2.0 hd0e1b90_0 defaults
libuv 1.42.0 h8ffe710_0 conda-forge
lz4-c 1.9.3 h8ffe710_1 conda-forge
m2w64-gcc-libgfortran 5.3.0 6 conda-forge
m2w64-gcc-libs 5.3.0 7 conda-forge
m2w64-gcc-libs-core 5.3.0 7 conda-forge
m2w64-gmp 6.1.0 2 conda-forge
m2w64-libwinpthread-git 5.0.0.4634.697f757 2 conda-forge
mkl 2021.3.0 hb70f87d_564 conda-forge
mkl-devel 2021.3.0 h57928b3_565 conda-forge
mkl-include 2021.3.0 hb70f87d_564 conda-forge
msys2-conda-epoch 20160418 1 conda-forge
ninja 1.10.2 h5362a0b_0 conda-forge
numpy 1.21.2 py38h089cfbf_0 conda-forge
olefile 0.46 pyh9f0ad1d_1 conda-forge
openssl 1.1.1k h8ffe710_1 conda-forge
pillow 8.3.1 py38h4fa10fc_0 defaults
pip 21.0.1 py38haa95532_0 https://repo.anaconda.com/pkgs/main
python 3.8.11 h6244533_1 https://repo.anaconda.com/pkgs/main
python_abi 3.8 2_cp38 conda-forge
pytorch 1.9.0 py3.8_cuda11.1_cudnn8_0 pytorch
setuptools 52.0.0 py38haa95532_0 https://repo.anaconda.com/pkgs/main
sqlite 3.36.0 h2bbff1b_0 https://repo.anaconda.com/pkgs/main
tbb 2021.3.0 h2d74725_0 conda-forge
tk 8.6.11 h8ffe710_0 conda-forge
torchaudio 0.9.0 py38 pytorch
torchvision 0.10.0 py38_cu111 pytorch
typing_extensions 3.10.0.0 pyha770c72_0 conda-forge
vc 14.2 h21ff451_1 https://repo.anaconda.com/pkgs/main
vs2015_runtime 14.27.29016 h5e58377_2 https://repo.anaconda.com/pkgs/main
wheel 0.37.0 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/main
wincertstore 0.2 py38_0 https://repo.anaconda.com/pkgs/main
xz 5.2.5 h62dcd97_1 conda-forge
zlib 1.2.11 h62dcd97_1010 conda-forge
zstd 1.4.9 h6255e5f_0 conda-forge
We can see that although there are cuda and pytorch in the environment, there is no cudnn, so we need to download a corresponding version of cudnn
enter
conda install cudnn==8.1.0
(该cudnn版本应与你的cuda对应,具体看上方教程)
Five, configure Yolov5 related environment
1. Download Yolov5
can be downloaded through this link https://github.com/ultralytics/yolov5
You can also download the yolov5 version I am using through my Baidu cloud https://pan.baidu.com/s/1cG6Cle2N4G274TdnnOB0Wg
Extraction code: cqdy
2. Configure the environment required by Yolov5. We unzip the downloaded yolov5 compressed package and open it.
Note that the yolov5 file should be placed in a pure English path
. Find a txt file named requirements.txt
Copy this paragraph, as follows
pip install -r requirements.txt
Open CMD, activate your configured environment, and enter the yolov5 file path you decompressed
activate yolo
cd C:\Users\SKY\Downloads\yolov5-4.0(cd到你自己安装yolov5的文件路径)
输入 pip install -r requirements.txt
Then the environment we need for yolov5 is configured
3. Download Yolov5 weight file
Link: https://pan.baidu.com/s/1RkbcY07rpKSFcDZKzM5R0g
Extraction code: cqdy
Place the weight file in the yolov5 file
6. Test whether Yolov5 can be used normally
1. Download pycharm
official website download https://www.jetbrains.com/pycharm/download/#section=windows
Baidu cloud download link: https://pan.baidu.com/s/10clX9scYVFSwGrA9bR1Org
Extraction code: cqdy
2. Configure pycharm
to open pycharm
3. Test whether yolov5 can be used normally,
right click to run the program
You can see that our CUDA is in normal use
After the operation is completed, it tells us that the result is placed in exp3, let's click to see
The test was successful.
In summary, in this process, many problems will be encountered. And everyone's problems are different. For the sake of simplicity of the tutorial, we will not expand on the problems encountered. There will be an opportunity later to compile a post dedicated to common problems. thank you all!