preamble
First of all, I would like to make it clear that I'm just getting started with yolov7, and the main purpose of this article is to allow you to quickly apply your own dataset for training. It doesn't matter if you haven't been exposed to yolov5, the article will demonstrate how to train it step by step.
Step 1 Data set preparation
First of all, make sure you have labelimg labeling software, if not, you need to go to the next one and read the labeling tutorial.
After you've labeled it and got the img and the corresponding xml (as shown)
The next option is whether or not image enhancement is needed to get more samples, if soClick here to downloadthat goes directly to enhancement with enhance_img.py. After that, my habit is to create a new folder for each project I need to train, and the project stores the files as shown in the picture:
The following ImageSets\Main is used to store the subsequent script file to divide the training set test set of the corresponding,.... For yolov7 super parameter settings, you can directly from yolov7\data to copy over to your project. For you to train the category and the corresponding class, but also will write the actual training data and test data. The file is shown below.
It's the script that divides your data into training set and test set.txt. The overall new project directory is this. Here's how the process works: 1 First make sure it's that project directory way 2 Run the script file to get the ImageSets\Main below,. 3 Run the xml2txt script file in the root directory of the yolov7. FileClick here to download Note that you have to change the class and project name of this file to your own. As shown in the figure:
At this point, our data preparation phase is complete and the project catalog is shown:
Step 2 Load your own dataset and train it
The red arrows and red boxes are where common changes are made, and the changes are made so that you can train.
Step 3 Make an interface call from the trained pt file.
After waiting for the training to complete, you will get the training under runs/train, and you can take this pt to do the interface use. First of all, to use it in your own project you have to make sure that the models and utils folders in the root directory of yolov7 are placed in the root directory of your project. Then download model_import.pyClick here to download Embedded in any of your project path to call the predict function will be able to output the checkout results.
summarize
To this point this article on the nanny level official yolov7 training their own dataset and project deployment of the article is introduced to this, more related yolov7 training their own dataset content, please search for my previous articles or continue to browse the following related articles I hope you will support me more in the future!