GitRead 中文社区
首页趋势排行榜原创文章严选周刊
更多资源
新手训练营
精选专题热门话题GitHub 文档资源精选实战指南

yolo-flutter-app

适用于Ultralytics YOLO的Flutter插件

  • 语言Dart
  • 默认分支main
  • 大小44.1 MB
  • 更新5 天前
  • Issues2
在 GitHub 打开
avatarultralytics

技术解读

以下内容由 GitRead 中文社区 编辑团队基于项目 README 与官方资料整理, 结合中文开发者的常见使用场景补充技术选型建议。具体以项目官方文档为准。

ultralytics/yolo-flutter-app 深度技术分析

项目背景与痛点

在计算机视觉领域,Yolo(You Only Look Once)以其卓越的表现和高效性能,成为目标检测的热门选择。而 Flutter,作为 Google 推出的跨平台 UI 框架,更是以极高开发效率和一致的 UI 体验备受开发者青睐。ultralytics/yolo-flutter-app 正是以此为切入点,为 Flutter 开发者提供了一个封装了 YOLO 模型的插件,使得在跨平台应用中集成强大的目标检测功能变得轻而易举。

然而,要在不同平台(如 iOS 和 Android)以及不同的设备上统一实现如此高性能的模型,背后的挑战也不容小觑。诸如多平台兼容、高效的数据传递、模型的轻量化等一系列问题,都使得这一插件的开发成为一次兼具挑战和创新的过程。

核心技术揭秘

技术架构分析

ultralytics/yolo-flutter-app 充分利用了 Flutter 的跨平台优势以及预训练模型的高性能,为开发者提供一种高效的目标检测解决方案。其核心架构主要由以下几个部分组成:

  • 数据流管理
  • 模型执行
  • 结果反馈
graph TD A[用户请求] --> B{"参数校验"} B -->|"通过"| C[执行业务] C --> D{"模型处理"} D -->|"检测对象"| E[解析输出] D -->|"未检测对象"| F[返回结果] E --> G{"数据处理"} G -->|"格式检查"| H[返回结果] G -->|"格式错误"| I[异常处理] B -->|"失败"| J[返回错误]

关键技术栈

  1. Flutter 核心库:提供跨平台的支持,并保证 UI 在不同设备上的一致性。
  2. YOLO 模型封装:通过使用 YOLO 的高性能预训练模型,以 Flutter 插件的形式进行封装。
  3. 异步处理:利用 Dart 语言的异步编程特性,确保模型推理过程高效且不阻塞主 UI 线程。

设计思想

ultralytics/yolo-flutter-app 旨在为 Flutter 开发者提供一键集成的方案。其设计思想依靠预训练模型的轻量级和高性能特性,并利用 Flutter 跨平台框架的灵活性,避免了从头搭建复杂且低效的检测栈。同时,针对多平台的兼容性问题做了详尽的设计和优化。

功能亮点与差异

相比于传统的目标检测插件或方案,ultralytics/yolo-flutter-app 的几个明显优势在于:

  • 集成的低难度:提供了详细的文档和使用示例,极大地简化了开发者的学习成本。
  • 跨平台性能一致性:确保在不同平台上能够得到一致的模型检测结果。
  • 异步非阻塞:通过异步处理,确保界面的流畅性,避免卡顿。

应用场景与落地建议

在生产环境中使用 ultralytics/yolo-flutter-app 时,以下几点需要特别注意:

  • 多平台兼容性测试:尽管 Flutter 提供了强大的跨平台支持,但不同平台的硬件差异和性能瓶颈仍需仔细验证。
  • 性能及资源优化:合理安排模型的推理频率和数据处理速度,确保最优性能。

该插件非常适合那些需要在 Flutter 环境中实现高效且一致性检测功能的需求场景,比如安防监控、自动化生产线视觉检测、智能仓储管理系统等。

综合评价

ultralytics/yolo-flutter-app 提供了一种完整的解决方案,极大地降低了在 Flutter 应用中集成高性能目标检测模型的门槛。它充分利用了 YOLO 模型的高效性能和 Flutter 跨平台开发的优势,为开发者带来了一个非常强大的工具。

