انتقل إلى المحتوى

How to Export to TF GraphDef from YOLO11 for Deployment

When you are deploying cutting-edge computer vision models, like YOLO11, in different environments, you might run into compatibility issues. Google's TensorFlow GraphDef, or TF GraphDef, offers a solution by providing a serialized, platform-independent representation of your model. Using the TF GraphDef model format, you can deploy your YOLO11 model in environments where the complete TensorFlow ecosystem may not be available, such as mobile devices or specialized hardware.

In this guide, we'll walk you step by step through how to export your Ultralytics YOLO11 models to the TF GraphDef model format. By converting your model, you can streamline deployment and use YOLO11's computer vision capabilities in a broader range of applications and platforms.

TensorFlow GraphDef

لماذا يجب عليك التصدير إلى TF GraphDef?

TF GraphDef is a powerful component of the TensorFlow ecosystem that was developed by Google. It can be used to optimize and deploy models like YOLO11. Exporting to TF GraphDef lets us move models from research to real-world applications. It allows models to run in environments without the full TensorFlow framework.

ال GraphDef يمثل التنسيق النموذج كرسم بياني حسابي متسلسل. يتيح ذلك تقنيات التحسين المختلفة مثل الطي المستمر والتكميم وتحويلات الرسم البياني. تضمن هذه التحسينات التنفيذ الفعال وتقليل استخدام الذاكرة وسرعات الاستدلال الأسرع.

GraphDef models can use hardware accelerators such as GPUs, TPUs, and AI chips, unlocking significant performance gains for the YOLO11 inference pipeline. The TF GraphDef format creates a self-contained package with the model and its dependencies, simplifying deployment and integration into diverse systems.

الميزات الرئيسية ل TF GraphDef نماذج

TF GraphDef offers distinct features for streamlining model deployment and optimization.

فيما يلي نظرة على خصائصه الرئيسية:

  • نموذج التسلسل: TF GraphDef يوفر طريقة للتسلسل والتخزين TensorFlow نماذج بتنسيق مستقل عن النظام الأساسي. يسمح لك هذا التمثيل المتسلسل بتحميل النماذج الخاصة بك وتنفيذها بدون الأصل Python قاعدة التعليمات البرمجية ، مما يجعل النشر أسهل.

  • تحسين الرسم البياني: TF GraphDef يتيح تحسين الرسوم البيانية الحسابية. يمكن لهذه التحسينات تعزيز الأداء من خلال تبسيط تدفق التنفيذ وتقليل التكرار وتخصيص العمليات لتناسب أجهزة معينة.

  • مرونة النشر: النماذج المصدرة إلى GraphDef يمكن استخدام التنسيق في بيئات مختلفة ، بما في ذلك الأجهزة محدودة الموارد ومتصفحات الويب والأنظمة ذات الأجهزة المتخصصة. هذا يفتح إمكانيات لنشر أوسع ل TensorFlow نماذج.

  • التركيز على الإنتاج: GraphDef تم تصميمه لنشر الإنتاج. وهو يدعم التنفيذ الفعال وميزات التسلسل والتحسينات التي تتوافق مع حالات الاستخدام في العالم الحقيقي.

خيارات النشر مع TF GraphDef

Before we dive into the process of exporting YOLO11 models to TF GraphDef, let's take a look at some typical deployment situations where this format is used.

