콘텐츠로 건너뛰기

CoreML Export for YOLO11 Models

Deploying computer vision models on Apple devices like iPhones and Macs requires a format that ensures seamless performance.

The CoreML export format allows you to optimize your Ultralytics YOLO11 models for efficient object detection in iOS and macOS applications. In this guide, we'll walk you through the steps for converting your models to the CoreML format, making it easier for your models to perform well on Apple devices.

CoreML

CoreML 개요

CoreML is Apple's foundational machine learning framework that builds upon Accelerate, BNNS, and Metal Performance Shaders. It provides a machine-learning model format that seamlessly integrates into iOS applications and supports tasks such as image analysis, natural language processing, audio-to-text conversion, and sound analysis.

Core ML 프레임워크는 온디바이스 컴퓨팅을 사용하여 작동하므로 애플리케이션은 네트워크 연결이나 API 호출 없이도 Core ML을 활용할 수 있습니다. 즉, 사용자의 디바이스에서 로컬로 모델 추론을 수행할 수 있습니다.

CoreML 모델의 주요 기능

Apple의 CoreML 프레임워크는 온디바이스 머신러닝을 위한 강력한 기능을 제공합니다. 다음은 CoreML 을 개발자를 위한 강력한 도구로 만드는 주요 기능입니다:

  • Comprehensive Model Support: Converts and runs models from popular frameworks like TensorFlow, PyTorch, scikit-learn, XGBoost, and LibSVM.

CoreML 지원 모델

  • On-device Machine Learning: Ensures data privacy and swift processing by executing models directly on the user's device, eliminating the need for network connectivity.

  • Performance and Optimization: Uses the device's CPU, GPU, and Neural Engine for optimal performance with minimal power and memory usage. Offers tools for model compression and optimization while maintaining accuracy.

  • 통합의 용이성: 다양한 모델 유형에 대한 통합 형식과 앱에 원활하게 통합할 수 있는 사용자 친화적인 API를 제공합니다. 비전 및 자연어와 같은 프레임워크를 통해 도메인별 작업을 지원합니다.

  • 고급 기능: 개인화된 경험을 위한 온디바이스 교육 기능, 대화형 ML 경험을 위한 비동기 예측, 모델 검사 및 검증 도구가 포함되어 있습니다.

CoreML 배포 옵션

Before we look at the code for exporting YOLO11 models to the CoreML format, let's understand where CoreML models are usually used.

CoreML 는 다음과 같은 머신 러닝 모델을 위한 다양한 배포 옵션을 제공합니다:

  • 온디바이스 배포: 이 방법은 CoreML 모델을 iOS 앱에 직접 통합합니다. 지연 시간이 짧고, 개인정보 보호가 강화되며(데이터가 디바이스에 남아 있기 때문에), 오프라인 기능을 보장하는 데 특히 유리합니다. 그러나 이 접근 방식은 특히 더 크고 복잡한 모델의 경우 디바이스의 하드웨어 기능에 따라 제한될 수 있습니다. 온디바이스 배포는 다음 두 가지 방법으로 실행할 수 있습니다.

    • 임베디드 모델: 이 모델은 앱 번들에 포함되어 있으며 즉시 액세스할 수 있습니다. 자주 업데이트할 필요가 없는 소규모 모델에 이상적입니다.

    • 다운로드한 모델: 이 모델은 필요에 따라 서버에서 가져옵니다. 이 접근 방식은 대규모 모델이나 정기적인 업데이트가 필요한 모델에 적합합니다. 앱 번들 크기를 작게 유지하는 데 도움이 됩니다.

  • 클라우드 기반 배포: CoreML 모델은 서버에서 호스팅되며 API 요청을 통해 iOS 앱에서 액세스합니다. 이 확장 가능하고 유연한 옵션을 사용하면 앱을 수정하지 않고도 모델을 쉽게 업데이트할 수 있습니다. 복잡한 모델이나 정기적인 업데이트가 필요한 대규모 앱에 이상적입니다. 하지만 인터넷 연결이 필요하며 지연 시간 및 보안 문제가 발생할 수 있습니다.

Exporting YOLO11 Models to CoreML

Exporting YOLO11 to CoreML enables optimized, on-device machine learning performance within Apple's ecosystem, offering benefits in terms of efficiency, security, and seamless integration with iOS, macOS, watchOS, and tvOS platforms.

설치

필요한 패키지를 설치하려면 실행합니다:

설치

# Install the required package for YOLO11
pip install ultralytics

For detailed instructions and best practices related to the installation process, check our YOLO11 Installation guide. While installing the required packages for YOLO11, if you encounter any difficulties, consult our Common Issues guide for solutions and tips.

사용법

Before diving into the usage instructions, be sure to check out the range of YOLO11 models offered by Ultralytics. This will help you choose the most appropriate model for your project requirements.

사용법

from ultralytics import YOLO

# Load the YOLO11 model
model = YOLO("yolo11n.pt")

# Export the model to CoreML format
model.export(format="coreml")  # creates 'yolo11n.mlpackage'

# Load the exported CoreML model
coreml_model = YOLO("yolo11n.mlpackage")

# Run inference
results = coreml_model("https://ultralytics.com/images/bus.jpg")
# Export a YOLO11n PyTorch model to CoreML format
yolo export model=yolo11n.pt format=coreml  # creates 'yolo11n.mlpackage''

