コンテンツへスキップ

How to Export to NCNN from YOLO11 for Smooth Deployment

Deploying computer vision models on devices with limited computational power, such as mobile or embedded systems, can be tricky. You need to make sure you use a format optimized for optimal performance. This makes sure that even devices with limited processing power can handle advanced computer vision tasks well.

The export to NCNN format feature allows you to optimize your Ultralytics YOLO11 models for lightweight device-based applications. In this guide, we'll walk you through how to convert your models to the NCNN format, making it easier for your models to perform well on various mobile and embedded devices.

なぜNCNN 。

NCNN 概要

The NCNN framework, developed by Tencent, is a high-performance neural network inference computing framework optimized specifically for mobile platforms, including mobile phones, embedded devices, and IoT devices. NCNN is compatible with a wide range of platforms, including Linux, Android, iOS, and macOS.

NCNN is known for its fast processing speed on mobile CPUs and enables rapid deployment of deep learning models to mobile platforms. This makes it easier to build smart apps, putting the power of AI right at your fingertips.

NCNN モデルの主な特徴

NCNN models offer a wide range of key features that enable on-device machine learning by helping developers run their models on mobile, embedded, and edge devices:

  • Efficient and High-Performance: NCNN models are made to be efficient and lightweight, optimized for running on mobile and embedded devices like Raspberry Pi with limited resources. They can also achieve high performance with high accuracy on various computer vision-based tasks.

  • Quantization: NCNN models often support quantization which is a technique that reduces the precision of the model's weights and activations. This leads to further improvements in performance and reduces memory footprint.

  • 互換性:NCNN モデルは、以下のような一般的なディープラーニングフレームワークと互換性があります。 TensorFlowCaffeONNX.この互換性により、開発者は既存のモデルやワークフローを簡単に使用することができます。

  • 使いやすさ:NCNN モデルは、一般的なディープラーニングフレームワークとの互換性により、さまざまなアプリケーションに簡単に統合できるように設計されています。さらに、NCNN は、異なるフォーマット間でモデルを変換するためのユーザーフレンドリーなツールを提供し、開発環境全体でスムーズな相互運用性を保証します。

配備オプションNCNN

Before we look at the code for exporting YOLO11 models to the NCNN format, let's understand how NCNN models are normally used.

NCNN 効率とパフォーマンスを重視して設計されたモデルは、さまざまな配備プラットフォームに対応している:

  • モバイル展開:特にAndroid とiOS 向けに最適化されているため、モバイルアプリケーションにシームレスに統合でき、デバイス上での効率的な推論が可能。

  • 組み込みシステムとIoTデバイスUltralytics Guideを使ってRaspberry Pi上で推論を実行しても十分な速度が得られない場合、NCNN エクスポートされたモデルに切り替えることで高速化できる可能性があります。NCNN は、Raspberry PiやNVIDIA Jetsonのようなデバイス、特にデバイス上で迅速な処理が必要な場合に最適です。

  • デスクトップとサーバーへの展開:Linux、Windows、macOSのデスクトップおよびサーバー環境に展開でき、より高い計算能力で開発、トレーニング、評価をサポートします。

Export to NCNN: Converting Your YOLO11 Model

You can expand model compatibility and deployment flexibility by converting YOLO11 models to NCNN format.

インストール

必要なパッケージをインストールするには

インストール

# Install the required package for YOLO11
pip install ultralytics

For detailed instructions and best practices related to the installation process, check our Ultralytics 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, it's important to note that while all Ultralytics YOLO11 models are available for exporting, you can ensure that the model you select supports export functionality here.

使用方法

from ultralytics import YOLO

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

# Export the model to NCNN format
model.export(format="ncnn")  # creates '/yolo11n_ncnn_model'

# Load the exported NCNN model
ncnn_model = YOLO("./yolo11n_ncnn_model")

# Run inference
results = ncnn_model("https://ultralytics.com/images/bus.jpg")
# Export a YOLO11n PyTorch model to NCNN format
yolo export model=yolo11n.pt format=ncnn  # creates '/yolo11n_ncnn_model'

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

サポートされているエクスポートオプションの詳細については、Ultralytics 配置オプションのドキュメントページを参照してください。

Deploying Exported YOLO11 NCNN Models

