当前位置:网站首页>Detailed explanation of yolov5 training own data set
Detailed explanation of yolov5 training own data set
2022-07-03 05:07:00 【TT ya】
Beginner little rookie , I hope it's like taking notes and recording what I've learned , Also hope to help the same entry-level people , I hope the big guys can help correct it ~ Tort made delete .
Catalog
Two 、 Environment configuration
6、 ... and 、 Result presentation
One 、YOLOv5 Source download
Website Guide :GitHub - ultralytics/yolov5: YOLOv5 in PyTorch > ONNX > CoreML > TFLite
use git Cloned
Two 、 Environment configuration
There is a file in the folder requirements.txt, Here is the description of environment dependency
We input... At the terminal pip install -r requirements.txt Download the installation dependency package
3、 ... and 、 Create a dataset
Create your own data set according to your needs
Here you can see previous blogs
Make your own dataset _tt Ya's blog -CSDN Blog
stay YOLOv5 Create a folder in the directory data1 To load our data
then data1 Next is images and labels

notes : The folder name here should be images and labels, Otherwise, there will be all kinds of errors , The reason why I'm too lazy to go anywhere , Let him run first (label You will also report mistakes. , Add a s Then he behaved )

Four 、 Change configuration
1、coco128.yaml
His default training set is coco128, So I want to be lazy , Directly in coco128.yaml Change it into mine ![]()

coco128.yaml The file in yolov5/data Folder
Here is my configuration
path: ../data1 # dataset root dir
train: images/train # train images (relative to 'path') 128 images
val: images/train # val images (relative to 'path') 128 images
test: # test images (optional)
# Classes
nc: 4 # number of classes
names: ['move','point','up','down'] # class namespath: Compared with in yolov5 Under the directory , The root of your dataset folder
Move out this picture again

my data1 stay yolov5 In the last directory of , So it is ../data1
train Is the training data set path ,val Is the path of the validated dataset
Here I follow the original coco128.yaml, These two are the same
So relative to path It is images/train( my images There is also one in the folder train Folder , Then there is my picture )
nc: Is how many classes you want to detect
names Is the name of these classes
2、train.py
Generally, we only need to change these

weights It's the model you choose
data: Because I'm using coco128.yaml In itself , So I don't have to change ~
epochs and batch-size Do as you see fit
epochs It is how many times the whole data set will be iterated in the training process , If the graphics card doesn't work, turn it down
batch-size: How many pictures do you see at a time before you update the weight , If the same graphics card doesn't work, turn it down
5、 ... and 、 Run
In the terminal cd To yolov5 Directory ( because train.py Under the directory )
And then directly python train.py That's it
Then wait ~ A long wait ~
![]()
6、 ... and 、 Result presentation
After the final training, we will yolov5 Create one in the directory runs Folder
There are all kinds of results , I won't say much more
Just say one. weights In a folder best.pt and last.pt
These are weight files , It is the model preservation after training , Can be directly in detect.py Used in documents
Also input... At the terminal
python detect.py --source 0 --weights runs/train/exp/weights/best.ptthere source 0 It refers to the computer camera as the source , Then you can see the training results most intuitively ~
You are welcome to criticize and correct in the comment area , thank you ~
边栏推荐
- The consumption of Internet of things users is only 76 cents, and the price has become the biggest obstacle to the promotion of 5g industrial interconnection
- Ueditor, FCKeditor, kindeditor editor vulnerability
- [basic grammar] C language uses for loop to print Pentagram
- leetcode860. Lemonade change
- JDBC database operation
- 动态规划——相关概念,(数塔问题)
- Notes | numpy-07 Slice and index
- Current market situation and development prospect prediction of global direct energy deposition 3D printer industry in 2022
- [batch dos-cmd command - summary and summary] - CMD window setting and operation command - close CMD window and exit CMD environment (exit, exit /b, goto: EOF)
- Market status and development prospect prediction of global colorimetric cup cover industry in 2022
猜你喜欢

Overview of basic knowledge of C language
![[luatos sensor] 2 air pressure bmp180](/img/88/2a6caa5fec95e54e3fb09c74ba8ae6.jpg)
[luatos sensor] 2 air pressure bmp180

JS dynamic table creation

Basic use of Metasploit penetration testing framework

Three representations of signed numbers: original code, inverse code and complement code

Promise

Gbase8s unique index and non unique index

Kept hot standby and haproxy

The consumption of Internet of things users is only 76 cents, and the price has become the biggest obstacle to the promotion of 5g industrial interconnection

Appium 1.22. L'Inspecteur appium après la version X doit être installé séparément
随机推荐
Actual combat 8051 drives 8-bit nixie tube
Notes | numpy-11 Array operation
Apache MPM model and ab stress test
Based on RFC 3986 (unified resource descriptor (URI): general syntax)
leetcode860. Lemonade change
[research materials] the fourth quarter report of the survey of Chinese small and micro entrepreneurs in 2021 - Download attached
Shell script -- condition judgment
Market status and development prospect prediction of global SoC Test Platform Industry in 2022
Thesis reading_ Chinese NLP_ ELECTRA
Wechat applet waterfall flow and pull up to the bottom
Use posture of sudo right raising vulnerability in actual combat (cve-2021-3156)
Compile and decompile GCC common instructions
[research materials] 2021 China's game industry brand report - Download attached
[Yu Yue education] basic reference materials of interchangeability and measurement technology of Zhongyuan Institute of Technology
Online VR model display - 3D visual display solution
Problems encountered in fuzzy query of SQL statements
C language program ideas and several commonly used filters
Appium 1.22. L'Inspecteur appium après la version X doit être installé séparément
Force GCC to compile 32-bit programs on 64 bit platform
leetcode452. Detonate the balloon with the minimum number of arrows