yolov5的detect.py的详细讲解
yolov5
yolov5 - Ultralytics YOLOv8的前身,是一个用于目标检测、图像分割和图像分类任务的先进模型。
项目地址:https://gitcode.com/gh_mirrors/yo/yolov5
免费下载资源
·
parser = argparse.ArgumentParser()
parser.add_argument('--weights', nargs='+', type=str, default='yolov5s.pt', help='model.pt path(s)')
parser.add_argument('--source', type=str, default='data/images', help='source') # file/folder, 0 for webcam
parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)')
parser.add_argument('--conf-thres', type=float, default=0.25, help='object confidence threshold')
parser.add_argument('--iou-thres', type=float, default=0.45, help='IOU threshold for NMS')
parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
parser.add_argument('--view-img', action='store_true', help='display results')
parser.add_argument('--save-txt', action='store_true', help='save results to *.txt')
parser.add_argument('--save-conf', action='store_true', help='save confidences in --save-txt labels')
parser.add_argument('--classes', nargs='+', type=int, help='filter by class: --class 0, or --class 0 2 3')
parser.add_argument('--agnostic-nms', action='store_true', help='class-agnostic NMS')
parser.add_argument('--augment', action='store_true', help='augmented inference')
parser.add_argument('--update', action='store_true', help='update all models')
parser.add_argument('--project', default='runs/detect', help='save results to project/name')
parser.add_argument('--name', default='exp', help='save results to project/name')
parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment')
opt = parser.parse_args()
以下是对每个参数的详细解释:
--weights
:模型权重文件的路径,默认值为'yolov5s.pt'。--source
:输入数据的来源,可以是文件/文件夹或摄像头编号,默认值为'data/images'。--img-size
:推理时的图像尺寸(像素),默认值为640。--conf-thres
:目标置信度阈值,默认值为0.25。--iou-thres
:非极大值抑制(NMS)的交并比阈值,默认值为0.45。--device
:使用的CUDA设备,例如0、0,1,2,3或cpu,默认为空。--view-img
:是否显示结果,如果指定该参数,则显示结果。--save-txt
:是否将结果保存到文本文件中,如果指定该参数,则保存结果。--save-conf
:是否在保存的文本标签中保存置信度,如果指定该参数,则保存置信度。--classes
:按类别过滤,例如--class 0或--class 0 2 3。--agnostic-nms
:是否进行类别无关的非极大值抑制,如果指定该参数,则进行类别无关的非极大值抑制。--augment
:是否进行数据增强推理,如果指定该参数,则进行数据增强推理。--update
:是否更新所有模型,如果指定该参数,则更新所有模型。--project
:保存结果的项目路径,默认值为'runs/detect'。--name
:保存结果的名称,默认值为'exp'。--exist-ok
:如果指定的项目/名称已存在,是否允许覆盖,如果指定该参数,则允许覆盖。
GitHub 加速计划 / yo / yolov5
49.28 K
16.02 K
下载
yolov5 - Ultralytics YOLOv8的前身,是一个用于目标检测、图像分割和图像分类任务的先进模型。
最近提交(Master分支:1 个月前 )
f7322921
* Delete greetings.yml
* Update format.yml
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
---------
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com> 4 天前
12b577c8
* Refactor code for speed and clarity
* Auto-format by https://ultralytics.com/actions
* Update README.md
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
* Update README.zh-CN.md
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
* Auto-format by https://ultralytics.com/actions
* Update README.md
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
* Auto-format by https://ultralytics.com/actions
---------
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com> 10 天前
更多推荐
已为社区贡献10条内容
所有评论(0)