?一、軟件介紹
文末提供程序和源碼下載
? ? ? ?該項目利用 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 pathtask: .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
?),由于大小的原因,這些文件未包含在存儲庫中。要使用模型驗證運行測試:
- Set?
SKIP_MODEL_TESTS = false
?in the relevant test files (e.g.,?YOLOv11Tests.swift
).
在?SKIP_MODEL_TESTS = false
?相關測試文件中設置(例如?YOLOv11Tests.swift
?)。 - Download the required models from the?Ultralytics releases?or train your own using tools like?Ultralytics HUB.
從 Ultralytics 版本下載所需的模型,或使用 Ultralytics HUB 等工具訓練您自己的模型。 - Convert the models to CoreML format using the?Ultralytics Python library's export function.
使用 Ultralytics Python 庫的導出功能將模型轉換為 CoreML 格式。 - Add the exported?
.mlpackage
?files to your?Xcode?project, ensuring they are included in the test targets.
將導出?.mlpackage
?的文件添加到您的 Xcode 項目中,確保它們包含在測試目標中。 - 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 🌟