After successfully exporting your Ultralytics YOLO11 models to NCNN format, you can now deploy them. The primary and recommended first step for running a NCNN model is to utilize the YOLO("./model_ncnn_model") method, as outlined in the previous usage code snippet. However, for in-depth instructions on deploying your NCNN models in various other settings, take a look at the following resources:

  • Android: This blog explains how to use NCNN models for performing tasks like object detection through Android applications.

  • マックオス:macOSでタスクを実行するためのNCNN モデルの使い方を理解する。

  • リナックス:このページでは、Raspberry Piやその他の類似デバイスのような限られたリソースのデバイスにNCNN 。

  • VS2017を使用したWindows x64:このブログでは、Visual Studio Community 2017を使用してWindows x64でNCNN モデルをデプロイする方法について説明します。

概要

In this guide, we've gone over exporting Ultralytics YOLO11 models to the NCNN format. This conversion step is crucial for improving the efficiency and speed of YOLO11 models, making them more effective and suitable for limited-resource computing environments.

詳しい使用方法については、 NCNN の公式ドキュメントを参照してください。

Also, if you're interested in exploring other integration options for Ultralytics YOLO11, be sure to visit our integration guide page for further insights and information.

よくあるご質問

How do I export Ultralytics YOLO11 models to NCNN format?

To export your Ultralytics YOLO11 model to NCNN format, follow these steps:

  • Python:を使用する。 export 関数をYOLO 。

    from ultralytics import YOLO
    
    # Load the YOLO11 model
    model = YOLO("yolo11n.pt")
    
    # Export to NCNN format
    model.export(format="ncnn")  # creates '/yolo11n_ncnn_model'
    
  • CLI:を使用する。 yolo コマンドを export という議論になる。

    yolo export model=yolo11n.pt format=ncnn  # creates '/yolo11n_ncnn_model'
    

詳細なエクスポートオプションについては、ドキュメントのエクスポートページをご覧ください。

What are the advantages of exporting YOLO11 models to NCNN?

Exporting your Ultralytics YOLO11 models to NCNN offers several benefits:

  • 効率性:NCNN モデルはモバイルおよび組み込みデバイス用に最適化されており、限られた計算リソースでも高いパフォーマンスを発揮します。
  • 量子:NCNN は、モデルの速度を向上させ、メモリ使用量を削減する量子化のようなテクニックをサポートしています。
  • 幅広い互換性:Android 、iOS 、Linux、macOSなど、複数のプラットフォームでNCNN モデルを展開できます。

詳細は、マニュアルの「 NCNN へのエクスポート」セクションを参照してください。

モバイルAIアプリケーションにNCNN 。

NCNNTencentによって開発され、特にモバイルプラットフォーム用に最適化されています。NCNN :

  • 高性能:モバイルCPUでの効率的で高速な処理のために設計されています。
  • Cross-Platform: Compatible with popular frameworks such as TensorFlow and ONNX, making it easier to convert and deploy models across different platforms.
  • コミュニティ・サポート:コミュニティの活発なサポートにより、継続的な改善とアップデートが保証されます。

詳しくは、ドキュメントのNCNN 概要をご覧ください。

What platforms are supported for NCNN model deployment?

NCNN は汎用性が高く、さまざまなプラットフォームに対応している:

  • モバイル:Android iOS.
  • 組み込みシステムとIoTデバイス:Raspberry PiやNVIDIA Jetsonなどのデバイス。
  • デスクトップとサーバー:Linux、Windows、macOS。

Raspberry Pi上でモデルを実行するのが十分速くない場合は、Raspberry Piガイドで詳しく説明しているように、NCNN フォーマットに変換することでスピードアップできる。

How can I deploy Ultralytics YOLO11 NCNN models on Android?

To deploy your YOLO11 models on Android:

  1. Android 用にビルドする:NCNN Build forAndroidガイドに従ってください。
  2. アプリケーションとの統合:NCNN Android SDK を使用して、エクスポートされたモデルをアプリケーションに統合し、効率的なオンデバイス推論を実現します。

For step-by-step instructions, refer to our guide on Deploying YOLO11 NCNN Models.

より高度なガイドや使用例については、Ultralytics ドキュメントページをご覧ください。

📅 Created 7 months ago ✏️ Updated 22 days ago

コメント