YOLO-Master

TencentAGPL-3.0活跃维护

YOLO-Master 是腾讯开源的实时目标检测模型,用专家混合(MoE)搭配专用 Transformer 提升检测精度与速度,支持检测、分割和分类任务。

[CVPR2026]🚀🚀🚀Official code for the paper "YOLO-Master: MOE-Accelerated with Specialized Transformers for Enhanced Real-time Detection." *(YOLO = You Only Look Once)* 🔥🔥🔥

v26.08发布于 2026-08-08 13:17 UTC782star +8 / 7 天162fork同步于 2026-11-10 11:55 UTC

怎么上手

由 README 提炼,执行前请确认
conda create -n yolo_master python=3.11 -y
conda activate yolo_master
git clone https://github.com/Tencent/YOLO-Master
cd YOLO-Master
pip install -r requirements.txt
pip install -e .
硬件要求按 README 说明

README 未说明具体显存要求;训练示例使用 device="0,1,2,3" 多卡,可选安装 FlashAttention 需 CUDA。

需要 CUDA
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

腾讯优图开源的 YOLO 风格实时检测框架,用 MoE 按场景复杂度动态分配算力

YOLO-Master 是腾讯开源的实时目标检测模型,用专家混合(MoE)搭配专用 Transformer 提升检测精度与速度,支持检测、分割和分类任务。

核心能力

  • 用 ES-MoE 稀疏专家块按输入场景复杂度动态分配计算量
  • 轻量动态路由在训练中引导专家分化、推理时只激活相关专家
  • 提供从安装、验证、训练、推理到 ONNX/TensorRT 导出的完整流程
  • 附带 MoE 剪枝与 diagnose_model、prune_moe_model 诊断工具
  • 支持 CW-NMS 与 Sparse SAHI 推理模式

容易踩的坑

需自行下载 yolo_master_n.pt 预训练权重或从 Model Zoo 获取;FlashAttention 为可选项且必须 CUDA 环境;Studio 平台需额外执行 pip install -e ".[studio]" 并访问 127.0.0.1:8000。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

