检测代码:
python detect.py --source E:\word\pythonProject\yolov5-label-xml-main\inference\images --weights runs\train\exp\weights\best.pt --conf 0.3 --save-txt
# 检测代码:
# python detect.py --source E:\word\pythonProject\yolov5-label-xml-main\inference\images --weights runs\train\exp\weights\best.pt --conf 0.3 --save-txt
# 推理命令说明:
# detect.py 为推理检测的脚本代码,
# –source 为检测的图片所在的目录,
# –weights为所用到的模型文件,根据前面算法训练,此处用到的模型文件即为大家训练好的。
# –conf 为自信度,0.25表示只采用0.25以上的
# -save--txt
图像识别教程
第一步 训练模型
训练代码(训练中。。。)
完成之后会在最新的exp下有个 weights \ bast.pt 文件,这个就是我们训练出来的模型
(CPU训练大概需要十七个小时左右,作者是使用GPU训练)
(1060显卡训练大概需要两小时,时间关系就没有完全训练)
第二步 使用训练完成的模型进行图像识别
# 检测代码:
# python detect.py --source E:\word\pythonProject\yolov5-label-xml-main\inference\images --weights runs\train\exp\weights\best.pt --conf 0.3 --save-txt
# 推理命令说明:
# detect.py 为推理检测的脚本代码,一般在yolov5的文件夹下
# –source 为需要检测的图片所在的目录,
# –weights为所用到的模型文件,根据前面算法训练,此处用到的模型文件即为大家训练好的。
# –conf 为自信度,0.25表示只采用0.25以上的
# -save--txt 保存识别位置
如何进行图像训练请查看我往期文章:手把手教会你使用机器学习拥有YOLOV5自己的图像识别https://blog.csdn.net/qq_42368762/article/details/122690675