إليك كيفية النشر باستخدام TF GraphDef بكفاءة عبر منصات مختلفة.

  • TensorFlow التقديم: تم تصميم هذا الإطار للنشر TensorFlow النماذج في بيئات الإنتاج. TensorFlow يوفر العرض إدارة النماذج وتعيين الإصدار والبنية التحتية لخدمة النموذج بكفاءة على نطاق واسع. إنها طريقة سلسة لدمج GraphDef-النماذج المستندة إلى خدمات ويب الإنتاج أو واجهات برمجة التطبيقات.

  • الأجهزة المحمولة والمدمجة: باستخدام أدوات مثل TensorFlow لايت, يمكنك تحويل TF GraphDef النماذج إلى تنسيقات محسنة للهواتف الذكية والأجهزة اللوحية والأجهزة المدمجة المختلفة. يمكن بعد ذلك استخدام نماذجك للاستدلال على الجهاز ، حيث يتم التنفيذ محليا ، وغالبا ما يوفر مكاسب في الأداء وإمكانات غير متصلة بالإنترنت.

  • Web Browsers: TensorFlow.js enables the deployment of TF GraphDef models directly within web browsers. It paves the way for real-time object detection applications running on the client side, using the capabilities of YOLO11 through JavaScript.

  • الأجهزة المتخصصة: TF GraphDef، تسمح الطبيعة المحايدة للنظام الأساسي باستهداف الأجهزة المخصصة ، مثل المسرعات ووحدات TPU (Tensor وحدات المعالجة). يمكن أن توفر هذه الأجهزة مزايا أداء للنماذج كثيفة الحساب.

Exporting YOLO11 Models to TF GraphDef

You can convert your YOLO11 object detection model to the TF GraphDef format, which is compatible with various systems, to improve its performance across platforms.

تركيب

لتثبيت الحزمة المطلوبة ، قم بتشغيل:

تركيب

# 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 TF GraphDef format
model.export(format="pb")  # creates 'yolo11n.pb'

# Load the exported TF GraphDef model
tf_graphdef_model = YOLO("yolo11n.pb")

# Run inference
results = tf_graphdef_model("https://ultralytics.com/images/bus.jpg")
# Export a YOLO11n PyTorch model to TF GraphDef format
yolo export model=yolo11n.pt format=pb  # creates 'yolo11n.pb'

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

لمزيد من التفاصيل حول خيارات التصدير المدعومة، تفضل بزيارة Ultralytics صفحة الوثائق حول خيارات النشر.

Deploying Exported YOLO11 TF GraphDef Models

Once you've exported your YOLO11 model to the TF GraphDef format, the next step is deployment. The primary and recommended first step for running a TF GraphDef model is to use the YOLO("model.pb") method, as previously shown in the usage code snippet.

ومع ذلك، لمزيد من المعلومات حول نشر TF GraphDef النماذج ، ألق نظرة على الموارد التالية:

  • TensorFlow Serving: A guide on TensorFlow Serving that teaches how to deploy and serve machine learning models efficiently in production environments.

  • TensorFlow Lite: تصف هذه الصفحة كيفية تحويل نماذج التعلم الآلي إلى تنسيق محسن للاستدلال على الجهاز باستخدام TensorFlow لايت.

  • TensorFlow.js: دليل حول تحويل النموذج يعلم كيفية التحويل TensorFlow أو نماذج كيراس في TensorFlowتنسيق .js للاستخدام في تطبيقات الويب.

ملخص

In this guide, we explored how to export Ultralytics YOLO11 models to the TF GraphDef format. By doing this, you can flexibly deploy your optimized YOLO11 models in different environments.

لمزيد من التفاصيل حول الاستخدام ، قم بزيارة TF GraphDef الوثائق الرسمية.

For more information on integrating Ultralytics YOLO11 with other platforms and frameworks, don't forget to check out our integration guide page. It has great resources and insights to help you make the most of YOLO11 in your projects.

الأسئلة المتداولة

How do I export a YOLO11 model to TF GraphDef format?

Ultralytics YOLO11 models can be exported to TensorFlow GraphDef (TF GraphDef) format seamlessly. This format provides a serialized, platform-independent representation of the model, ideal for deploying in varied environments like mobile and web. To export a YOLO11 model to TF GraphDef, follow these steps:

استخدام

from ultralytics import YOLO

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

# Export the model to TF GraphDef format
model.export(format="pb")  # creates 'yolo11n.pb'

