深圳Yolo 视觉
深圳
立即加入
词汇表

召回率

了解什么是机器学习中的召回率(Recall),为什么它很重要,以及它如何确保 AI 模型有效地捕获关键的阳性实例。

Recall, also known as sensitivity or the true positive rate, is a fundamental performance metric in machine learning that measures the ability of a model to identify all relevant instances within a dataset. In the context of object detection or classification, it specifically answers the question: "Out of all the actual positive cases, how many did the model correctly find?" Achieving high recall is critical in scenarios where missing a positive instance—often referred to as a false negative—carries significant consequences. Unlike accuracy, which can be misleading when dealing with imbalanced data, recall provides a focused view on the model's effectiveness at "capturing" the target class.

高召回率的重要性

In many artificial intelligence applications, the cost of failing to detect an object is far higher than the cost of a false alarm. A model optimized for recall minimizes false negatives, ensuring that the system casts a wide enough net to catch potential threats, anomalies, or critical conditions. This often involves a trade-off, as increasing recall can sometimes lead to a lower precision score, meaning the model might flag more non-relevant items as positive. Understanding this balance is key to developing robust machine learning solutions.

实际应用

召回率是众多安全关键型人工智能解决方案的核心指标。以下两个典型案例中,灵敏度被置于优先地位:

  • 医学诊断: 在医学影像分析中,例如通过X光筛查疾病早期征兆,高检出率是不可妥协的。若医疗系统中的AI用于 detect 肿瘤,与其完全漏诊恶性肿瘤,不如让系统标记出最终被证实为良性的可疑阴影(即假阳性)。 医生依赖这些工具作为安全网,确保任何潜在健康风险都不被忽视。
  • 安全与监控:对于安防报警系统,首要目标detect 入侵企图。优化高召回率的系统能确保当人员进入限制区域时触发警报。尽管这可能导致野生动物引发偶发性误报,但远优于系统未能detect 真实detect 情况。此类场景中的物体检测模型经过调优,以确保对潜在威胁保持最高灵敏度。

Recall vs. Precision

It is essential to distinguish recall from its counterpart, precision. While recall measures the quantity of relevant cases found (completeness), precision measures the quality of the positive predictions (exactness).

  • Recall: Focuses on avoiding missed detections. "Did we find all the apples?"
  • Precision: Focuses on minimizing false alarms. "Are all the things we called apples actually apples?"

These two metrics often share an inverse relationship, visualized through a Precision-Recall curve. To evaluate the overall balance between them, developers often look at the F1-score, which is the harmonic mean of both. In imbalanced datasets, looking at recall alongside the confusion matrix gives a much clearer picture of performance than accuracy alone.

用Ultralytics YOLO测量召回率

When training models like the cutting-edge YOLO26, recall is automatically computed during the validation phase. The framework calculates recall for each class and the mean Average Precision (mAP), helping developers gauge how well the model finds objects.

您可以轻松地Python验证训练好的模型并查看其召回率指标。以下代码片段演示了如何加载模型并在标准数据集上检查其性能:

from ultralytics import YOLO

# Load a pretrained YOLO26 model
model = YOLO("yolo26n.pt")

# Validate the model on the COCO8 dataset
# The results object contains metrics like Precision, Recall, and mAP
metrics = model.val(data="coco8.yaml")

# Access and print the mean recall score for box detection
print(f"Mean Recall: {metrics.results_dict['metrics/recall(B)']:.4f}")

This code utilizes the Ultralytics API to run validation. If the recall is lower than required for your project, you might consider techniques like data augmentation to create more varied training examples or hyperparameter tuning to adjust the model's sensitivity. Using the Ultralytics Platform can also streamline the process of managing datasets and tracking these metrics over multiple training runs.

Improving Model Recall

To boost a model's recall, data scientists often adjust the confidence threshold used during inference. Lowering the threshold makes the model more "optimistic," accepting more predictions as positive, which increases recall but may decrease precision. Additionally, collecting more diverse training data helps the model learn to recognize hard negatives and obscure instances. For complex tasks, employing advanced architectures like Transformer blocks or exploring ensemble methods can also improve the system's ability to detect subtle features that simpler models might miss.

加入Ultralytics 社区

加入人工智能的未来。与全球创新者联系、协作和共同成长

立即加入