遇见 YOLO26: 下一代视觉 AI。
Ultralytics
返回 Ultralytics 词汇表

Inference Engine

发现推理引擎如何优化像 Ultralytics YOLO26 这样的机器学习模型以实现实时部署。立即探索边缘 AI 的性能提升技巧。

An inference engine is a specialized software component designed to execute trained machine learning models and generate predictions from new data. Unlike the training phase, which focuses on learning patterns through computationally intensive processes like backpropagation, an inference engine is strictly optimized for the operational phase known as model deployment. Its primary goal is to run computations as efficiently as possible, minimizing inference latency and maximizing throughput on target hardware, whether that be a scalable cloud server or a battery-powered Edge AI device. By stripping away the overhead required for training, these engines allow complex neural networks to function in real-time applications.

Link to this section推理引擎如何优化性能#

从训练环境到推理引擎的转换通常涉及几个优化步骤,以简化模型结构。由于模型不再需要学习,引擎可以丢弃梯度更新所需的数据,从而有效地冻结 model weights。推理引擎使用的常用技术包括层融合(layer fusion),即将多个操作合并为一个步骤以减少内存访问,以及 model quantization,它将权重从高精度浮点格式转换为低精度整数(例如 INT8)。

这些优化使得像 Ultralytics YOLO26 这样的高级架构能够在不显著损失 accuracy 的情况下以极高的速度运行。不同的引擎通常针对特定的硬件生态系统进行定制,以释放最大性能:

  • NVIDIA TensorRT:通过利用特定于硬件的内核并优化网络图,在 NVIDIA GPUs 上提供高性能推理。
  • Intel OpenVINO: Optimizes deep learning performance on Intel architectures, including CPUs and integrated graphics, making it ideal for edge computing.
  • ONNX Runtime:一种跨平台加速器,支持 ONNX 格式的模型,为不同框架和硬件后端之间架起了桥梁。

Link to this section实际应用#

推理引擎是许多现代 AI 便利功能背后的隐形驱动力,使 computer vision 系统能够即时响应周围环境。

  1. 自动驾驶汽车:在自动驾驶汽车中,object detection 模型必须在毫秒内识别行人、交通标志和其他车辆。在汽车硬件上本地运行的推理引擎可确保此处理以 real-time inference 速度进行,因为依赖云连接会引入危险的延迟。

  2. 智能制造:工厂利用 industrial IoT 摄像头检查装配线上的产品。推理引擎处理视频流以执行 anomaly detection,从而即时标记缺陷。这种自动化减少了浪费并确保了严格的质量控制,同时不会减慢生产速度。

Link to this section推理引擎与训练框架对比#

区分用于创建模型的软件和用于运行它的引擎是很有帮助的。训练框架(如 PyTorchTensorFlow)提供了用于设计架构、计算损失以及通过 supervised learning 更新参数的工具。它优先考虑灵活性和调试能力。

相比之下,推理引擎获取训练框架完成后的产物,并优先考虑执行速度和内存效率。虽然你可以在训练框架内运行推理,但它通常不如使用专用引擎高效,特别是在通过 TensorFlow LiteApple Core ML 等工具在手机或嵌入式设备上进行部署时。

Link to this section将推理引擎与 YOLO26 结合使用#

ultralytics 软件包抽象了推理引擎的大部分复杂性,允许用户无缝运行预测。在底层,它处理图像预处理和模型执行。对于寻求扩展的用户,Ultralytics Platform 简化了训练和导出模型的过程,使其导出为与各种推理引擎兼容的优化格式。

以下示例演示了如何加载预训练的 YOLO26 模型并在图像上运行推理:

from ultralytics import YOLO

# Load the YOLO26n model (nano version for speed)
model = YOLO("yolo26n.pt")

# Run inference on an image from a URL
# The 'predict' method acts as the interface to the inference process
results = model.predict("https://ultralytics.com/images/bus.jpg")

# Display the results
results[0].show()

Explore solutions

Real-time AI that works with your team

机器人技术中的 AI

使用 Ultralytics YOLO 模型为智能机器赋能。机器人技术中的视觉 AI 可推动自主导航、感知、物体跟踪和实时控制。

了解更多
Real-time AI that works with your team

物流中的 AI

使用 Ultralytics YOLO 模型简化物流。视觉 AI 可实现包裹检查、分拣、车辆跟踪和实时仓库安全监控。

了解更多
Real-time AI that works with your team

零售业 AI

