当前位置:网站首页>run yolov5
run yolov5
2022-08-02 14:18:00 【weixin_50862344】
跑跑yolov5
If you just want to get started with training quickly and get training results,我的建议是直接使用b导的代码.别问为什么,Ask is I ambGuide the little brother!!但是 In fact, it may just be that I can't convert myselfhhh
bThe guide code seems to be written by myself,会存在:The downloaded weights file ispth,最后得到的文件是pth文件 的问题
Basically it can be divided into four steps:环境配置,数据集制作,yolov5Document modification to train,预测.I mainly talk about data set production,yolov5文档修改.Because I stepped on more pitshhhh
(1)使用labelimg数据集制作
yolov5不接受xml文档,But the strange thing on the Internet is that most bloggers like it“曲线救yolov5”(先制作xml,在转化成txt)
直接改成yolov5支持的yoloThe format is not good!!!
I only had one class to train so I just opened these straight up!!!
①Auto SAVE Mode:If you don't turn it on, you have to press it every times保存,Otherwise, there will be a pop-up reminder
But doing this is risky,It may appear that the hand speed is too fast to jump one or two pictures(Don't ask how I know that)
②Single Class Mode:因为我只有一个类,You don't have to choose to use this
Later, if I remember, I will write a script that checks for less labelinghhhhh
③Display Label:Display the tag name
The advantage of this is that there is a high probability that repeated annotations can be avoided!!
(2)yolov5文档修改
Let's talk about the newly created folder structure first
修改yaml文件
因为我懒,So I didn't recreateyaml文件,我是直接在data/coco128.yamlmodified in the folder
- 改路径(文件路径,训练集路径,val路径)
直接pycharmRight-click on the selected foldercopy path–>absolute path,Absolute paths are not easy to report errors - 改nc(标签数量),name(标签名字)
修改train文件
定位到parse_opt,Only talk about modified files(wrong again)
- 改pt (Absolute paths are not easy to report errors)
parser.add_argument('--weights', type=str, default=ROOT / 'D:/computervision/deep_learning_model/yolov5-6.1/yolov5s.pt', help='initial weights path')
- –data
parser.add_argument('--data', type=str, default=ROOT / 'data/coco128.yaml', help='dataset.yaml path')
- –epochs
The dataset I train on is relatively small,–epochsMust be kept small,不然容易过拟合
parser.add_argument('--epochs', type=int, default=100)
跑yolov5What went wrong again
Just a word of mouth:Really hate the red tips and error oneshai!!!
(1)错误报告1:TensorBoard logging requires TensorBoard version 1.15 or above
Actually my version I was over2.6,It is estimated that there is a problem with another dependency package
- Check for download firsttensorboard
Enter the following command in the environment,检查有没有tensorboard
conda list
- If the version has been exceeded1.15,那就Go to this URL
Or directly on the command line
pip install tb-nightly==2.8.0a20220120
Here I basically basicallyok了
(2)错误报告2:AssertionError: No images found in ×××××
This mistake is a bit silly,I put the label's folder in it“val"后面,Then it says no picture found
留个小问题:yoloHow to get the label file?
检查一下yolov5the training results
可能是因为wandbVersion incompatibility is also possible这个原因
My file will compare别家的少.
从下往上看:
- Three training result graphs
- result.csv
The first row is from left to right①epoch,
②train/box_loss,③train/obj_loss,④train/cls_loss,
⑤metrics/precision,⑥metrics/recall,⑦metrics/mAP_0.5,⑧metrics/mAP_0.5:0.95,
⑨val/box_loss,⑩val/obj_loss, ①①val/cls_loss,
①②x/lr0,①③x/lr1,①④x/lr2
(1)train:训练集;val:验证集
(2) cls_loss用于监督类别分类,box_loss用于监督检测框的回归,obj_loss用于监督grid中是否存在物体.(You can take a look at what this blogger has to say)
(3)!!!!!主要看这个!!!!!
mAP_0.5 : IoU设为0.5时,计算每一类的所有图片的AP,然后所有类别求平均,即mAP
mAP_0.5:0.95 : 表示在不同IoU阈值(从0.5到0.95,步长0.05)(0.5、0.55、0.6、0.65、0.7、0.75、0.8、0.85、0.9、0.95)上的平均mAP.
- opt.yaml
There's not much to say about the config file - hyp.yaml
Estimates are hyperparameters - There is also the weight file
看到一篇博文对于trainThe parameters are very good, so I want to record them
(1)“–image-weights
”
是否启用加权图像策略,默认是不开启的;主要是为了解决样本不平衡问题;After it is turned on, it will be used for the previous round of training效果不好的图片,在下一轮中增加一些权重;
1.28"–label-smoothing
"
Whether to smooth the labels,默认是不启用的;
在训练样本中,我们并不能保证所有sample都标注正确,如果某个样本标注错误,就可能产生负面印象,如果我们有办法“告诉”模型,样本的标签不一定正确
,那么训练出来的模型对于少量的样本错误就会有“免疫力”采用随机化的标签作为训练数据时,损失函数有1-ε的概率与上面的式子相同,比如说告诉模型只有0.95概率是那个标签.
边栏推荐
猜你喜欢
随机推荐
yolov5改进(一) 添加注意力集中机制
Flask-RESTful请求响应与SQLAlchemy基础
uview 2.x版本 tabbar在uniapp小程序里头点击两次才能选中图标
VMM是什么?_兮是什么意思
RKMPP 在FFmpeg上实现硬编解码
Sentinel源码(五)FlowSlot以及限流控制器源码分析
Go语言初始
【Tensorflow】AttributeError: module 'keras.backend' has no attribute 'tf'
redis延时队列
深度学习框架pytorch快速开发与实战chapter3
STM32(F407)—— 堆栈
logback源码阅读(二)日志打印,自定义appender,encoder,pattern,converter
FFmpeg AVPacket详解
About the development forecast of the market outlook?2021-05-23
Sentinel源码(六)ParamFlowSlot热点参数限流
Object detection scene SSD-Mobilenetv1-FPN
Shell脚本完成pxe装机配置
Unit 3 view layer
第十四单元 视图集及路由
Raft对比ZAB协议