网站建设是什么意思 打不开,wordpress 下载页插件下载,东莞企业营销,小程序模板商城先看下模型pt说明
YOLOv5s#xff1a;这是 YOLOv5 系列中最小的模型。“s” 代表 “small”#xff08;小#xff09;。该模型在计算资源有限的设备上表现最佳#xff0c;如移动设备或边缘设备。YOLOv5s 的检测速度最快#xff0c;但准确度相对较低。
YOLOv5m#xff1…先看下模型pt说明
YOLOv5s这是 YOLOv5 系列中最小的模型。“s” 代表 “small”小。该模型在计算资源有限的设备上表现最佳如移动设备或边缘设备。YOLOv5s 的检测速度最快但准确度相对较低。
YOLOv5m这是 YOLOv5 系列中一个中等大小的模型。“m” 代表 “medium”中。YOLOv5m 在速度和准确度之间提供了较好的平衡适用于具有一定计算能力的设备。
YOLOv5l这是 YOLOv5 系列中一个较大的模型。“l” 代表 “large”大。YOLOv5l 的准确度相对较高但检测速度较慢。适用于需要较高准确度且具有较强计算能力的设备。
YOLOv5x这是 YOLOv5 系列中最大的模型。“x” 代表 “extra large”超大。YOLOv5x 在准确度方面表现最好但检测速度最慢。适用于需要极高准确度的任务且具有强大计算能力如 GPU的设备。
YOLOv5n这是 YOLOv5 系列中的一个变体专为 Nano 设备如 NVIDIA Jetson Nano进行优化。YOLOv5n 在保持较快速度的同时提供适用于边缘设备的准确度。
图片标注我们用到了一个名为labelimg的工具https://github.com/tzutalin/labelImg
找一个编译好的运行程序 下载后删除自带的分类文件 我这里也简要介绍一遍过程然后也为大家避坑我们在训练前首先需要采集图片样本然后再对图片中的待识别物体进行标注。 我们首先需要建立如下的文件夹 选择yolo环境配置自动保存 添加标签 标记图形
快捷键 Ctrl u Load all of the images from a directory Ctrl r Change the default annotation target dir Ctrl s Save Ctrl d Copy the current label and rect box Ctrl Shift d Delete the current image Space Flag the current image as verified w Create a rect box d Next image a Previous image del Delete the selected rect box Ctrl Zoom in Ctrl-- Zoom out ↑→↓← | Keyboard arrows to move selected rect box 标记保存后会在相应目录生成txt文件文件中就是标记的坐标和编号 最后还要做的是建立yaml文件文件的位置也不要放错咱们去yolov5程序中复制VOC.yaml成test.yaml 其中train和val都是我们images的目录labels的目录不用写进去会自动识别。nc代表识别物体的种类数目names代表种类名称如果多个物体种类识别的话可以自行增加。
# YOLOv5 by Ultralytics, GPL-3.0 license
# PASCAL VOC dataset http://host.robots.ox.ac.uk/pascal/VOC by University of Oxford
# Example usage: python train.py --data VOC.yaml
# parent
# ├── yolov5
# └── datasets
# └── VOC ← downloads here (2.8 GB)# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
train: E:/hua/python/yolo_t/images/train/
val: E:/hua/python/yolo_t/images/val/
test: E:/hua/python/yolo_t/images/test/
# Classes
names:0: excav
进入环境 conda activate yolov5_cuda10.2 到目前我们的训练的材料就已经准备好了先测试下环境 python segment/predict.py --weights weights/yolov5m-seg.pt --data data/images/bus.jpg 测试环境提示保存环境就没有问题了 目录层级 修改train.py代码
import os下面添加 os.environ[GIT_PYTHON_REFRESH] quiet 否则会出现 Example: export GIT_PYTHON_REFRESHquiet错误 继续修改data文件 训练代码 python train.py 出现如下错误
assert nf 0 or not augment, f{prefix}No labels found in {cache_path}, can not start training. {HELP_URL} AssertionError: train: No labels found in E:\hua\python\yolo_t\labels\train.cache, can not start training. See https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data 放弃挣扎了
直接使用现有例子 修改训练文件
进行训练 python train.py 训练完成 权重文件 可以自行修改添加数据 添加标记 添加类型 识别修改detect.py 执行等待出结果