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

Sliding Window Attention

了解滑动窗口注意力如何通过降低计算成本来优化 Transformer 效率。通过 Ultralytics YOLO26 发现其在 NLP 和视觉中的作用。

Sliding Window Attention is an optimized variant of the standard attention mechanism utilized in modern transformer architectures to dramatically improve computational efficiency. In traditional self-attention, every token in a sequence must process every other token, leading to memory and computational costs that scale quadratically with the sequence length. Sliding window attention addresses this bottleneck by restricting a token's focus to a fixed-size local neighborhood, or "window," of surrounding tokens. This approach reduces the complexity from quadratic to linear, making it a critical component for expanding the context window in massive artificial intelligence (AI) models.

By stacking multiple neural network layers that use this technique, models can gradually build a global understanding of the input data, as the localized windows overlap and share information deeper in the network. This foundational concept is widely supported by Google DeepMind research and is actively implemented in modern frameworks like PyTorch.

Link to this section实际应用#

在不耗尽计算内存的情况下处理海量数据序列的能力,在多个 AI 领域解锁了高级功能:

Link to this section区分相关术语#

要理解网络架构如何优化数据处理,将滑动窗口注意力与类似机制区分开来很有帮助:

  • 滑动窗口注意力 vs. 可变形注意力 (Deformable Attention) 滑动窗口注意力基于序列邻近性使用严格且连续的 token 块,而可变形注意力允许网络学习动态采样点。可变形注意力根据实际视觉内容而不是固定网格聚焦于任意的稀疏位置。
  • 滑动窗口注意力 vs. 稀疏注意力 (Sparse Attention) 滑动窗口是稀疏注意力的一个特定子集。虽然稀疏注意力是一个包含随机、跨步或全局 token 模式以减少内存占用的广泛术语,但滑动窗口方法严格将注意力限制在相邻的空间或时间 token 上。

Link to this section实现高效架构#

对于构建高速 目标检测 系统的开发者来说,利用高度优化的架构至关重要。虽然原始注意力机制功能强大,但像 Ultralytics YOLO26 这样的端到端模型通过平衡先进的特征提取与边缘设备效率,提供了行业领先的性能。

from ultralytics import YOLO

# Load the recommended YOLO26 model for high-resolution vision tasks
model = YOLO("yolo26x.pt")

# Perform inference on a large image, utilizing optimized internal processing
results = model.predict(source="large_aerial_map.jpg", imgsz=1024, show=True)

# Output the number of detected instances
print(f"Detected {len(results[0].boxes)} objects in the high-resolution input.")

将这些复杂的流水线从本地原型扩展到企业生产需要强大的基础设施。Ultralytics 平台 彻底简化了这一过程,提供了一个直观的界面,用于自动化数据集标注、无缝 云训练 以及实时 模型监控。这使得团队能够无缝利用高效的大上下文模型在各种硬件环境中带来的优势。

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 的未来!

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