优点:

  • 简化了目标检测功能的集成过程。
  • 良好的跨平台兼容性。
  • 数据流和模型处理的高效设计。

缺点:

  • 对于性能要求极高的场景,深度优化的空间仍然存在。
  • 多平台的细节调试过程相对复杂。

内容更新时间:8月9日。 编辑团队负责选题与抽样审核,详见 编辑准则。

相关仓库

flutter/flutter avatar
flutterflutter
1 天前
181.1k
32.6k
13.5k

Flutter 让为移动端及其他平台构建精美应用变得轻松快捷

mobileandroidios+7
Dart
502.4 MB
0
详情
localsend/localsend avatar
localsendlocalsend
1 天前
98.1k
5.6k
894

AirDrop 的开源跨平台替代方案

dartfile-sharingflutter+1
Dart
22.5 MB
0
详情
AppFlowy-IO/AppFlowy avatar
AppFlowyAppFlowy-IO
6 天前
78.6k
6.2k
952

借助 AI 将项目、wiki 和团队汇聚在一起。AppFlowy 是 AI 协作工作空间,让你在不失去数据控制权的情况下取得更多成果。领先的开源 Notion 替代方案。

blogconfluence-alternativecontent-management+9
Dart
91.7 MB
0
详情
chen08209/FlClash avatar
FlClashchen08209
5 天前
62.3k
4.1k
331

基于 ClashMeta 的多平台代理客户端,简单易用,开源且无广告。

clashclash-metaflutter+6
Dart
78.3 MB
0
详情
Solido/awesome-flutter avatar
awesome-flutterSolido
9月3日
61.8k
6.6k
0

一份精选清单,汇集了最佳的 Flutter 库、工具、教程、文章等。

flutterawesome-listdartlang+7
Dart
3.4 MB
0
详情
Predidit/Kazumi avatar
KazumiPredidit
5 天前
41.8k
1.4k
650

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

androidcross-platformdanmaku+5
Dart
34.8 MB
0
详情
hiddify/hiddify-app avatar
hiddify-apphiddify
2 天前
33.8k
3.2k
47

多平台自动代理客户端,支持 Sing-box、X-ray、TUIC、Hysteria、Reality、Trojan、SSH 等。它是开源、安全且无广告的。

clashclashmetaech+15
Dart
65.6 MB
0
详情
ente/ente avatar
enteente
6 小时前
30.0k
1.9k
212

端到端加密云服务,适用于一切。

2faandroidauthy+14
Dart
754.8 MB
0
详情

关于

GitHub 原始描述(英文)

Flutter plugin for Ultralytics YOLO

aiandroidcoremldartflutteriosmobileobject-detectiontfliteyolo
  • GNU Affero General Public License v3.0
  • 512 Stars
  • 171 Forks
  • 8 Watching

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
862
价值分
359
活跃状态
活跃
GitHub

语言占比

C++
CMake
Dart
Kotlin
Objective-C
Python
Ruby
Shell
Swift

