Yolov5 environment configuration and common problem handling under #anaconda

Yolov5 environment configuration and common problem handling under anaconda

Essential software

Anaconda has been installed by default. Students who have not installed it can install it from the following website:
Tsinghua mirror: https://mirrors.tuna.tsinghua.edu.cn/

1. Virtual environment creation

(1)Enter anaconda prompt

(2) Create a virtual environment

Insert image description here

conda create -n yolov5500 python=3.8

The python version is selected based on the yolo version you downloaded;

(3) Activate the environment and configure Tsinghua Source

Insert image description here

conda activate yolov5500

(4) Configure Tsinghua Source

The purpose of configuring Tsinghua Source is to speed up the download of subsequent related installation packages;
1. Open the following URL:
https://mirrors.tuna .tsinghua.edu.cn/help/pypi/
Insert image description here
2. Scroll down to find the following code:
Insert image description here
Copy the second line of code:

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

3. Return to the terminal (virtual environment) interface, paste the code and execute
Insert image description here
Complete configuration
Insert image description here

2. Preparations for installing Pytorch

1. Determine the computer configuration, open the NVIDIA Control Panel
Insert image description here
and click the lower left cornerSystem Information: a> For 16XX graphics cards, install cu102;
Determine the cuda version 12.2, and then install pytorch. The cuda version must be less than 12.2, and it must be applicable to your own graphics card version: This time, install graphics card 1050TI;



Insert image description here

3.Install Pytorch

1. Open the Pytorch official website
Find version 1.8.2
Insert image description here
Insert image description here
Scroll down to find the following code and copy it:
Insert image description here

pip3 install torch==1.8.2 torchvision==0.9.2 torchaudio==0.8.2 --extra-index-url https://download.pytorch.org/whl/lts/1.8/cu111

2. Return to the virtual environment, paste the code and execute it
Insert image description here
After the execution is completed, enter the following code:

python
import torch
torch.ones(3).cuda()

Run the code and get the following results, proving that the pytorch installation is complete:
Insert image description here
3. Install Yolov5
Open the website to download yolov5:
https://github.com/ultralytics/yolov5
Insert image description here

ClickReleases to download the source code and unzip it to the directory you want to unzip:
Insert image description here
Insert image description here

Open requirements.txt in the decompressed file:
Modify the following four places, as shown below
Insert image description here
Insert image description here

Click to extract the folder, enter cmd:
Insert image description here
Enter cmd, and press Enter:
Insert image description here
Insert image description here
Input:

conda activate yolov5500

Insert image description here
Please note that the next operation must be closedDisciple:
Enter the code: < a i=4>Complete the installation interface: If a similar error occurs, it is likely that you did notclose DiscipleorThe agent is open and needs to be closed manually
pip install -r requirements.txt

Insert image description here

Insert image description here

Finally, execute the following code to test whether the installation is successful?

python detect.py

Success interface:
Insert image description here
Find runs\detect\exp2 in the installation directory, and the following picture will be displayed. Now that the installation is complete, you can continue learning~< /span>

Insert image description here

##References
Boss "You are a Virgo": https://www.bilibili.com/video/BV1bg4y1R7cs /?spm_id_from=333.788&vd_source=e38ab283979a6c9e04d5b5069ed35b0d

Guess you like

Origin blog.csdn.net/m0_48991950/article/details/134588425