适用于 iOS 的 开源Ultralytics YOLO:应用程序和 Swift 软件包,用于在您自己的 iOS 应用程序中运行 YOLO

​一、软件介绍

文末提供程序和源码下载

该项目利用 Ultralytics 最先进的 YOLO11 模型将您的 iOS 设备转变为用于对象检测的强大实时推理工具。直接从 App Store 下载该应用程序,或浏览我们的指南,将 YOLO 功能集成到您自己的 Swift 应用程序中。

二、Ultralytics YOLO iOS 应用程序(主应用程序)

主要的 iOS 应用程序允许使用设备的相机或图像库轻松进行实时对象检测。您只需将自定义 CoreML 模型拖放到应用程序中,即可轻松测试这些模型。

三、Swift 包(YOLO 库)

专为 iOS、iPadOS 和 macOS 设计的轻量级 Swift 软件包。它简化了基于 YOLO 的模型(如 YOLO11)在您自己的应用程序中的集成和使用。使用 SwiftUI 以最少的代码轻松集成 YOLO 模型:

复制代码
// Perform inference on a UIImage
let result = model(uiImage)
复制代码
// Use the built-in camera view for real-time detection
var body: some View {
    YOLOCamera(
        modelPathOrName: "yolo11n-seg", // Specify model name or path
        task: .segment,                // Define the task (detect, segment, classify, pose)
        cameraPosition: .back          // Choose camera (back or front)
    )
    .ignoresSafeArea()
}

四、快速入门指南

首次在移动设备上使用 YOLO 或想要快速测试您的自定义模型?从主 YOLOiOSApp 开始。

  • Ultralytics YOLO iOS App (Main App): The easiest way to experience YOLO detection on iOS.
    Ultralytics YOLO iOS 应用程序(主应用程序):在 iOS 上体验 YOLO 检测的最简单方法。

Ready to integrate YOLO into your own project? Explore the Swift Package and example applications.
准备好将 YOLO 集成到您自己的项目中了吗?探索 Swift Package 和示例应用程序。

  • Swift Package (YOLO Library): Integrate YOLO capabilities into your Swift app.
    Swift 软件包(YOLO 库):将 YOLO 功能集成到您的 Swift 应用程序中。
  • Example Apps: See practical implementations using the YOLO Swift Package.
    示例应用程序:查看使用 YOLO Swift Package 的实际实现。

五、 主要亮点

  • Real-Time Inference : Achieve high-speed, high-accuracy object detection on iPhones and iPads using optimized CoreML models, potentially enhanced through techniques like model quantization.
    实时推理:使用优化的 CoreML 模型在 iPhone 和 iPad 上实现高速、高精度的对象检测,并可能通过模型量化等技术得到增强。
  • Multi-OS Support : The Swift Package is compatible with iOS, iPadOS, and macOS, enabling broad application deployment.
    多作系统支持:Swift 套件与 iOS、iPadOS 和 macOS 兼容,支持广泛的应用程序部署。
  • Flexible Tasks : Supports object detection, with segmentation, classification, pose estimation, and oriented bounding box (OBB) detection planned for future updates.
    灵活的任务:支持对象检测,并计划在未来更新中进行分割、分类、姿势估计和定向边界框 (OBB) 检测。

🧪 Testing Procedures 🧪 测试程序

This repository includes comprehensive unit tests for both the YOLO Swift Package and the example applications, ensuring code reliability and stability.
此存储库包括针对 YOLO Swift Package 和示例应用程序的全面单元测试,确保代码的可靠性和稳定性。

Running Tests 运行测试

Tests require CoreML model files (.mlpackage), which are not included in the repository due to their size. To run the tests with model validation:
测试需要 CoreML 模型文件 ( .mlpackage ),由于大小的原因,这些文件未包含在存储库中。要使用模型验证运行测试:

  1. Set SKIP_MODEL_TESTS = false in the relevant test files (e.g., YOLOv11Tests.swift).
    SKIP_MODEL_TESTS = false 相关测试文件中设置(例如 YOLOv11Tests.swift )。
  2. Download the required models from the Ultralytics releases or train your own using tools like Ultralytics HUB.
    从 Ultralytics 版本下载所需的模型,或使用 Ultralytics HUB 等工具训练您自己的模型。
  3. Convert the models to CoreML format using the Ultralytics Python library's export function.
    使用 Ultralytics Python 库的导出功能将模型转换为 CoreML 格式。
  4. Add the exported .mlpackage files to your Xcode project, ensuring they are included in the test targets.
    将导出 .mlpackage 的文件添加到您的 Xcode 项目中,确保它们包含在测试目标中。
  5. Run the tests using Xcode's Test Navigator (Cmd+U).
    使用 Xcode 的 Test Navigator (Cmd+U) 运行测试。

If you don't have the model files, you can still run tests by keeping SKIP_MODEL_TESTS = true. This will skip tests that require loading and running a model.
如果您没有模型文件,您仍然可以通过保留 SKIP_MODEL_TESTS = true 来运行测试。这将跳过需要加载和运行模型的测试。

Test Coverage 测试覆盖率

  • YOLO Swift Package : Includes tests for core functionalities like model loading, preprocessing, inference, and postprocessing across different tasks.
    YOLO Swift 软件包:包括对核心功能的测试,例如跨不同任务的模型加载、预处理、推理和后处理。
  • Example Apps : Contains tests verifying UI components, model integration, and real-time inference performance within the sample applications.
    示例应用程序:包含验证示例应用程序中的 UI 组件、模型集成和实时推理性能的测试。

Test Documentation 测试文档

Each test directory (e.g., Tests/YOLOTests) may include a README.md with specific instructions for testing that component, covering:
每个测试目录(例如) Tests/YOLOTests 可能包含一个 README.md ,其中包含用于测试该组件的具体说明,包括:

  • Required model files and where to obtain them.
    所需的模型文件以及获取它们的位置。
  • Steps for model conversion and setup.
    模型转换和设置的步骤。
  • Overview of the testing strategy.
    测试策略概述。
  • Explanation of key test cases.
    关键测试用例的解释。

六、软件下载

夸克网盘分享

本文信息来源于GitHub作者地址:GitHub - ultralytics/yolo-ios-app: Ultralytics YOLO iOS App source code for running YOLO in your own iOS apps 🌟

相关推荐
未来侦察班4 小时前
一晃13年过去了,苹果的Airdrop依然很坚挺。
macos·ios·苹果vision pro
智驱力人工智能4 小时前
小区高空抛物AI实时预警方案 筑牢社区头顶安全的实践 高空抛物检测 高空抛物监控安装教程 高空抛物误报率优化方案 高空抛物监控案例分享
人工智能·深度学习·opencv·算法·安全·yolo·边缘计算
工程师老罗4 小时前
YOLOv1 核心结构解析
yolo
猫头虎4 小时前
如何排查并解决项目启动时报错Error encountered while processing: java.io.IOException: closed 的问题
java·开发语言·jvm·spring boot·python·开源·maven
Lun3866buzha4 小时前
YOLOv10-BiFPN融合:危险物体检测与识别的革新方案,从模型架构到实战部署全解析
yolo
草梅友仁4 小时前
墨梅博客 1.4.0 发布与开源动态 | 2026 年第 6 周草梅周报
开源·github·ai编程
Katecat996635 小时前
YOLOv8-MambaOut在电子元器件缺陷检测中的应用与实践_1
yolo
工程师老罗6 小时前
YOLOv1 核心知识点笔记
笔记·yolo
冬奇Lab8 小时前
一天一个开源项目(第16篇):Code2Video - 用代码生成高质量教学视频的智能框架
开源·aigc·音视频开发