4 个版本v26.08
  1. YOLO-Master-v26.08YOLO-Master v26.082026-08-21 · 2026-08-21 11:31 UTC
    查看更新说明

    YOLO-Master v26.08 — Release Report

    2026-08-21 · Ultralytics 8.4.101 / YOLO26 · CVPR 2026

    YOLO-Master v26.08 evolves from an MoE detector into a routed real-time vision framework.

    It learns not just what to see, but where, how, and for which task to compute.

    🔀 Routed Architecture🎯 MultiTask🔧 PEFT Adaptation⚡ Edge Deployment
    MoE · MoA · MoT · Latentdetect · seg · poseLoRA · MoLoRA · Planner5 backends

    ✅ 377 passed · ⚡ YOLO26 compatible · 🖥️ Live Demo

    v26.08 Python 3.8+ PyTorch 1.8+ AGPL-3.0 CVPR 2026

    📚 Docs · 📊 Model Zoo · 💬 Discuss · 🔄 Diff


    Overview · Architecture · Mixture · PEFT · MultiTask · Edge · Reliability · Capability · Benchmarks · Migration · Limitations


    🌟 Overview

    [!IMPORTANT]
    v26.08 is a cumulative release from YOLO-Master-v26.02. It rebases on Ultralytics 8.4.101 / YOLO26, integrates five routing families (MoE, MoA, MoT, Latent Mixture, MoLoRA) under a shared protocol, adds four PEFT paths (Standard LoRA, Planner/V-PEFT, MoLoRA, FewShot-LoRA), enables preview MultiTask learning (detect/segment/pose), and hardens the full lifecycle — from training through export to deployment — with P0-P2 evidence.

    YOLO-Master no longer describes itself as just "an MoE detector." v26.08 introduces routing as a first-class framework abstraction:

    • Architecture Routing — which expert / attention head / transformer / latent channel computes
    • Adaptation Routing — which parameters are trained, at what rank, through which adapter expert
    • Task Routing — which task branch activates for each spatial token

    All three axes share a single routing protocol for auxiliary loss collection, temperature scheduling, and diagnostics. CompositeCriterion collects by family with EMA normalization, global budgeting, and NaN isolation.

    v26.08 conceptual overview: unified tasks, routed architectures, parameter-efficient adaptation, cross-platform deployment.

    Release at a Glance

    Release rangeYOLO-Master-v26.02 → YOLO-Master-v26.08
    Audited history637 commits (517 non-merge + 120 merge) · 34 author identities
    Upstream upgradeUltralytics 8.3.240 → 8.4.101
  2. v26.08YOLO-Master v26.08最新正式版2026-08-08 · 2026-08-08 13:17 UTC

    YOLO-Master v26.08 — Release Report

    2026-08-21 · Ultralytics 8.4.101 / YOLO26 · CVPR 2026

    YOLO-Master v26.08 evolves from an MoE detector into a routed real-time vision framework.

    It learns not just what to see, but where, how, and for which task to compute.

    🔀 Routed Architecture🎯 MultiTask🔧 PEFT Adaptation⚡ Edge Deployment
    MoE · MoA · MoT · Latentdetect · seg · poseLoRA · MoLoRA · Planner5 backends

    ✅ 377 passed · ⚡ YOLO26 compatible · 🖥️ Live Demo

    v26.08 Python 3.8+ PyTorch 1.8+ AGPL-3.0 CVPR 2026

    📚 Docs · 📊 Model Zoo · 💬 Discuss · 🔄 Diff


    Overview · Architecture · Mixture · PEFT · MultiTask · Edge · Reliability · Capability · Benchmarks · Migration · Limitations


    🌟 Overview

    [!IMPORTANT]
    v26.08 is a cumulative release from YOLO-Master-v26.02. It rebases on Ultralytics 8.4.101 / YOLO26, integrates five routing families (MoE, MoA, MoT, Latent Mixture, MoLoRA) under a shared protocol, adds four PEFT paths (Standard LoRA, Planner/V-PEFT, MoLoRA, FewShot-LoRA), enables preview MultiTask learning (detect/segment/pose), and hardens the full lifecycle — from training through export to deployment — with P0-P2 evidence.

    YOLO-Master no longer describes itself as just "an MoE detector." v26.08 introduces routing as a first-class framework abstraction:

    • Architecture Routing — which expert / attention head / transformer / latent channel computes
    • Adaptation Routing — which parameters are trained, at what rank, through which adapter expert
    • Task Routing — which task branch activates for each spatial token

    All three axes share a single routing protocol for auxiliary loss collection, temperature scheduling, and diagnostics. CompositeCriterion collects by family with EMA normalization, global budgeting, and NaN isolation.

    v26.08 conceptual overview: unified tasks, routed architectures, parameter-efficient adaptation, cross-platform deployment.

    Release at a Glance

    Release rangeYOLO-Master-v26.02 → YOLO-Master-v26.08
    Audited history637 commits (517 non-merge + 120 merge) · 34 author identities
    Upstream upgradeUltralytics 8.3.240 → 8.4.101
  3. YOLO-Master-v26.022026-02-13 · 2026-02-13 07:12 UTC
    查看更新说明

    🎯 YOLO-Master v2026.02 Release Notes

    LicensePythonPyTorchGitHub starsGitHub forksTechnical Report


    🌟 Overview

    We are thrilled to announce YOLO-Master v2026.02, a milestone release that achieves major breakthroughs in model efficiency and architectural flexibility, redefining the paradigm for large-scale model training and inference.

    🎯 Key Highlights

    • 🧠 Mixture of Experts (MoE): Implements dynamic expert activation, significantly enhancing model capacity without proportional increase in computational cost
    • ⚡ Low-Rank Adaptation (LoRA): Parameter-efficient fine-tuning that dramatically reduces training resource requirements while achieving 95%+ of full fine-tuning performance
    • 🔍 Sparse SAHI: Intelligent adaptive slicing inference, achieving 3-5x speedup for large image detection
    • 🎯 Cluster-Weighted NMS: Cluster-based weighted fusion with significantly improved localization accuracy

    🚀 New Features

    1️⃣ Mixture of Experts (MoE) Support

    The MoE architecture enables efficient model scaling through conditional computation, dramatically increasing model capacity while maintaining inference speed. Our implementation includes complete training, inference, and optimization pipelines.

    🔧 Core Components

    📊 MoE Loss Function (MoELoss)

    • Load Balancing Loss 🎯: Ensures balanced expert load distribution, preventing expert collapse
    • Z-Loss 📉: Suppresses large logit values, ensuring numerical stability
    • Adaptive weight adjustment mechanism that dynamically balances main task loss with auxiliary losses

    Implementation: ultralytics/nn/modules/moe/loss.py

    ✂️ Intelligent Pruning (MoEPruner)

    • Validation set-based expert utilization analysis
    • Automatic pruning of low-utilization experts (default threshold: 15%)
    • Significantly reduces model parameters and inference latency
    • Achieves 20-30% inference speedup while maintaining performance

    Implementation: ultralytics/nn/modules/moe/pruning.py

    🏗️ Modular Architecture

    • Decoupled router, expert networks, and gating mechanisms
    • Supports multiple routing strategies: Top-K, Soft Routing, Expert Choice
    • Highly extensible modular design, easy integration of custom experts

    2️⃣ LoRA Support - Parameter-Efficient Fine-Tuning Revolution

    LoRA achieves parameter-efficient fine-tuning through low-rank matrix decomposition, reaching 95%+ of full fine-tuning performance while training only 1-5% of parameters.

    🎯 Core Innovation: Architecture-Agnostic LoRA Adaptation

    Zero-Overhead Integration Principle

    We demonstrate that LoRA training can be achieved without adding any new modules to the original YOLO model architecture. This is accomplished through:

    1. Dynamic Weight Interception: LoRA adapters are applied at the parameter level rather than the module level
    2. Configuration-Driven Activation: LoRA behavior is controlled entirely through hyperparameter settings
    3. Backward Compatibility: Models retain their original architecture and can switch between LoRA and standard training modes without code modification
    Traditional A
  4. v0.0.0YOLO-Master-v0.0pre-release2025-12-31 · 2025-12-31 13:00 UTC
    查看更新说明

    YOLO-Master: MOE-Accelerated with Specialized Transformers for Enhanced Real-time Detection.

    We are excited to announce the first official release of YOLO-Master, a novel YOLO architecture integrated with Mixture-of-Experts (MoE). This release brings significant improvements in accuracy-latency trade-offs, specifically targeting real-time object detection and segmentation tasks.

    "Adaptive Intelligence for Every Scene" — YOLO-Master introduces instance-conditional computation, dynamically allocating resources where they are needed most.

    🚀 Key Highlights

    • MoE Architecture Integration: Native support for Mixture-of-Experts with dynamic routing.
    • SOTA Performance: Achieves 42.4% mAP on COCO with just 1.62ms latency (N-scale), outperforming YOLOv10/v11/v12.
    • Segmentation Breakthrough: +2.8% mAPmask gain over YOLOv12-seg-N.
    • Hardware-Aware Optimization: Optimized for GPU (Batched Compute) and Mobile (Ghost Experts).

    🛠 New Features in v1.0

    1. Advanced MoE Modules

    • ModularRouterExpertMoE (Recommended): A highly stable, plug-and-play MoE block featuring:
      • Shared Experts: Ensures baseline performance and prevents training collapse.
      • Z-Loss Integration: Stabilizes router logits for smoother convergence.
    • UltraOptimizedMoE: Designed for extreme speed, featuring Batched Expert Computation which eliminates Python loops, delivering 3-5x inference speedup on GPUs.
    • GhostExpert: Parameter-efficient experts based on GhostNet, reducing memory bandwidth pressure for mobile/edge deployment.

    2. Intelligent Routing

    • EfficientSpatialRouter: Reduces routing FLOPs by >90% via spatial pre-pooling.
    • DynamicRouting: Adaptive computational resource allocation based on scene complexity.

    3. Stability & Ease of Use

    • Training Stability: Solved common MoE training instability with Shared Expert paths and specialized router initialization (std=0.01).
    • Deployment Ready: Full support for ONNX and TensorRT export.

    📊 Benchmarks (COCO val2017)

    ModelSizemAP (box)LatencyComparison
    YOLOv10-N64038.51.84ms-
    YOLOv11-N64039.41.50ms-
    YOLOv12-N64040.61.64ms-
    YOLO-Master-N64042.41.62msSOTA 🏆

    🔗 Resources

    📥 Quick Start

    Installation

    git clone https://github.com/isLinXu/YOLO-Master.git
    cd YOLO-Master
    pip install -r requirements.txt
    pip install -e .
    

    Training (Single GPU)

    from ultralytics import YOLO
    
    model = YOLO('cfg/models/master/v0/det/yolo-master-n.yaml')
    results = model.train(data='coco.yaml', epochs=100, imgsz=640)
    

    🤝 Contributors

    Special thanks to the research team at Tencent Youtu Lab and Singapore Management University.