使用 Ultralytics YOLO 模型重塑零售业。视觉 AI 推动库存跟踪、货架监控、队列管理和更智能的客户洞察。

了解更多
Real-time AI that works with your team

医疗保健中的 AI

利用 Ultralytics YOLO 模型构建医疗保健解决方案。医疗保健中的视觉 AI 可助力更快速的医学影像分析、更智能的诊断和患者监测。

了解更多
Real-time AI that works with your team

制造业中的 AI

使用 Ultralytics YOLO 模型优化制造业。视觉 AI 推动质量控制、缺陷检测、PPE 合规性和装配线自动化。

了解更多
Real-time AI that works with your operation

汽车中的 AI

将计算机视觉应用于汽车行业,并配合 Ultralytics YOLO 模型。汽车视觉 AI 可提升道路安全、辅助驾驶和车辆自动化,打造更智能的道路。

了解更多
Real-time AI tailored to your operation

农业中的 AI

借助 Ultralytics YOLO 模型,将视觉 AI 引入智慧农业。赋能作物监测、牲畜追踪和精准农业,实现更高、更智能的产量。

了解更多
Real-time AI that works with your team

机器人技术中的 AI

使用 Ultralytics YOLO 模型为智能机器赋能。机器人技术中的视觉 AI 可推动自主导航、感知、物体跟踪和实时控制。

了解更多
Real-time AI that works with your team

物流中的 AI

使用 Ultralytics YOLO 模型简化物流。视觉 AI 可实现包裹检查、分拣、车辆跟踪和实时仓库安全监控。

了解更多
Real-time AI that works with your team

零售业 AI

使用 Ultralytics YOLO 模型重塑零售业。视觉 AI 推动库存跟踪、货架监控、队列管理和更智能的客户洞察。

了解更多
Real-time AI that works with your team

医疗保健中的 AI

利用 Ultralytics YOLO 模型构建医疗保健解决方案。医疗保健中的视觉 AI 可助力更快速的医学影像分析、更智能的诊断和患者监测。

了解更多
Real-time AI that works with your team

制造业中的 AI

使用 Ultralytics YOLO 模型优化制造业。视觉 AI 推动质量控制、缺陷检测、PPE 合规性和装配线自动化。

了解更多
Real-time AI that works with your operation

汽车中的 AI

将计算机视觉应用于汽车行业,并配合 Ultralytics YOLO 模型。汽车视觉 AI 可提升道路安全、辅助驾驶和车辆自动化,打造更智能的道路。

了解更多
Real-time AI tailored to your operation

农业中的 AI

借助 Ultralytics YOLO 模型,将视觉 AI 引入智慧农业。赋能作物监测、牲畜追踪和精准农业,实现更高、更智能的产量。

了解更多
Real-time AI that works with your team

机器人技术中的 AI

使用 Ultralytics YOLO 模型为智能机器赋能。机器人技术中的视觉 AI 可推动自主导航、感知、物体跟踪和实时控制。

了解更多
Real-time AI that works with your team

物流中的 AI

使用 Ultralytics YOLO 模型简化物流。视觉 AI 可实现包裹检查、分拣、车辆跟踪和实时仓库安全监控。

了解更多
Real-time AI that works with your team

零售业 AI

使用 Ultralytics YOLO 模型重塑零售业。视觉 AI 推动库存跟踪、货架监控、队列管理和更智能的客户洞察。

了解更多
Real-time AI that works with your team

医疗保健中的 AI

利用 Ultralytics YOLO 模型构建医疗保健解决方案。医疗保健中的视觉 AI 可助力更快速的医学影像分析、更智能的诊断和患者监测。

了解更多
Real-time AI that works with your team

制造业中的 AI

使用 Ultralytics YOLO 模型优化制造业。视觉 AI 推动质量控制、缺陷检测、PPE 合规性和装配线自动化。

了解更多
Real-time AI that works with your operation

汽车中的 AI

将计算机视觉应用于汽车行业,并配合 Ultralytics YOLO 模型。汽车视觉 AI 可提升道路安全、辅助驾驶和车辆自动化,打造更智能的道路。

了解更多
Real-time AI tailored to your operation

农业中的 AI

借助 Ultralytics YOLO 模型,将视觉 AI 引入智慧农业。赋能作物监测、牲畜追踪和精准农业,实现更高、更智能的产量。

了解更多

让我们一起构建 AI 的未来!

开启你的机器学习未来之旅