Release

  • v0.7.2 - Release 0.7.2: use UltralyticsYOLO 8.9.19 annotation colors and model colors metadata (#620)1 天前
  • v0.7.1 - Import and select custom Platform models in Flutter (#604)2 周前
  • v0.7.0 - Release 0.7.0: upgrade Android LiteRT to 2.3.0 (#605)2 周前
  • v0.6.16 - Release 0.6.16: align Android and iOS depth inputs with validation (#601)10月9日
  • v0.6.15 - Support opt-in Apple Core AI (.aimodel) models on iOS 27+ (#596)9月20日

贡献者

glenn-jocherglenn-jocherasabri97asabri97john-rockyjohn-rockydependabot[bot]dependabot[bot]UltralyticsAssistantUltralyticsAssistantpderrengerpderrengersergiossmsergiossmsadtearcatsadtearcatonuralpszronuralpszrdmjtiandmjtianyanggayanggaraimbekovmraimbekovm

Ultralytics logo

English | 简体中文

🚀 YOLO Flutter - Ultralytics Official Plugin

Ultralytics Actions .github/workflows/ci.yml codecov CocoaPods

Ultralytics Discord Ultralytics Forums Ultralytics Reddit

Ultralytics YOLO Flutter is the official plugin for running YOLO models in Flutter apps on iOS and Android. It supports detection, instance segmentation, semantic segmentation, depth estimation, classification, pose, and OBB on both platforms, with two simple entry points:

  • YOLO for single-image inference
  • YOLOView for real-time camera inference

The main goal is simple integration: use an official model ID, or drop in your own exported model and let the plugin resolve task metadata for you.


Ultralytics YOLO iOS App previews

Apple App store    Get it on Google Play

✨ Features

  • Official Ultralytics plugin for Flutter
  • One Dart API for Android and iOS
  • Metadata-first model loading with official model download and caching
  • Real-time camera inference and single-image inference
  • Controls for thresholds, accelerator selection, and result streaming
  • YOLO26 and YOLO11 model families supported
Feature Android iOS Details
Object Detection ✅ ✅ Bounding boxes, labels, and confidence scores
Instance Segmentation ✅ ✅ Instance masks with boxes and classes
Semantic Segmentation ✅ ✅ Dense class masks for every pixel
Monocular Depth Estimation ✅ ✅ Official LiteRT and Core ML models
Image Classification ✅ ✅ Top class predictions and scores
Pose Estimation ✅ ✅ Keypoints with boxes and confidence scores
Oriented Bounding Box (OBB) Detection ✅ ✅ Rotated boxes and polygon corners
Real-Time Camera Inference ✅ ✅ YOLOView for live camera workflows
Single-Image Inference ✅ ✅ YOLO for image bytes
Official Models ✅ ✅ Discovery, download, and caching for packaged model IDs
Custom Models ✅ ✅ LiteRT (TFLite) on Android, Core ML on iOS, metadata-first tasks
Qualcomm NPU (QNN) ✅ — Opt-in Hexagon NPU inference for *_qnn.onnx models on Snapdragon

⚡ Quick Start

Install the package:

Package: https://pub.dev/packages/ultralytics_yolo

dependencies:
  ultralytics_yolo: ^0.7.2
flutter pub get

Start with the default official model:

import 'package:ultralytics_yolo/ultralytics_yolo.dart';

final modelId = YOLO.defaultOfficialModel() ?? 'yolo26n';

YOLOView(
  modelPath: modelId,
  onResult: (results) {
    for (final r in results) {
      debugPrint('${r.className}: ${r.confidence}');
    }
  },
)

For single-image inference:

final yolo = YOLO(modelPath: 'yolo26n');
await yolo.loadModel();
final results = await yolo.predict(imageBytes);

▶️ Example App | 📖 Installation Guide | ⚡ Quick Start Guide

Import models from Ultralytics Platform

In your model’s Export tab, click the QR button on a completed LiteRT export (or Core ML for iPhone), then open the app, tap the QR button in the bottom toolbar, and point the existing camera preview at the code. While scanning, the camera dims around a viewfinder; tap Cancel or the QR button again to return to live inference. Use LiteRT with FP32 or W8A32 precision for Android, or Core ML for iPhone; exports must use batch 1 and static input shapes. The example app previews the model before downloading and adds it to the Models picker for selection, removal, and offline use. Tap the active model’s name to choose a Custom import or any Official model from compact task rows with size choices. The header shows the task, with a Custom marker for imports, above the model name. The Custom section also provides a Scan QR row with a help button for the Platform export guide. Core AI import links open in the native iOS app.

Import links authorize one export for 24 hours. Anyone with the link can download it during that time; installed models keep working after the link expires. Each export installs separately, even when model names match. App-link handling belongs to the example app; the plugin’s resolver and model picker remain usable with your own download source.

📦 Model Loading

The plugin supports three model flows.

1. Official model IDs

Use the default official model or a specific official ID and let the plugin handle download and caching:

final yolo = YOLO(modelPath: YOLO.defaultOfficialModel() ?? 'yolo26n');

Call YOLO.officialModels() to see which official IDs are available on the current platform. Official assets are downloaded on first use and cached in app storage, so the app package does not carry large model files.

Official assets are maintained as GitHub release assets:

Platform Runtime asset Release
Android LiteRT w8a32 .tflite yolo-flutter-app v0.7.0
Android NPU (opt-in) QNN *_v73/_v81_qnn.onnx yolo-flutter-app v0.7.0
iOS Core ML int8 .mlpackage.zip yolo-ios-app v8.3.0

The Flutter resolver uses the LiteRT release for Android and the Core ML release for Apple platforms. Every mobile asset uses a fixed 224 × 224 classification input or 640 × 640 input for every other task. These release tags are intentionally pinned for reproducible first-use downloads. See the model guide for the official export matrix, URL patterns, and model properties.

Core ML (.mlpackage) remains the default. Core AI (.aimodel) is an opt-in for iOS 27 and later devices: pass an .aimodel path, an .aimodel.zip Flutter asset, or an .aimodel.zip URL. It is not available on earlier iOS versions or in the iOS Simulator. The Ultralytics iOS app exposes the same opt-in as a Settings toggle (off by default). The official opt-in assets are the .aimodel.zip files on the yolo-ios-app v8.3.0 release; see the yolo-ios-app performance record for the trade-offs.

final yolo = YOLO(modelPath: 'https://github.com/ultralytics/yolo-ios-app/releases/download/v8.3.0/yolo26n.aimodel.zip');

2. Your own exported model

Pass your own exported YOLO model as a local path or Flutter asset path:

final yolo = YOLO(modelPath: 'assets/models/my-finetuned-model.tflite');

If the exported model includes embedded metadata, the plugin infers task and class labels automatically — it reads Ultralytics’ appended-ZIP metadata, with a standard TFLite (FlatBuffers) metadata fallback — so drag-and-drop custom models auto-detect. If metadata is missing, pass task explicitly.

final yolo = YOLO(
  modelPath: 'assets/models/my-finetuned-model.tflite',
  task: YOLOTask.detect,
);

3. Remote model URL

Pass an http or https URL and the plugin will download it into app storage before loading it.

4. Qualcomm NPU models (Android, opt-in)

Android ships with LiteRT (TFLite) and that remains the default — nothing changes for existing apps, and the QNN support adds zero bytes to your build. Any model path ending in _qnn.onnx (a Qualcomm QNN context binary exported with yolo export model=yolo26n.pt format=qnn nms=None imgsz=640, or imgsz=224 for classification) is routed to the Hexagon NPU through the ONNX Runtime QNN Execution Provider instead. Export with ultralytics>=8.4.188: earlier releases running onnxruntime-qnn 2.4 or newer write context binaries that fail to load here with Input name not found. nms=None selects raw one-to-many outputs for Android-side NMS.

Running QNN models requires a Snapdragon device with a Hexagon HTP (Snapdragon 8 Gen 2 or newer for the official _v73 assets; _v81 targets Snapdragon 8 Elite Gen 5) and three additions to your app’s android/app/build.gradle:

android {
    packagingOptions {
        jniLibs {
            useLegacyPackaging = true // the Hexagon DSP loader needs real .so files, not APK-mmapped ones
        }
    }
}

dependencies {
    implementation 'com.microsoft.onnxruntime:onnxruntime-android-qnn:1.29.0'
    implementation 'com.qualcomm.qti:qnn-runtime:2.51.0' // newer than the AAR's bundled QAIRT; required for the latest Snapdragons
}
final yolo = YOLO(
  modelPath: 'https://github.com/ultralytics/yolo-flutter-app/releases/download/v0.7.0/yolo26n_v73_qnn.onnx',
  task: YOLOTask.detect,
);

Without the Gradle opt-in, loading a _qnn.onnx model fails with a clear error and TFLite models are unaffected. The bundled example app follows the same opt-in — it ships without the QNN runtime to keep its download small, so build it with ENABLE_QNN=1 (e.g. ENABLE_QNN=1 flutter run --release) to test the NPU path on a device. See the performance guide for measured CPU/GPU/NPU numbers and tuning notes.

🧭 Official vs. Custom

Use case Recommended path
Fastest first integration Official model ID like yolo26n
You trained or exported your own model Custom asset or local file
You ship different models per customer or environment Remote URL
You need the plugin to infer task automatically Any export with metadata
You have an older or stripped export without metadata Custom model plus explicit task

For official models, start with YOLO.defaultOfficialModel() or YOLO.officialModels(). For custom models, start with the exported file you actually plan to ship.

📥 Using Your Own Model

For custom models, keep the app-side setup minimal.

  • Android native assets: place .tflite files in android/app/src/main/assets
  • Flutter assets on Android: place .tflite files in assets/models/
  • iOS bundle: drag .mlpackage or .mlmodel into ios/Runner.xcworkspace
  • Flutter assets on iOS: place .mlpackage.zip files in assets/models/

Then point modelPath at that file or asset path.

Official asset maintenance

The Android TFLite release assets are generated by scripts/export-tflite-models.py. The script defines the official YOLO26 task/size matrix, w8a32 export settings (int8 weights, FP32 activations — dynamic-range, so no calibration data is needed), optional one-shot TFLite inference verification, and optional GitHub release upload.

Run it on Linux x86 or macOS with Python ≥3.10:

uv venv --python 3.12 .venv
uv pip install --torch-backend cpu "ultralytics-opencv-headless[export-litert]>=8.4.188"
uv run python scripts/export-tflite-models.py --verify

Use --upload --repo ultralytics/yolo-flutter-app --tag v0.7.0 to replace the existing .tflite assets. Export QNN with Ultralytics using the same task-specific imgsz. Core ML assets are generated by ../yolo-ios-app/scripts/export-models.py and hosted on the existing iOS v8.3.0 release.

Android inference runs on LiteRT 2.x through an automatic GPU -> CPU accelerator ladder. w8a32 assets are the official download artifacts (the smallest GPU-compatible litert format); the GPU delegate compiles the whole graph on supported devices and otherwise falls back to CPU. GPU coverage still depends on the device driver and graph, so confirm delegate placement on your target hardware (the GPU delegate runs the graph in FP16):

# Requires ultralytics>=8.4.142
from ultralytics import YOLO

YOLO("yolo26n.pt").export(format="litert", nms=None, imgsz=640)
# Classification models use imgsz=224.

🎯 Choosing an API

Use YOLO when you already have image bytes and want one prediction at a time:

final yolo = YOLO(modelPath: 'yolo26n');
await yolo.loadModel();
final results = await yolo.predict(imageBytes);

Use YOLOView when you want live camera inference:

final controller = YOLOViewController();

YOLOView(
  modelPath: 'yolo26n',
  controller: controller,
  onResult: (results) {},
)

await controller.switchModel('assets/models/custom.tflite', YOLOTask.detect);

Use YOLOShowcase when you want the complete Ultralytics camera UI:

YOLOShowcase(
  initialTask: YOLOTask.detect,
  initialModelSize: 'n',
  onCapture: (bytes) {},
)

🔄 Migrating From 0.3.x UI APIs

Version 0.4.0 removes the old Dart-side overlay/control layer. Camera detections are rendered natively by YOLOView; Flutter now owns only the surrounding app controls.

Removed 0.3.x API 0.4.0 replacement
YOLOOverlay, YOLOOverlayTheme Remove these widgets. Use native YOLOView overlays, or consume onResult/YOLO.predict() data.
YOLOControls Use YOLOShowcase for the full UI, or compose the exported Material widgets directly.
YOLOView.showNativeUI Use YOLOShowcase for built-in controls; use bare YOLOView when building your own UI.
YOLOView.showOverlays, YOLOView.overlayTheme No constructor replacement. Camera overlay drawing is native and not themed from Dart.
YOLOViewController.setShowUIControls() Show/hide your own Flutter controls around YOLOView.
YOLOViewController.setShowOverlays() Still available: toggles native overlay rendering. capturePhoto(withOverlays: false) only affects captured JPEG output.

🧩 Recommended Patterns

App type Model loading pattern
Live camera app YOLOView(modelPath: 'yolo26n')
Photo picker or gallery workflow YOLO(modelPath: 'yolo26n')
App with your own bundled model YOLO(modelPath: 'assets/models/custom.tflite')
Cross-platform Core ML + TFLite app Use platform-appropriate exported assets and let metadata drive task
App that changes models at runtime YOLOViewController.switchModel(...)

📚 Documentation

Guide Description
Installation Guide Requirements and platform setup
Quick Start Minimal setup for the first working app
Model Guide Official models, custom models, export flow
Usage Guide Common app patterns and examples
API Reference Full API surface
Performance Guide Tuning controls and on-device benchmark record
Troubleshooting Common problems and fixes

🤝 Community & Support

Ultralytics Discord Ultralytics Forums Ultralytics Reddit

  • 💬 Questions? Discord | Forums | GitHub Issues
  • 🐛 Found a bug? Report it here
  • 💡 Feature request? Let us know

💡 Contribute

Ultralytics thrives on community collaboration, and we deeply value your contributions! Whether it’s bug fixes, feature enhancements, or documentation improvements, your involvement is crucial. Please review our Contributing Guide for detailed insights on how to participate. We also encourage you to share your feedback through our Survey. A heartfelt thank you 🙏 goes out to all our contributors!

Ultralytics open-source contributors

📄 License

Ultralytics offers two licensing options to accommodate diverse needs:

  • AGPL-3.0 License: Ideal for students, researchers, and enthusiasts passionate about open-source collaboration. This OSI-approved license promotes knowledge sharing and open contribution. See the LICENSE file for details.
  • Enterprise License: Designed for commercial applications, this license permits seamless integration of Ultralytics software and AI models into commercial products and services, bypassing the open-source requirements of AGPL-3.0. For commercial use cases, please inquire about an Enterprise License.

🔗 Related Resources

Native iOS Development

If you’re interested in using YOLO models directly in iOS applications with Swift (without Flutter), check out our dedicated iOS repository:

👉 Ultralytics YOLO iOS App - A native iOS application for real-time detection, instance segmentation, semantic segmentation, depth estimation, classification, pose estimation, and OBB detection with Ultralytics YOLO models.

This repository provides:

  • Pure Swift implementation for iOS
  • Direct Core ML integration
  • Native iOS UI components
  • Example code for various YOLO tasks
  • Optimized for iOS performance
Note 注意

On iOS this plugin is built on the shared UltralyticsYOLO Swift package (import UltralyticsYOLO) — the same inference core used by the native iOS app — so both stay in sync from a single source of truth. The plugin’s iOS sources (ios/ultralytics_yolo/) hold only the Flutter bridge and the camera/view components, and ship for both Swift Package Manager and CocoaPods.

📮 Contact

Encountering issues or have feature requests related to Ultralytics YOLO? Please report them via GitHub Issues. For broader discussions, questions, and community support, join our Discord server!


Ultralytics GitHub space Ultralytics LinkedIn space Ultralytics Twitter space Ultralytics YouTube space Ultralytics TikTok space Ultralytics BiliBili space Ultralytics Discord

评论

登录 后发表评论
暂无评论
GitRead 中文社区
深度解读 · 趋势洞察 · 价值精选

关于

关于我们联系我们编辑准则收录标准赞赏人员

发现

技术趋势新手训练营资源精选实战指南精选专题热门话题GitHub 文档

条款

隐私政策服务条款网站地图
26.9万收录项目
5.1万中文话题
155精选专题
发现技术价值,连接开源智慧
© 2026 GitRead · GitHub 中文社区 本站与 GitHub, Inc. 无隶属关系;GitHub 是 GitHub, Inc. 的商标。