# Load the exported TF GraphDef model
tf_graphdef_model = YOLO("yolo11n.pb")

# Run inference
results = tf_graphdef_model("https://ultralytics.com/images/bus.jpg")
# Export a YOLO11n PyTorch model to TF GraphDef format
yolo export model="yolo11n.pt" format="pb"  # creates 'yolo11n.pb'

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

للمزيد من المعلومات حول خيارات التصدير المختلفة، يرجى زيارة الموقع الإلكتروني Ultralytics وثائق تصدير النماذج.

What are the benefits of using TF GraphDef for YOLO11 model deployment?

Exporting YOLO11 models to the TF GraphDef format offers multiple advantages, including:

  1. استقلالية النظام الأساسي: TF GraphDef يوفر تنسيقاً مستقلاً عن النظام الأساسي، مما يسمح بنشر النماذج عبر بيئات مختلفة بما في ذلك متصفحات الجوال والويب.
  2. التحسينات: يتيح التنسيق العديد من التحسينات، مثل الطي الثابت، والتحويل الكمي، وتحويلات الرسم البياني، مما يعزز كفاءة التنفيذ ويقلل من استخدام الذاكرة.
  3. تسريع الأجهزة: يمكن للنماذج بتنسيق TF GraphDef الاستفادة من مسرعات الأجهزة مثل وحدات معالجة الرسومات ووحدات معالجة الرسومات، ووحدات معالجة الرسومات، وشرائح الذكاء الاصطناعي لتحقيق مكاسب في الأداء.

اقرأ المزيد عن الفوائد في قسمTF GraphDef من وثائقنا.

Why should I use Ultralytics YOLO11 over other object detection models?

Ultralytics YOLO11 offers numerous advantages compared to other models like YOLOv5 and YOLOv7. Some key benefits include:

  1. State-of-the-Art Performance: YOLO11 provides exceptional speed and accuracy for real-time object detection, segmentation, and classification.
  2. سهولة الاستخدام: تتميز بواجهة برمجة تطبيقات سهلة الاستخدام لتدريب النماذج والتحقق من صحتها والتنبؤ بها وتصديرها، مما يجعلها في متناول كل من المبتدئين والخبراء.
  3. توافق واسع النطاق: يدعم العديد من تنسيقات التصدير بما في ذلك ONNX و TensorRT و CoreML و TensorFlow ، لخيارات نشر متعددة الاستخدامات.

Explore further details in our introduction to YOLO11.

How can I deploy a YOLO11 model on specialized hardware using TF GraphDef?

Once a YOLO11 model is exported to TF GraphDef format, you can deploy it across various specialized hardware platforms. Typical deployment scenarios include:

  • TensorFlow الخدمة: استخدم TensorFlow Serving لنشر النماذج القابلة للتطوير في بيئات الإنتاج. يدعم إدارة النماذج والعرض الفعال.
  • الأجهزة المحمولة: قم بتحويل نماذج TF GraphDef إلى TensorFlow Lite، المحسّنة للأجهزة المحمولة والأجهزة المدمجة، مما يتيح الاستدلال على الجهاز.
  • متصفحات الويب: نشر النماذج باستخدام TensorFlow.js للاستدلال من جانب العميل في تطبيقات الويب.
  • مسرعات الذكاء الاصطناعي: استفد من وحدات المعالجة ثلاثية الأبعاد وشرائح الذكاء الاصطناعي المخصصة للاستدلال السريع.

راجع قسم خيارات النشر للحصول على معلومات مفصلة.

Where can I find solutions for common issues while exporting YOLO11 models?

For troubleshooting common issues with exporting YOLO11 models, Ultralytics provides comprehensive guides and resources. If you encounter problems during installation or model export, refer to:

These resources should help you resolve most issues related to YOLO11 model export and deployment.

📅 Created 7 months ago ✏️ Updated 22 days ago

التعليقات