当前位置:网站首页>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 ~
边栏推荐
- Market status and development prospects of the global IOT active infrared sensor industry in 2022
- @RequestMapping
- Keepalived热备与HAProxy
- Realize file download through the tag of < a > and customize the file name
- Actual combat 8051 drives 8-bit nixie tube
- 动态规划——相关概念,(数塔问题)
- Detailed explanation of the output end (head) of yolov5 | CSDN creation punch in
- Unity tool Luban learning notes 1
- Blog building tool recommendation (text book delivery)
- Basic knowledge of reflection (detailed explanation)
猜你喜欢

MPM model and ab pressure test

"Hands on deep learning" pytorch edition Chapter II exercise

Shuttle + alluxio accelerated memory shuffle take-off

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

Analysis of proxy usage of ES6 new feature

Do you know UVs in modeling?

Review the old and know the new: Notes on Data Science

The principle is simple, but I don't know how to use it? Understand "contemporaneous group model" in one article

Gbase8s unique index and non unique index
![[set theory] relation properties (reflexivity | reflexivity theorem | reflexivity | reflexivity theorem | example)](/img/2a/362f3b0491f721d89336d4f468c9dd.jpg)
[set theory] relation properties (reflexivity | reflexivity theorem | reflexivity | reflexivity theorem | example)
随机推荐
Basic knowledge of reflection (detailed explanation)
Audio Focus Series: write a demo to understand audio focus and audiomananger
1119 pre- and post order traversals (30 points)
1099 build a binary search tree (30 points)
Pan details of deep learning
Blog building tool recommendation (text book delivery)
Distinguish between releases and snapshots in nexus private library
[research materials] annual report of China's pension market in 2021 - Download attached
1115 counting nodes in a BST (30 points)
RT thread flow notes I startup, schedule, thread
Automatic voltage rise and fall 5-40v multi string super capacitor charging chip and solution
Appium 1.22. L'Inspecteur appium après la version X doit être installé séparément
Web APIs exclusivity
Notes | numpy-11 Array operation
Current market situation and development prospect forecast of global UV sensitive resin 3D printer industry in 2022
1086 tree traversals again (25 points)
sql语句模糊查询遇到的问题
Shuttle + alluxio accelerated memory shuffle take-off
[backtrader source code analysis 4] use Python to rewrite the first function of backtrader: time2num, which improves the efficiency by 2.2 times
Analysis of proxy usage of ES6 new feature