yolov5 introduction and environment construction

1.  Environmentconstruction

1.1 Install Anaconda _ 

        Anaconda  is a Python distribution for scientific computing , supports Linux , Mac , Windows , and contains many popular Python packages for scientific computing and data analysis .   

Anaconda download address:

Tsinghua      mirror : https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ _ _ _ _ _ _ _ _ _ _ _ _ _

Official website mirror      : https://repo.anaconda.com/archive/ _ _ _ _ _ _

Here we choose Python 3.6.5 version as an example, select the corresponding Anaconda version to download, here select Anaconda 3-

5.2.0 - Windows - x86_64.exe . _ _ Specific version correspondence reference blog:   blog https://blog.csdn.net/heivy/article/details/92992887?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2~default~CTRLIST ~default-2.pc_relevant_default&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2~default~CTRLIST~default-2.pc_relevant_default&utm_relevant_index=5

During the installation, check the Add  path option.

 If the host does not have a graphics card , skip steps 1.2  , 1.3 , and 1.6. In step  1.5 , select the CPU version when installing Pytorch , and check the graphics card type. You can open it in the control panel, or find it under the windows startup item. 

 1.2  Check the graphics carddriver

Enter the NVIDIA control panel , check the system information under the help tab, and find your CUDA version number. If the version number is too low, update the graphics card driver first.

 1.3 Download and installation of  CUDA and Cudnn

Here you can choose to download CU DA 10.2. You can choose the corresponding configuration according to your current system and download it. After downloading, choose custom installation, and check all the next steps.


Cuda official website download, the corresponding table between the local graphics card driver and cuda, cudnn, pytorch, torchvision installation version, and the method of completely uninstalling CUDA For CUDA suitable for this machine, first Win+R, enter powershell, and then enter the nvidia-smi command to view the local Driver Version. You can also use other methods to check the driver version of the machine, and then download the required CUDA version corresponding to the figure below to prevent timeliness from updating this article in time. Click me to enter the official website of the machine and the CUDA version that needs to be downloaded. cuDNN version corresponds to prevent timeliness from updating this article in time, click me to enter the official website corresponding to CUDA and cuDNN version Step 3: Select https://blog.csdn.net/qq_37700257/article/details/120617200 according to CUDA , refer to the above article.

Then download Cudnn , address :   Cudnn official website ,

Here you need to register before downloading, select the Cudnn version corresponding to CUDA 10.2 . 

After the download is complete, unzip the Cudnn package, copy the contents of the folder, and paste it to the C :\ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v 10.1 directory.   

1.4  Create PyTorch environment

Different projects require different virtual environments, which can handle incompatibility between different versions of projects .

  Enter the Anaconda  Prompt command window

 Open the anaconda prompt tool and enter the following: conda  create  -n PyTorch python =3.6  

 As shown in the picture, mine has already been installed. If it is not installed, select y, and if it is installed, select n. PyTorch is the name of the virtual environment (--name) - n is the abbreviation, and 3.6 is the python version. Then press y to continue installing various dependent packages.

After the creation is successful, enter the following command :

conda  info  -- envs

You can see all your environments, including the PyTorch environment you just created .

  To configure  Tsinghua TUNA image source, enter in the Anaconda Prompt  command window: conda config  -- set show_channel_urls yes   

Then you can see the .condarc file under C :\ User \ XXX , open the .condarc file with Notepad , and rewrite it as the following:

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

channels:

-  conda - forge

- defaults

You can add the Anaconda  Python free warehouse.

1.5  Install Pytorch _

Enter PyTorch official website:   PyTorch official website , the official website will automatically display the version that can be installed according to your computer, and give  commands .

 CUDA11.6 installation command:

conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia

CPU installation command:

conda install pytorch torchvision torchaudio cpuonly -c pytorch

Choose according to your own system. Copy the above command, open the Anaconda Prompt command window, enter the environment just created (the one created above is called PyTorch), and activate it through conda activate PyTorch.  

 Paste the command you just copied to download and install.

  1.6  Test

Open the Anaconda  Prompt command window, activate the environment, and enter the python development environment .

conda activate PyTorch

python

import torch

torch.cuda.is_available()

If it is true and the environment is normal, if it is false, you need to check the system and version.

At this point, the data can be cleaned up and ready to train your model.

Guess you like

Origin blog.csdn.net/qq_26420885/article/details/128657380