Construction of pytorch environment

Catalog
download and install the nvidia graphics driver
download CUDA
download CUDnn
install CUDA
installation (recommended default installation)
set the environment variable After installing
the test environment cuda
install cuDNN
installation Anaconda
installation pytorch
yolov5 cloning project and install
on labelimg markup tools:

**

Download and install nvidia graphics driver

**After
installation, cmd to run nvidia-smi,
if it does not work, add C:\Program Files\NVIDIA Corporation\NVSMI to the path of the environment variable. Then reopen the cmd window.

Download CUDA

https://developer.nvidia.com/cuda-downloads?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal
download cuda_10.2.89_441.22_win10.exe

(If your download is only tens of B in size, it may be a problem with the download. Try again after changing the network.)

Download CUDnn

https://developer.nvidia.com/cudnn
download and get cudnn-10.2-windows10-x64-v7.6.5.32.zip

(If your download is only tens of B in size, it may be a problem with the download. Try again after changing the network.)

Install CUDA

Installation (default installation is recommended)
Set environment variables after installation After
installation, you can see that there are two more environment variables, CUDA_PATH and CUDA_PATH_V10_2, in the system.
At this time we need to add some environment variables:
Insert picture description here
CUDA_SDK_PATH = C:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.2
CUDA_LIB_PATH=%CUDA_PATH%\lib\x64
CUDA_BIN_PATH = %CUDA_PATH%\bin
CUDA_SDK_BIN_PATH=%CUDA_SDK_PATH%\bin\ win64
CUDA_SDK_LIB_PATH = %CUDA_SDK_PATH%\common\lib\x64

C:\ProgramData\NVIDIACorporation\CUDA Samples\v10.2 is the default installation location, if it is not the default installation, you need to make corresponding modifications

Add at the end of the system variable Path:
%CUDA_LIB_PATH%;%CUDA_BIN_PATH%;%CUDA_SDK_LIB_PATH%;%CUDA_SDK_BIN_PATH%;

Add the following 5 more items (default installation path):
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\lib\x64
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include
C :\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\extras\CUPTI\lib64
C:\ProgramData\NVIDIA Corporation\CUDA\Samples\v10.2\bin\win64
C:\ProgramData\NVIDIA Corporation\CUDA\ Samples\v10.2\common\lib\x64

Test the cuda environment

Open CMD to execute:
nvcc -V
Insert picture description here

Install cuDNN

Copy the cudnn file.
For cudnn, unzip the compressed package directly, and then copy and paste the files in bin, include, and lib to the cuda folder
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2

Install Anaconda

  1. Download the installation package
    Anaconda Download the Windows version: https://www.anaconda.com/products/individual
  2. Then install anaconda
  3. Add Aanaconda domestic mirror configuration
    Tsinghua TUNA provides a mirror of the Anaconda warehouse, run the following command

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes

Install pytorch

Note: You need to install pytorch 1.6 or above to create a virtual environment. The environment name can be determined by yourself. Here I use pytorch1.7 as the environment name:
conda create -n pytorch1.7 python=3.8 After
creating it, activate the pytorch1.7 environment:
conda activate The pytorch1.7
installation command is on the official website
Insert picture description here

Copy it to get the commands needed for installation
yolov5 project clone and install
Install Git software (https://git-scm.com/downloads)
clone the project to the local (such as d:)
git clone https://github.com/ultralytics /yolov5.git

Install required libraries

Use Tsinghua mirroring source:
execution path at yolov5
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
Note: simple and no less, is not http https

About labelimg labeling tool:
https://github.com/tzutalin/labelImg

Just operate on it

Guess you like

Origin blog.csdn.net/weixin_44517301/article/details/114156083