# Run inference with the exported model
yolo predict model=yolo11n.mlpackage source='https://ultralytics.com/images/bus.jpg'

내보내기 프로세스에 대한 자세한 내용은 내보내기 관련 문서 페이지(Ultralytics )를 참조하세요.

Deploying Exported YOLO11 CoreML Models

Having successfully exported your Ultralytics YOLO11 models to CoreML, the next critical phase is deploying these models effectively. For detailed guidance on deploying CoreML models in various environments, check out these resources:

  • CoreML Tools: This guide includes instructions and examples to convert models from TensorFlow, PyTorch, and other libraries to Core ML.

  • ML 및 비전: CoreML 모델 사용 및 구현의 다양한 측면을 다루는 포괄적인 동영상 모음입니다.

  • 앱에 핵심 ML 모델 통합하기: CoreML 모델을 iOS 애플리케이션에 통합하는 방법에 대한 포괄적인 가이드로, 모델 준비부터 다양한 기능을 위해 앱에서 구현하는 단계까지 자세히 설명합니다.

요약

In this guide, we went over how to export Ultralytics YOLO11 models to CoreML format. By following the steps outlined in this guide, you can ensure maximum compatibility and performance when exporting YOLO11 models to CoreML.

사용법에 대한 자세한 내용은 CoreML 공식 문서를 참조하세요.

Also, if you'd like to know more about other Ultralytics YOLO11 integrations, visit our integration guide page. You'll find plenty of valuable resources and insights there.

자주 묻는 질문

How do I export YOLO11 models to CoreML format?

내보내려면 Ultralytics YOLO11 모델을 CoreML 형식으로 변환하려면 먼저 ultralytics 패키지가 설치되어 있습니다. 다음을 사용하여 설치할 수 있습니다:

설치

pip install ultralytics

다음으로 다음 Python 또는 CLI 명령을 사용하여 모델을 내보낼 수 있습니다:

사용법

from ultralytics import YOLO

model = YOLO("yolo11n.pt")
model.export(format="coreml")
yolo export model=yolo11n.pt format=coreml

For further details, refer to the Exporting YOLO11 Models to CoreML section of our documentation.

What are the benefits of using CoreML for deploying YOLO11 models?

CoreML provides numerous advantages for deploying Ultralytics YOLO11 models on Apple devices:

  • On-device Processing: Enables local model inference on devices, ensuring data privacy and minimizing latency.
  • 성능 최적화: 기기의 CPU, GPU, Neural Engine의 잠재력을 최대한 활용하여 속도와 효율성을 모두 최적화합니다.
  • 손쉬운 통합: iOS , macOS, watchOS, tvOS 등 Apple의 에코시스템과 원활하게 통합할 수 있는 환경을 제공합니다.
  • 다목적성: CoreML 프레임워크를 사용하여 이미지 분석, 오디오 처리, 자연어 처리 등 다양한 머신 러닝 작업을 지원합니다.

CoreML 모델을 iOS 앱에 통합하는 방법에 대한 자세한 내용은 핵심 ML 모델을 앱에 통합하기 가이드를 참조하세요.

What are the deployment options for YOLO11 models exported to CoreML?

Once you export your YOLO11 model to CoreML format, you have multiple deployment options:

  1. 온디바이스 배포: CoreML 모델을 앱에 직접 통합하여 개인정보 보호 및 오프라인 기능을 강화하세요. 이 작업은 다음과 같이 수행할 수 있습니다:

    • 임베디드 모델: 앱 번들에 포함되어 있으며 즉시 액세스할 수 있습니다.
    • 다운로드한 모델: 필요에 따라 서버에서 가져와 앱 번들 크기를 작게 유지합니다.
  2. 클라우드 기반 배포: CoreML 모델을 서버에 호스팅하고 API 요청을 통해 액세스합니다. 이 접근 방식은 더 쉬운 업데이트를 지원하며 더 복잡한 모델을 처리할 수 있습니다.

CoreML 모델 배포에 대한 자세한 지침은 CoreML 배포 옵션을 참조하세요.

How does CoreML ensure optimized performance for YOLO11 models?

CoreML ensures optimized performance for Ultralytics YOLO11 models by utilizing various optimization techniques:

  • 하드웨어 가속: 효율적인 연산을 위해 기기의 CPU, GPU, Neural Engine을 사용합니다.
  • 모델 압축: 정확도 저하 없이 모델을 압축하여 설치 공간을 줄일 수 있는 도구를 제공합니다.
  • 적응형 추론: 속도와 성능 간의 균형을 유지하기 위해 디바이스의 기능에 따라 추론을 조정합니다.

성능 최적화에 대한 자세한 내용은 CoreML 공식 문서를 참조하세요.

내보낸 CoreML 모델로 직접 추론을 실행할 수 있나요?

예, 내보낸 CoreML 모델을 사용하여 직접 추론을 실행할 수 있습니다. 다음은 Python 및 CLI 에 대한 명령입니다:

추론 실행

from ultralytics import YOLO

coreml_model = YOLO("yolo11n.mlpackage")
results = coreml_model("https://ultralytics.com/images/bus.jpg")
yolo predict model=yolo11n.mlpackage source='https://ultralytics.com/images/bus.jpg'

자세한 내용은 CoreML 내보내기 가이드의 사용 섹션을 참조하세요.

📅 Created 8 months ago ✏️ Updated 22 days ago

댓글