YOLO中model.val()方法参数解释

ArgumentTypeDefaultDescriptionExplain
datastrNoneSpecifies the path to the dataset configuration file (e.g., coco8.yaml). This file includes paths to validation data, class names, and number of classes.
imgszint640Defines the size of input images. All images are resized to this dimension before processing. Larger sizes may improve accuracy for small objects but increase computation time.
batchint16Sets the number of images per batch. Higher values utilize GPU memory more efficiently but require more VRAM. Adjust based on available hardware resources.
save_jsonboolFalseIf True, saves the results to a JSON file for further analysis, integration with other tools, or submission to evaluation servers like COCO.如果为真(True),则将结果保存到一个JSON文件中,以便进行进一步的分析、与其他工具集成,或者提交到诸如COCO这样的评估服务器上。
save_hybridboolFalseIf True, saves a hybrid version of labels that combines original annotations with additional model predictions. Useful for semi-supervised learning and dataset enhancement.如果为真(True),则保存一个标签的混合版本,该版本将原始注释与额外的模型预测结果相结合。这对于半监督学习和数据集增强很有用。
conffloat0.001Sets the minimum confidence threshold for detections. Lower values increase recall but may introduce more false positives. Used during validation to compute precision-recall curves.设置检测的最小置信度阈值。较低的值会提高召回率,但可能会引入更多的误报。在验证阶段用于计算精确率-召回率曲线。
ioufloat0.6Sets the Intersection Over Union threshold for Non-Maximum Suppression. Controls duplicate detection elimination.设置非极大值抑制(Non-Maximum Suppression)的交并比(Intersection Over Union,IoU)阈值。该阈值用于控制重复检测的消除。
max_detint300Limits the maximum number of detections per image. Useful in dense scenes to prevent excessive detections and manage computational resources.限制每张图像的最大检测数量。这在密集场景中很有用,可防止出现过多的检测结果,并有效管理计算资源。
halfboolTrueEnables half-precision (FP16) computation, reducing memory usage and potentially increasing speed with minimal impact on accuracy.启用半精度(FP16)计算,可减少内存使用量,并有可能在对精度影响极小的情况下提高计算速度。
devicestrNoneSpecifies the device for validation (cpu, cuda:0, etc.). When None, automatically selects the best available device. Multiple CUDA devices can be specified with comma separation.指定用于验证的设备(如cpu、cuda:0 等等)。当设置为“None”时,会自动选择可用的最佳设备。可以使用逗号分隔来指定多个CUDA设备。
dnnboolFalseIf True, uses the OpenCV DNN module for ONNX model inference, offering an alternative to PyTorch inference methods.如果设置为真(True),则使用OpenCV的DNN(深度神经网络)模块来进行ONNX模型的推理,这为PyTorch推理方法提供了一种替代方案。
plotsboolFalseWhen set to True, generates and saves plots of predictions versus ground truth, confusion matrices, and PR curves for visual evaluation of model performance.当设置为 True 时,会生成并保存预测结果与真实标签对比图、混淆矩阵以及精确率 - 召回率(PR)曲线,用于对模型性能进行可视化评估。
rectboolTrueIf True, uses rectangular inference for batching, reducing padding and potentially increasing speed and efficiency by processing images in their original aspect ratio.如果为真(True),则使用矩形推理进行批量处理,减少填充操作,并且有可能通过按图像的原始宽高比进行处理来提高速度和效率。
splitstr‘val’Determines the dataset split to use for validation (val, test, or train). Allows flexibility in choosing the data segment for performance evaluation.确定用于验证的数据集划分部分(验证集(val)、测试集(test)或训练集(train))。在选择用于性能评估的数据部分时提供了灵活性。
projectstrNoneName of the project directory where validation outputs are saved. Helps organize results from different experiments or models.
namestrNoneName of the validation run. Used for creating a subdirectory within the project folder, where validation logs and outputs are stored.
verboseboolFalseIf True, displays detailed information during the validation process, including per-class metrics, batch progress, and additional debugging information.如果为真(True),则在验证过程中显示详细信息,包括每类别的指标、批次进度以及额外的调试信息。
save_txtboolFalseIf True, saves detection results in text files, with one file per image, useful for further analysis, custom post-processing, or integration with other systems.如果为真(True),则将检测结果保存到文本文件中,每个图像对应一个文件,这对于进一步分析、自定义后处理或与其他系统集成很有用。
save_confboolFalseIf True, includes confidence values in the saved text files when save_txt is enabled, providing more detailed output for analysis and filtering.如果为真(True),当启用了保存为文本文件(save_txt)功能时,会在保存的文本文件中包含置信度值,从而为分析和筛选提供更详细的输出内容。
save_cropboolFalseIf True, saves cropped images of detected objects, which can be useful for creating focused datasets, visual verification, or further analysis of individual detections.如果为真(True),则会保存检测到的对象的裁剪图像,这对于创建聚焦的数据集、进行视觉验证或对单个检测结果进行进一步分析可能会很有用。
workersint8Number of worker threads for data loading. Higher values can speed up data preprocessing but may increase CPU usage. Setting to 0 uses main thread, which can be more stable in some environments.
augmentboolFalseEnables test-time augmentation (TTA) during validation, potentially improving detection accuracy at the cost of inference speed by running inference on transformed versions of the input.在验证期间启用测试时增强(TTA)功能,通过对输入的变换版本运行推理,有可能以牺牲推理速度为代价来提高检测精度。
agnostic_nmsboolFalseEnables class-agnostic Non-Maximum Suppression, which merges overlapping boxes regardless of their predicted class. Useful for instance-focused applications.启用类别无关的非极大值抑制(Non-Maximum Suppression),该方法会合并重叠的边界框,而不考虑它们预测的类别。这对于关注实例的应用场景很有用。
single_clsboolFalseTreats all classes as a single class during validation. Useful for evaluating model performance on binary detection tasks or when class distinctions aren’t important.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值