用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    YOLO-Master is a YOLO-style framework tailored for Real-Time Object Detection (RTOD). It marks the first deep integration of Mixture-of-Experts (MoE) into the YOLO architecture for general datasets. By leveraging Efficient Sparse MoE (ES-MoE) and lightweight Dynamic Routing, the framework achieves instance-conditional adaptive computation. This "compute-on-demand" paradigm allows the model to allocate FLOPs based on scene complexity, reaching a superior Pareto frontier between high precision and ultra-low latency.

    Key Highlights:

    • Methodological Innovation (ES-MoE + Dynamic Routing): Utilizes dynamic routing networks to guide expert specialization during training and activates only the most relevant experts during inference, significantly reducing redundant computation while boosting detection performance.
    • Performance Validated (Accuracy × Latency): On MS COCO, YOLO-Master-N achieves 42.4% AP @ 1.62ms latency, outperforming YOLOv13-N with a +0.8% mAP gain while being 17.8% faster.
    • Compute-on-Demand Intuition: Transitions from "static dense computation" to "input-adaptive compute allocation," yielding more pronounced gains in dense or challenging scenarios.
    • Out-of-the-Box Pipeline: Provides a complete end-to-end workflow including installation, validation, training, inference, and deployment (ONNX, TensorRT, etc.).
    • Continuous Engineering Evolution: Includes advanced utilities such as MoE pruning and diagnostic tools (diagnose_model / prune_moe_model), CW-NMS, and Sparse SAHI inference modes.

    💡 A Humble Beginning (Introduction)

    "Exploring the frontiers of Dynamic Intelligence in YOLO."

    This work represents our passionate exploration into the evolution of Real-Time Object Detection (RTOD). To the best of our knowledge, YOLO-Master is the first work to deeply integrate Mixture-of-Experts (MoE) with the YOLO architecture on general-purpose datasets.

    Most existing YOLO models rely on static, dense computation—allocating the same computational budget to a simple sky background as they do to a complex, crowded intersection. We believe detection models should be more "adaptive", much like the human visual system. While this initial exploration may be not perfect, it demonstrates the significant potential of Efficient Sparse MoE (ES-MoE) in balancing high precision with ultra-low latency. We are committed to continuous iteration and optimization to refine this approach further.

    Looking forward, we draw inspiration from the transformative advancements in LLMs and VLMs. We are committed to refining this approach and extending these insights to fundamental vision tasks, with the ultimate goal of tackling more ambitious frontiers like Open-Vocabulary Detection and Open-Set Segmentation.

    To overcome this limitation, we propose YOLO-Master, a novel YOLO-like framework that introduces instance-conditional adaptive computation for RTOD. This is achieved through an Efficient Sparse Mixture-of-Experts (ES-MoE) block that dynamically allocates computational resources to each input according to its scene complexity. At its core, a lightweight dynamic routing network guides expert specialization during training through a diversity enhancing objective, encouraging complementary expertise among experts. Additionally, the routing network adaptively learns to activate only the most relevant experts, thereby improving detection performance while minimizing computational overhead during inference.

    Comprehensive experiments on five large-scale benchmarks demonstrate the superiority of YOLO-Master. On MS COCO, our model achieves 42.4% AP with 1.62ms latency, outperforming YOLOv13-N by +0.8% mAP and 17.8% faster inference. Notably, the gains are most pronounced on challenging dense scenes, while the model preserves efficiency on typical inputs and maintains real-time inference speed. Code: Tencent/YOLO-Master


    🎨 Architecture

    📚 In-Depth Documentation

    For a deep dive into the design philosophy of MoE modules, detailed routing mechanisms, and optimization guides for deployment on various hardware (GPU/CPU/NPU), please refer to our Wiki: 👉 Wiki: MoE Modules Explained

    📖 Table of Contents

    🚀 Updates (Latest First)

    • 2026/08/07: 📄 New paper: YOLO-PEFT: Parameter-Efficient Fine-Tuning on YOLO Family (PDF) — proposes a structure-aware, auditable constraint-planning framework for PEFT placement in YOLO detectors. Within the evaluated coverage, planner-selected RS-LoRA reaches 0.7138 / 0.7307 mAP50-95 on YOLO11s / YOLO12s versus 0.6428 / 0.6662 for Full-SFT; all seven evaluated LoRA-family configurations on RT-DETR-L trigger a calibrated Refuse-to-Full-SFT decision. A controlled YOLO11 audit reports 43.9% lower peak training memory with 1.72x training time. Frozen claim table: reports/yolo-peft-2608.07051-anchor.json; verify with python scripts/reproduce_yolo_peft_paper.py --check-anchor.
    • 2026-06-29: 🤖✅ Agent Skill System Validation Complete — Full end-to-end validation of yolo-master-agent Skill with 50/50 test cases passing across 8 suites (quick / fast-smoke / cli-smoke / dry-run / contract / deep-smoke / extended / all). Fixed AttributeError from missing end2end field in default.yaml. Verified complete training → validation → inference pipeline with MPS auto-selection and workers=0 auto-completion. Skill runners: yolo.train, yolo.val, yolo.predict, yolo.benchmark, yolo.export, yolo.lora.diagnose, yolo.eval.peft_compare, yolo.multimodal.infer, yolo.system.doctor.
    • 2026-06-29: 🦏🏆 Selected for Tencent Rhino Bird Open Source Program 2026 — YOLO-Master has been officially selected for the Tencent Rhino Bird Open Source Program (Summer of Code 2026). This program aims to cultivate outstanding open-source talents and promote the prosperity and development of the open-source community. YOLO-Master will receive continuous support from the Tencent Open Source Fund, including mentorship, resource allocation, and community promotion, to further advance the integration of dynamic intelligence and MoE architecture in real-time object detection.
    • 2026-06-28: 🔀 MoA + MoT Integration — Mixture-of-Attention (MoA) and Mixture-of-Transformers (MoT) modules merged into main with regression tests. MoA: lightweight router assigns tokens to attention heads with different receptive fields (Local / Regional / Global). MoT: content-aware router assigns tokens to distinct Transformer experts (LocalConvTransformer / WindowTransformer / DeformableTransformer) with soft Top-K blending and optional load-balancing aux loss. New model configs added under ultralytics/cfg/models/master/v0_1/.
    • 2026-06-25: 🧠 MoA Module Introduced — Mixture-of-Attention (MoA) for CNN-native multi-scale attention fusion. 1×1 conv router assigns soft probabilities to Local (depthwise-3×3), Regional (pooled-stride=2), and Global (linear-attention) heads. Zero seq-dim reshape, Flash-Attention compatible. Supports C2fMoA wrapper and NeckMoAFusion cross-scale FPN/PAN fusion.
    • 2026-06-25: 🔄 MoT Module Introduced — Mixture-of-Transformers (MoT) routing module. Three complete Transformer expert architectures with soft Top-K blending, static-graph trace stability for ONNX/TorchScript, and optional z-loss style load-balancing aux loss.
    • 2026-05-12: 🤖 Agent Skill System Introduced — yolo-master-agent Skill Bundle with SKILL.md, autotrain validation suite (50+ cases), multimodal evaluation, async evaluation, MPS auto-selection, dry-run/contract/smoke tiered validation, and VLM/LLM cooperative inference (OpenAI / DashScope compatible).
    • 2026/02/21: 🎉🎉 Our paper has been accepted by CVPR 2026! Thank you to all the contributors and community members for your support!
    • 2026/02/13: 🧨🚀add LoRA support for model training and release v2026.02 version.[Happy New Year!]
    • 2026/01/16: [feature] Add pruning and analysis tools for MoE models.
      1. diagnose_model: Visualize expert utilization and routing behavior to identify redundant experts.
      2. prune_moe_model: Physically excise redundant experts and reconstruct routers for efficient inference without retraining.
    • 2026/01/16: Repo isLinXu/YOLO-Master transferred to Tencent.
    • 2026/01/14: ncnn-YOLO-Master-android support deploy YOLO-Master. Thanks to them!
    • 2026/01/09: [feature] Add Cluster-Weighted NMS (CW-NMS) to trade mAP vs speed.

      cluster: False # (bool) cluster NMS (MoE optimized)

    • 2026/01/07: TensorRT-YOLO accelerates YOLO-Master. Thanks to them!
    • 2026/01/07: Add MoE loss explicitly into training.

      Epoch GPU_mem box_loss cls_loss dfl_loss moe_loss Instances Size

    • 2026/01/04: Split MoE script into modules

      Split MoE script into separate modules (routers, experts)

    • 2026/01/03: [feature] Added Sparse SAHI Inference Mode: Introduced a content-adaptive sparse slicing mechanism guided by a global Objectness Mask, significantly accelerating small object detection in high-resolution images while optimizing GPU memory efficiency.
    • 2025/12/31: Released the demo YOLO-Master-WebUI-Demo.
    • 2025/12/31: Released YOLO-Master v0.1 with code, pre-trained weights, and documentation.
    • 2025/12/30: arXiv paper published.

    🔥 New Features (v2026.02)

    1️⃣ Mixture of Experts (MoE) Support

    YOLO-Master introduces the first deep integration of Mixture-of-Experts into the YOLO architecture, enabling instance-conditional adaptive computation.

    Core Components:

    ComponentDescriptionImplementation
    MoE Loss (MoELoss)Load balancing loss + Z-Loss for stable trainingultralytics/nn/modules/moe/loss.py
    MoE Pruning (MoEPruner)Auto-prune low-utilization experts (20-30% speedup)ultralytics/nn/modules/moe/pruning.py
    Modular ArchitectureDecoupled routers, experts, and gating mechanismsultralytics/nn/modules/moe/

    Usage:

    from ultralytics import YOLO
    
    # Load MoE configuration
    model = YOLO("ultralytics/cfg/models/master/v0_1/det/yolo-master-n.yaml")
    
    # Training with MoE
    results = model.train(
        data="coco8.yaml",
        epochs=100,
        imgsz=640,
        batch=16,
        moe_num_experts=8,      # Number of experts
        moe_top_k=2,            # Experts activated per token
        moe_balance_loss=0.01,  # Load balancing loss weight
    )
    
    # Expert utilization analysis & pruning
    model.prune_experts(threshold=0.15)
    

    💡 Looking for a plug-and-play ES-MoE module for all YOLO versions?

    If you are seeking a convenient, pluggable ES-MoE module integration for the full YOLO family, please refer to the community library: Lfan-ke/ES-MoE, ES-MoE for PyPI.


    2️⃣ LoRA Support - Parameter-Efficient Fine-Tuning

    Architecture-agnostic LoRA adaptation with zero architectural overhead — enabled purely through configuration, no model surgery required.

    Key Advantages:

    • 🎯 Using ~10% trainable parameters to achieve 95-98% of full fine-tuning performance
    • ⚡ In the controlled YOLO11 audit reported by YOLO-PEFT, peak training memory decreased by 43.9%, while training took 1.72× as long as Full-SFT. Results depend on the model, adapter configuration, data, and hardware; training speedup is not guaranteed. See the paper claim anchor for reproduction entry points.
    • 📦 Ultra-compact adapters (e.g., YOLO11x: 14.1 MB adapter vs 114.6 MB full model)

    Supported Models:

    Model FamilyArchitecture TypeLoRA IntegrationChanges Required
    YOLOv3 / v5 / v6CNNConfiguration-onlyNone ✅
    YOLOv8 / v9 / v10CNNConfiguration-onlyNone ✅
    YOLO11 / YOLO12CNN / HybridConfiguration-onlyNone ✅
    RT-DETRTransformer-basedConfiguration-onlyNone ✅
    YOLO-WorldMulti-modalConfiguration-onlyNone ✅
    YOLO-MasterMoEConfiguration-onlyNone ✅

    Usage:

    from ultralytics import YOLO
    
    model = YOLO("yolo11s.pt")
    
    # LoRA training (one-click activation)
    results = model.train(
        data="coco8.yaml",
        epochs=300,
        imgsz=640,
        batch=32,
        lora_r=16,                # rank=16, best cost-effectiveness
        lora_alpha=32,            # alpha = 2×r
        lora_dropout=0.1,
        lora_gradient_checkpointing=True,
    )
    
    # Save only LoRA adapters (~4.1MB for YOLO11s) to a directory
    model.save_lora_only("yolo11s_lora_r16")
    

    YOLO11 Series (LoRA rank=8):

    ModelBase Params (M)LoRA ParamsBase Size (MB)Adapter Size (MB)Param Ratio (%)
    YOLO11n2.6527,5365.62.120.29%
    YOLO11s9.41,016,24019.34.110.81%
    YOLO11m20.11,639,85640.76.68.16%
    YOLO11l25.32,350,51251.49.49.29%
    YOLO11x56.93,525,552114.614.16.20%

    YOLO12 Series (LoRA rank=8):

    ModelBase Params (M)LoRA ParamsBase Size (MB)Adapter Size (MB)Param Ratio (%)
    YOLO12n2.6632,7525.62.324.34%
    YOLO12s9.31,077,68019.04.311.59%
    YOLO12m20.21,684,91240.96.88.34%
    YOLO12l26.42,442,16053.79.89.25%
    YOLO12x59.13,662,768119.314.76.20%

    Practical Deployment Significance (YOLO11-X):

    • 🚀 Cloud: Save ~87.7% storage by deploying 14.1 MB adapter instead of 114.6 MB full model
    • 📱 Edge: 1 base model + N lightweight adapters for multi-scenario switching
    • 🔄 Version Control: 14.1 MB adapters are far easier to manage via Git
    • 💡 Multi-Task: 10 tasks require only 255.6 MB (1×base + 10×adapters) vs 1,146 MB traditional

    🚀 Downstream Scenario Low-Rank Adaptation (LoRA) Matrix Test Report

    To verify the performance and resource consumption of the YOLO-Master LoRA framework across different downstream tasks, we conducted a cross-Rank matrix benchmark on the RTX 5070 Ti hardware platform using two typical scenarios (lightweight vs. extreme complexity).

    Evaluation Scenario (Dataset)LoRA RankTrainable Params Ratio *Total Training Time (Minutes)Peak VRAMmAP50mAP50-95
    Brain Tumor (Sparse, Small Dataset)4~0.45%6.80 min1.01 GB0.52320.3863
    Brain Tumor (Sparse, Small Dataset)8~0.89%6.58 min1.03 GB0.51330.3692
    Brain Tumor (Sparse, Small Dataset)16~1.76%6.89 min1.08 GB0.49890.3744
    📊 VisDrone (Dense, Extreme Scenario)4~0.45%14.45 min7.92 GB0.13120.0679
    📊 VisDrone (Dense, Extreme Scenario)8~0.89%14.06 min7.95 GB0.14760.0781
    📊 VisDrone (Dense, Extreme Scenario)16~1.76%15.45 min8.01 GB0.16460.0872

    * Note: The trainable parameter ratio is a theoretical estimate relative to the backbone's total parameters. Since Ultralytics automatically resets the gradient graph and triggers weight fusion after the training lifecycle ends, the runtime dynamic statistics remain silent.

    ** Selection Suggestions & Pitfalls to Avoid:**

    1. Lightweight/Simple Scenarios (e.g., Brain Tumor): Rank = 4 is recommended. For datasets with single-feature profiles, lower Ranks provide better regularization and effectively mitigate overfitting.
      • Pitfall: Medical images (MRI/CT) are physically single-channel (grayscale), whereas YOLO defaults to 3-channel (RGB) inputs. Please ensure channel alignment in your data pipeline or use customized ch=1 convolution configurations.
    2. Dense/Complex Scenarios (e.g., VisDrone): Rank >= 16 is recommended. Complex backgrounds and high-density tiny objects require larger parameter capacities for representation. Increasing the Rank significantly improves mAP50 by +25.4% (with <0.1 GB VRAM overhead).
      • Pitfall: Aerial imagery suffers from extreme scale variations. It is strictly advised to enable the built-in Sparse SAHI (Sparse Inference) or set rect: true during training. Furthermore, include both the Backbone's dimensionality reduction layers and MoE Experts' MLPs in lora_target_modules to provide sufficient degrees of freedom for spatial local features.

    3️⃣ Sparse SAHI Mode

    Sparse Slicing Aided Hyper-Inference — a revolutionary optimization for ultra-large image (4K/8K) detection, achieving 3-5x speedup by intelligently skipping blank regions.

    How it works:

    1. 🗺️ Low-resolution full-image inference generates an objectness heatmap
    2. ✂️ Adaptive slicing skips regions with objectness < 0.15
    3. 🎯 High-resolution inference only on regions of interest
    4. 🔗 Multi-slice results merged via CW-NMS

    Usage:

    from ultralytics import YOLO
    
    model = YOLO("yolov8n.pt")
    
    results = model.predict(
        source="large_aerial_image.jpg",
        sparse_sahi=True,
        slice_size=640,
        overlap_ratio=0.2,
        objectness_threshold=0.15,
    )
    

    4️⃣ Cluster-Weighted NMS (CW-NMS)

    Cluster-based detection box fusion algorithm using Gaussian-weighted averaging instead of hard suppression, significantly improving localization accuracy.

    MethodStrategyProsCons
    Traditional NMSDirect discardFastMay lose accurate localization
    Soft-NMSConfidence decayPreserves candidatesParameter-sensitive
    CW-NMSGaussian-weighted fusionHigh accuracy, robustSlight computational increase
    from ultralytics import YOLO
    
    model = YOLO("yolov8n.pt")
    results = model.predict(
        source="dense_objects.jpg",
        cluster=True,     # Enable CW-NMS
        sigma=0.1,        # Gaussian weight σ
    )
    

    5️⃣ Mixture-of-Attention (MoA) Support

    YOLO-Master introduces Mixture-of-Attention (MoA), a CNN-native multi-scale attention fusion mechanism. A lightweight 1×1 conv router assigns soft probabilities to each spatial token across three attention head groups with different receptive fields: Local (depthwise-3×3), Regional (pooled-stride=2), and Global (linear-attention). Zero sequence-dimension reshape, fully Flash-Attention compatible.

    Key Features:

    • 🧠 Multi-scale attention fusion: Local detail + Regional context + Global semantics in one block
    • ⚡ CNN-native: [B,C,H,W] → [B,C,H,W], no seq-dim reshape, compatible with all YOLO backbones
    • 🔗 Flexible integration: C2fMoA wrapper for direct C2f/C3k2 replacement; NeckMoAFusion for cross-scale FPN/PAN fusion

    Usage:

    from ultralytics import YOLO
    
    # Load MoA configuration
    model = YOLO("ultralytics/cfg/models/master/v0_1/det/yolo-master-n.yaml")
    
    # Training with MoA
    results = model.train(
        data="coco8.yaml",
        epochs=100,
        imgsz=640,
        batch=16,
    )
    

    6️⃣ Mixture-of-Transformers (MoT) Support

    YOLO-Master introduces Mixture-of-Transformers (MoT), a content-aware routing module that distributes tokens to specialized Transformer experts.

    Three Expert Architectures:

    • 🏠 LocalConvTransformer: Depth-wise convolutions for texture and edge detection
    • 🪟 WindowTransformer: Swin-style window partitioning for medium-scale objects
    • 🌀 DeformableTransformer: Sparse deformable sampling for irregular and occluded objects

    Key Features:

    • 🧭 Soft Top-K Routing: Static-graph computes all experts, blends outputs via Top-K mask weights — ONNX/TorchScript trace stable
    • ⚖️ Optional Load-Balancing: z-loss style auxiliary loss for stable expert utilization
    • 📦 Out-of-the-Box: Compatible with existing YOLO-Master training and export pipelines

    Usage:

    from ultralytics import YOLO
    
    # Load MoT configuration
    model = YOLO("ultralytics/cfg/models/master/v0_1/det/yolo-master-n.yaml")
    
    # Training with MoT
    results = model.train(
        data="coco8.yaml",
        epochs=100,
        imgsz=640,
        batch=16,
    )
    

    7️⃣ Agent Skill System

    YOLO-Master introduces the yolo-master-agent Skill Bundle, enabling AI agents to orchestrate training, validation, inference, and evaluation through a structured Skill interface.

    Key Features:

    • 🤖 9 Skill Runners: yolo.train, yolo.val, yolo.predict, yolo.benchmark, yolo.export, yolo.lora.diagnose, yolo.eval.peft_compare, yolo.multimodal.infer, yolo.system.doctor
    • ✅ 50+ Test Cases: 8 validation suites (quick / fast-smoke / cli-smoke / dry-run / contract / deep-smoke / extended / all)
    • 🧠 Multimodal Inference: YOLO detection + VLM/LLM cooperative reasoning, supporting OpenAI / DashScope compatible endpoints
    • 🔧 Auto-Device: MPS/CPU/CUDA auto-selection, workers=0 auto-completion, safe defaults
    • 📊 Structured Output: JSON manifest with training metrics, resource usage, error classification, and next-action recommendations

    Usage:

    # Via Python API
    from ultralytics import YOLO
    model = YOLO("yolo11n.pt")
    results = model.train(data="coco8.yaml", epochs=1, imgsz=640)
    
    # Via Skill CLI
    python agent/scripts/run_yolo_master_skill.py \
        --json '{"skill":"yolo.train","inputs":{"model":"yolo11n.pt","data":"coco8.yaml"},"params":{"epochs":1,"imgsz":640}}'
    

    📊 Main Results

    Detection

    Segmentation

    ModelSizemAPbox (%)mAPmask (%)Gain (mAPmask)
    YOLOv11-seg-N64038.932.0-
    YOLOv12-seg-N64039.932.8Baseline
    YOLO-Master-seg-N64042.935.6+2.8% 🚀

    Classification

    ModelDatasetInput SizeTop-1 Acc (%)Top-5 Acc (%)Comparison
    YOLOv11-cls-NImageNet22470.089.4Baseline
    YOLOv12-cls-NImageNet22471.790.5+1.7% Top-1
    YOLO-Master-cls-NImageNet22476.693.4+4.9% Top-1 🔥

    📦 Model Zoo & Benchmarks

    Pretrained .pt weights are synced from the YOLO-Master-v26.02 release.

    YOLO-Master-EsMoE Series

    ModelWeightsParams(M)GFLOPs(G)Box(P)RmAP50mAP50-95Speed (4090 TRT) FPS
    YOLO-Master-EsMoE-NWeights2.688.70.6840.5360.5870.427640.18
    YOLO-Master-EsMoE-SWeights9.6929.10.6990.6030.6030.489423.87
    YOLO-Master-EsMoE-MWeights34.8897.40.7370.6400.6970.530243.79
    YOLO-Master-EsMoE-L-🔥trainingTBDTBDTBDTBDTBDTBD
    YOLO-Master-EsMoE-X-🔥trainingTBDTBDTBDTBDTBDTBD

    YOLO-Master-v0.1 Series

    ModelWeightsParams(M)GFLOPs(G)Box(P)RmAP50mAP50-95Speed (4090 TRT) FPS
    YOLO-Master-v0.1-NWeights7.5410.10.6840.5420.5920.429528.84
    YOLO-Master-v0.1-SWeights29.1536.00.7240.6070.6620.489345.24
    YOLO-Master-v0.1-MWeights52.17116.70.7290.6410.6960.528170.72
    YOLO-Master-v0.1-LWeights58.41138.10.7390.6460.7050.539149.86
    YOLO-Master-v0.1-X-🔥trainingTBDTBDTBDTBDTBDTBD

    🖼️ Detection Examples

    🧩 Supported Tasks

    YOLO-Master builds upon the robust Ultralytics framework, inheriting support for various computer vision tasks. While our research primarily focuses on Real-Time Object Detection, the codebase is capable of supporting:

    TaskStatusDescription
    Object Detection✅Real-time object detection with ES-MoE acceleration.
    Instance Segmentation✅Experimental support (inherited from Ultralytics).
    Pose Estimation🚧Experimental support (inherited from Ultralytics).
    OBB Detection🚧Experimental support (inherited from Ultralytics).
    Classification✅Image classification support.

    ⚙️ Quick Start

    Installation

    # 1. Create and activate a new environment
    conda create -n yolo_master python=3.11 -y
    conda activate yolo_master
    
    # 2. Clone the repository
    git clone https://github.com/Tencent/YOLO-Master
    cd YOLO-Master
    
    # 3. Install dependencies
    pip install -r requirements.txt
    pip install -e .
    
    # 4. Optional: Install FlashAttention for faster training (CUDA required)
    pip install flash_attn
    

    Validation

    Validate the model accuracy on the COCO dataset.

    from ultralytics import YOLO
    
    # Load the pretrained model
    model = YOLO("yolo_master_n.pt")
    
    # Run validation
    metrics = model.val(data="coco.yaml", save_json=True)
    print(metrics.box.map)  # map50-95
    

    Training

    Train a new model on your custom dataset or COCO.

    from ultralytics import YOLO
    
    # Load a model
    model = YOLO('cfg/models/master/v0/det/yolo-master-n.yaml')  # build a new model from YAML
    
    # Train the model
    results = model.train(
        data='coco.yaml',
        epochs=600,
        batch=256,
        imgsz=640,
        device="0,1,2,3", # Use multiple GPUs
        scale=0.5,
        mosaic=1.0,
        mixup=0.0,
        copy_paste=0.1
    )
    

    Inference

    Run inference on images or videos.

    Python:

    from ultralytics import YOLO
    
    model = YOLO("yolo_master_n.pt")
    results = model("path/to/image.jpg")
    results[0].show()
    

    CLI:

    yolo predict model=yolo_master_n.pt source='path/to/image.jpg' show=True
    

    Export

    Export the model to other formats for deployment (TensorRT, ONNX, etc.).

    from ultralytics import YOLO
    
    model = YOLO("yolo_master_n.pt")
    model.export(format="engine", half=True)  # Export to TensorRT
    # formats: onnx, openvino, engine, coreml, saved_model, pb, tflite, edgetpu, tfjs
    

    Studio Task Platform

    Launch Studio to submit and manage model tasks in your browser. The platform supports training, validation, prediction, export and environment diagnostics. View job status and logs, cancel tasks, and preview or download results.

    Run from the repository root:

    python -m pip install -e ".[studio]"
    python main_engine.py
    # Open http://127.0.0.1:8000 in your browser
    

    See the Studio documentation and user guide for more startup options and usage instructions.

    🤝 Community & Contributing

    We welcome contributions! Please check out our Contribution Guidelines for details on how to get involved.

    • Issues: Report bugs or request features here.
    • Pull Requests: Submit your improvements.

    📄 License

    This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).

    🙏 Acknowledgements

    This work builds upon the excellent Ultralytics framework. Huge thanks to the community for contributions, deployments, and tutorials!

    📝 Citation

    If you use YOLO-Master in your research, please cite our paper:

    @inproceedings{lin2026yolomaster,
      title={{YOLO-Master}: MOE-Accelerated with Specialized Transformers for Enhanced Real-time Detection},
      author={Lin, Xu and Peng, Jinlong and Gan, Zhenye and Zhu, Jiawen and Liu, Jun},
      booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
      year={2026}
    }
    

    For the parameter-efficient fine-tuning work, please also cite:

    @misc{lin2026yolopeft,
      title={YOLO-PEFT: Parameter-Efficient Fine-Tuning on YOLO Family},
      author={Lin, Xu and Nie, WenJie and Peng, Jinlong and Fu, Weifu and Ma, YueXiao and Zheng, Xiawu and Liu, Yong},
      year={2026},
      eprint={2608.07051},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2608.07051}
    }
    

    ⭐ If you find this work useful, please star the repository!