yolov5 trains its own watermark data for watermark target detection

yolov5 trains its own data for watermark detection


foreword

Grasp yolov5 from the overall process to use its own data for target detection to prevent students from stepping on the pit

1. Download yolov5 source code

Download the source code from the yolov5 official git address https://github.com/ultralytics/yolov5, and determine the small version, so that there will be no version inconsistency in training and deploying the model.
insert image description here
Here I choose the v6.0 version and deploy it relatively stable

2. Modify the configuration information of your own yolov5

1. Modify the configuration file in the data directory

insert image description here
Modify the VOC.yaml file.
insert image description here
This is an official sample file that tells you what the input model data should look like. The
insert image description here
above picture is our modified configuration file.
What needs to be modified is nc to your target detection category number
and names . Create your own categories
train and val are the data directories of your own training set and test set, and
delete the other parts.
The data input into the model should be processed into the following form:
insert image description here
images is the data of pictures
insert image description here

labels is the label information data,
insert image description here
and each txt file contains the category and coordinate position information of the detection target
insert image description here

insert image description here

2. Modify the models configuration file

insert image description here
It depends on which model you are using, and you can modify the configuration file of which model you use.
I used the yolov5s model this time, so modify the yolov5s configuration file
insert image description here
to modify the nc value and change it to the total number of categories of your target detection.

After the modification, the configuration part is completed, and then the train.py function is modified.

3. Modify the train functioninsert image description here

What needs to be modified is this part.
Wieghts, cfg, data, epoch, and batchsize
are pre-training weight files, model configuration information, data configuration information, training rounds, and batch data respectively.

Summarize

The above is the training process of using your own data for the yolov5 target detection model

Guess you like

Origin blog.csdn.net/weixin_43228814/article/details/126084315
Recommended