当前位置:网站首页>Yolov7 model reasoning and training its own data set
Yolov7 model reasoning and training its own data set
2022-07-25 06:49:00 【lc_ MVP】
Some time ago YOLOv7 Release , There has been no time to reproduce , It's just time today , Simple reproduction .
1. The necessary environment
My environment is :Windows10+python3.9.7+CUDA11.1+CUDNN8.1.1+torch1.8. I won't say more about this environment configuration , There are many tutorials on the Internet . This article mainly records YOLOv7 Use .
2.YOLOv7 install
2.1 Get into github Download the source code and weight file on the official website :
https://github.com/WongKinYiu/yolov7
2.2 Open the project , Enter the command at the terminal , Install dependency packages
pip install -r requirements.txtThere is no error in installing the dependent package , If an error occurs , Please Baidu
3. Use YOLOv7 Official model for reasoning

open detect.py file , Modify the path of the weight file , And modify the path of the reasoning picture . Right click to run ok, The result will be runs/detect Show
The reasoning result is excellent , Far exceed YOLOX Performance of .
4. Train your own dataset
First, set the project folder :

Put the picture in images in ,xml File put in Annotations.
First use txt_write.py File partition dataset . The content of this document refers to another article of myself YOLOX In the article .
Next use txt_yolo_label.py file , Data sets are converted to yolo Dataset format , After conversion, you can see VOCData/labels Generate the of each graph txt file .

Then modify cfg/training In the corresponding model you downloaded yaml file , I downloaded it here yolov7.pt file , Change here yolov7.yaml file , take nc The quantity becomes the corresponding number of categories in your dataset .

And then data Backup a copy in the folder coco.yaml file , Rename it to myvocdataset.yaml, Change the content as shown in the figure , Remember to change the path to your own path .
train: E:/python_practice/object_detection/yolov7-main/VOC/train.txt
val: E:/python_practice/object_detection/yolov7-main/VOC/val.txt
nc: 2 # Category , Change to your own
names: ['screen','sign']# Category name
Then open train.py file , Modify the following items :

From top to bottom , In turn, the weight file ,cfg The configuration file ,voc Data files , Super parameter file , And training rounds . The super parameter can not be modified , Others are changed to their corresponding files .batch-size Change according to computer strength , My configuration is general ,batch smaller , It is suggested that dataloader workers Default to 0, Turn off its multithreading . Right click to run the file , The program runs perfectly .

If the following error occurs :
Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.stay train.py Add the following code to :
import os
os.environ['KMP_DUPLICATE_LIB_OK'] = 'TRUE'To demonstrate yolov7 Algorithm , After two rounds of training, I stopped training , Use the model of two rounds of training for reasoning . The result is shown in Fig. .

Because I only trained for two rounds , The effect is very poor , Only the box is recognized .
Here we are ,YOLOv7 Reproduction complete .
边栏推荐
- The code spell checker plug-in avoids some specific vocabulary errors "XXX": unknown word.cspell
- The code of Keil and Si compiler is not aligned??
- Builder pattern
- C control open source library: download of metroframework
- JZ7 rebuild binary tree
- 章鱼网络 Community Call #1|开启 Octopus DAO 构建
- How to troubleshoot the problem of too many inodes
- Common mode inductance has been heard many times, but what principle do you really understand?
- JZ7 重建二叉树
- 【知识总结】分块和值域分块
猜你喜欢

2022 Shenzhen cup

容器内组播

Download and run the C open source control metroframework demo project

MySQL remote login
![[daily question 1] 1184. Distance between bus stops](/img/36/2bbb8cc2a1fdd08070a5df7527e692.png)
[daily question 1] 1184. Distance between bus stops

Health clock in daily reminder tired? Then let automation help you -- hiflow, application connection automation assistant

Mlx90640 infrared thermal imager temperature measurement module development notes (I)

Do you know the same period last year in powerbi

健康打卡每日提醒累了?那就让自动化帮你---HiFlow,应用连接自动化助手

Kyligence Li Dong: from the data lake to the index middle stage, improve the ROI of data analysis
随机推荐
C#--MetroFramework框架调用metroModernUI库,并在工具栏使用
Keilc51 usage details (III)
Introduction to bridging mode and sharing mode
Clear wechat applet and wechat H5 cache
Analysis of the calling principle of Changan chain solid smart contract
【每日一题】剑指 Offer II 115. 重建序列
【知识总结】分块和值域分块
容器内组播
Basic usage of thread class
Easy gene chip SEQ analysis method: practical workflow and advanced applications
Use abp Zero builds a third-party login module (III): web side development
Du Jiao sieve
Quick sort code implementation
Bug notes
Introduction to the usage of explain and the meaning of result field in MySQL
[sword finger offer] analog implementation ATOI
Baidu SEM bidding avoidance
Qt实战案例(53)——利用QDrag实现拖拽拼图功能
%d,%s,%c,%x
C language -c51 compilation warning "* * * warning l1: unresolved external symbol" and extern