当前位置:网站首页>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 ~
边栏推荐
- Analysis of proxy usage of ES6 new feature
- Problems encountered in fuzzy query of SQL statements
- How to connect the network: Chapter 1 CSDN creation punch in
- ZABBIX monitoring of lamp architecture (2): ZABBIX basic operation
- Blog building tool recommendation (text book delivery)
- [backtrader source code analysis 5] rewrite several time number conversion functions in utils with Python
- Promise
- Actual combat 8051 drives 8-bit nixie tube
- Web APIs exclusivity
- Realize file download through the tag of < a > and customize the file name
猜你喜欢

Unity tool Luban learning notes 1

Gbase8s composite index (I)

Celebrate the new year together

String matching: find a substring in a string
![[set theory] relationship properties (symmetry | symmetry examples | symmetry related theorems | antisymmetry | antisymmetry examples | antisymmetry theorems)](/img/34/d195752992f8955bc2a41b4ce751db.jpg)
[set theory] relationship properties (symmetry | symmetry examples | symmetry related theorems | antisymmetry | antisymmetry examples | antisymmetry theorems)
![[research materials] 2021 China's game industry brand report - Download attached](/img/b7/a377b0b7c742078e2feb28ebfbca62.jpg)
[research materials] 2021 China's game industry brand report - Download attached

JS dynamic table creation

Compile and decompile GCC common instructions

Keepalived热备与HAProxy

Analysis of proxy usage of ES6 new feature
随机推荐
Esp32-c3 learning and testing WiFi (II. Wi Fi distribution - smart_config mode and BlueIf mode)
The current market situation and development prospect of the global gluten tolerance test kit industry in 2022
Dynamic programming - related concepts, (tower problem)
[set theory] relational power operation (relational power operation | examples of relational power operation | properties of relational power operation)
Detailed explanation of the output end (head) of yolov5 | CSDN creation punch in
1119 pre- and post order traversals (30 points)
Burp suite plug-in based on actual combat uses tips
appium1.22.x 版本后的 appium inspector 需单独安装
Current market situation and development prospect forecast of the global fire boots industry in 2022
Thesis reading_ Chinese NLP_ ELECTRA
appium1.22.x 版本後的 appium inspector 需單獨安裝
Current market situation and development prospect forecast of global UV sensitive resin 3D printer industry in 2022
1103 integer factorization (30 points)
Maximum continuous sub segment sum (dynamic programming, recursive, recursive)
Market status and development prospects of the global IOT active infrared sensor industry in 2022
Go language interface learning notes
最大连续子段和(动态规划,递归,递推)
Coordinatorlayout appbarrayout recyclerview item exposure buried point misalignment analysis
C language program ideas and several commonly used filters
Market status and development prospect prediction of the global autonomous hybrid underwater glider industry in 2022