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
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
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/
2. Scroll down to find the following code:
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
Complete configuration
2. Preparations for installing Pytorch
1. Determine the computer configuration, open the NVIDIA Control Panel
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;
3.Install Pytorch
1. Open the Pytorch official website
Find version 1.8.2
Scroll down to find the following code and copy it:
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
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:
3. Install Yolov5
Open the website to download yolov5:
https://github.com/ultralytics/yolov5
ClickReleases to download the source code and unzip it to the directory you want to unzip:
Open requirements.txt in the decompressed file:
Modify the following four places, as shown below
Click to extract the folder, enter cmd:
Enter cmd, and press Enter:
Input:
conda activate yolov5500
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
Finally, execute the following code to test whether the installation is successful?
python detect.py
Success interface:
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>
##References
Boss "You are a Virgo": https://www.bilibili.com/video/BV1bg4y1R7cs /?spm_id_from=333.788&vd_source=e38ab283979a6c9e04d5b5069ed35b0d