learn better from others,
be the better one.
—— "Weika Zhixiang"
The length of this article is 1108 words , and it is expected to read for 4 minutes
foreword
Target detection yolov5 is still used more, this article is a brief introduction to the installation of yolov5.
Installation Environment
System: Windows
Environment: MiniConda
01
Download the source code of yolov5
Source address: https://github.com/ultralytics/yolov5
Created a yolov5 folder locally and downloaded it directly.
02
Create and activate a virtual environment
Open Anaconda Powershell Prompt (miniconda3)
Create a virtual environment, here I have created it before, so only the creation code is listed
conda create -n your_env_name python=x.x -y
# 我的是
conda create -n yolov5 python=3.9 -y
Activate the current virtual environment
conda activate yolov5
As you can see from the above picture, after activation, the front becomes yolov5
03
Install required third-party libraries
First enter the folder where we downloaded yolov5
Then enter at the command line
pip install -r requirement.txt
It can also be the installation of the mirror image below, which will be faster, but my network speed is problematic, I have installed it many times, and finally it is finished
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
04
Download the pretrained model file
Model file address:
https://github.com/ultralytics/yolov5/releases/tag/v7.0
It has been updated to the latest version 7.0, but it still comes back to the problem of network speed. The network in the hotel outside is really not working, and the download is incomplete after a long time. Finally, I found a way and recommended a website:
https://d.serctl.com/
For files on Github, you can directly enter the link here, and then download it from here.
Copy the downloaded pre-trained model files to the yolov5 folder. In this way, the installation environment of Yolov5 is completely completed.
Micro card Zhixiang
Test Yolov5
Use VS Code to open the yolov5 folder
Find the detect.py file. In the above figure, parse_opt is a default parameter that can be set using command line operations. But I still prefer to run with a compiler.
The detection result of the operation can finally be seen under runs\detect\exp31 is the result of the operation, find the directory
In the picture above, there are only two pictures by default. I copied some of them myself to see the effect.
The detection is no problem at all, so the environment of yolov5 is set up.
over
Wonderful review of the past
Getting started with pyTorch (5) - training your own data set
Getting started with pyTorch (4) - export the Minist model, C++ OpenCV DNN for recognition