콘텐츠로 건너뛰기

Export to TF.js Model Format From a YOLO11 Model Format

Deploying machine learning models directly in the browser or on Node.js can be tricky. You'll need to make sure your model format is optimized for faster performance so that the model can be used to run interactive applications locally on the user's device. The TensorFlow.js, or TF.js, model format is designed to use minimal power while delivering fast performance.

The 'export to TF.js model format' feature allows you to optimize your Ultralytics YOLO11 models for high-speed and locally-run object detection inference. In this guide, we'll walk you through converting your models to the TF.js format, making it easier for your models to perform well on various local browsers and Node.js applications.

TF.js로 내보내야 하는 이유는 무엇인가요?

광범위한 TensorFlow 에코시스템의 일부로 TensorFlow 팀에서 개발한 TensorFlow.js로 머신 러닝 모델을 내보내면 머신 러닝 애플리케이션을 배포할 때 많은 이점을 얻을 수 있습니다. 민감한 데이터를 디바이스에 보관하여 사용자 개인정보 보호 및 보안을 강화하는 데 도움이 됩니다. 아래 이미지는 TensorFlow.js 아키텍처와 웹 브라우저와 Node.js에서 머신 러닝 모델이 어떻게 변환되고 배포되는지를 보여줍니다.

TF.js 아키텍처

Running models locally also reduces latency and provides a more responsive user experience. TensorFlow.js also comes with offline capabilities, allowing users to use your application even without an internet connection. TF.js is designed for efficient execution of complex models on devices with limited resources as it is engineered for scalability, with GPU acceleration support.

TF.js의 주요 기능

다음은 TF.js를 개발자를 위한 강력한 도구로 만드는 주요 기능입니다:

  • 크로스 플랫폼 지원: TensorFlow.js는 브라우저와 Node.js 환경 모두에서 사용할 수 있으므로 다양한 플랫폼에 유연하게 배포할 수 있습니다. 이를 통해 개발자는 애플리케이션을 더 쉽게 빌드하고 배포할 수 있습니다.

  • 여러 백엔드 지원: TensorFlow.js는 계산을 위한 다양한 백엔드( CPU, GPU 가속을 위한 WebGL, 네이티브에 가까운 실행 속도를 위한 WebAssembly(WASM), 고급 브라우저 기반 머신러닝 기능을 위한 WebGPU 등)를 지원합니다.

  • 오프라인 기능: TensorFlow .js를 사용하면 인터넷 연결 없이도 브라우저에서 모델을 실행할 수 있으므로 오프라인에서 작동하는 애플리케이션을 개발할 수 있습니다.

TensorFlow.js를 사용한 배포 옵션

Before we dive into the process of exporting YOLO11 models to the TF.js format, let's explore some typical deployment scenarios where this format is used.

TF.js는 머신 러닝 모델을 배포할 수 있는 다양한 옵션을 제공합니다:

  • 브라우저 내 ML 애플리케이션: 브라우저에서 직접 머신러닝 모델을 실행하는 웹 애플리케이션을 구축할 수 있습니다. 서버 측 계산이 필요하지 않으므로 서버 부하가 줄어듭니다.

  • Node.js 애플리케이션:: TensorFlow.js는 서버 측 머신 러닝 애플리케이션을 개발할 수 있도록 Node.js 환경에서의 배포도 지원합니다. 서버의 처리 능력이 필요하거나 서버 측 데이터에 액세스해야 하는 애플리케이션에 특히 유용합니다.

  • Chrome 확장 프로그램: 흥미로운 배포 시나리오는 TensorFlow.js를 사용하여 Chrome 확장 프로그램을 만드는 것입니다. 예를 들어, 사용자가 웹페이지 내의 이미지를 마우스 오른쪽 버튼으로 클릭하여 사전 학습된 ML 모델을 사용하여 이미지를 분류할 수 있는 확장 프로그램을 개발할 수 있습니다. TensorFlow.js를 일상적인 웹 브라우징 환경에 통합하여 머신러닝에 기반한 즉각적인 인사이트 또는 증강 기능을 제공할 수 있습니다.

Exporting YOLO11 Models to TensorFlow.js

You can expand model compatibility and deployment flexibility by converting YOLO11 models to TF.js.

설치

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

설치

# 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.js format
model.export(format="tfjs")  # creates '/yolo11n_web_model'

# Load the exported TF.js model
tfjs_model = YOLO("./yolo11n_web_model")

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

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

지원되는 내보내기 옵션에 대한 자세한 내용은 배포 옵션에 대한Ultralytics 문서 페이지를 참조하세요.

Deploying Exported YOLO11 TensorFlow.js Models

Now that you have exported your YOLO11 model to the TF.js format, the next step is to deploy it. The primary and recommended first step for running a TF.js is to use the YOLO("./yolo11n_web_model") method, as previously shown in the usage code snippet.

그러나 TF.js 모델 배포에 대한 자세한 지침은 다음 리소스를 참조하세요:

요약

In this guide, we learned how to export Ultralytics YOLO11 models to the TensorFlow.js format. By exporting to TF.js, you gain the flexibility to optimize, deploy, and scale your YOLO11 models on a wide range of platforms.

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

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

자주 묻는 질문

How do I export Ultralytics YOLO11 models to TensorFlow.js format?

Exporting Ultralytics YOLO11 models to TensorFlow.js (TF.js) format is straightforward. You can follow these steps:

사용법

from ultralytics import YOLO

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

# Export the model to TF.js format
model.export(format="tfjs")  # creates '/yolo11n_web_model'

# Load the exported TF.js model
tfjs_model = YOLO("./yolo11n_web_model")

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

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

지원되는 내보내기 옵션에 대한 자세한 내용은 배포 옵션에 대한Ultralytics 문서 페이지를 참조하세요.

Why should I export my YOLO11 models to TensorFlow.js?

Exporting YOLO11 models to TensorFlow.js offers several advantages, including:

  1. 로컬 실행: 모델을 브라우저 또는 Node.js에서 직접 실행하여 지연 시간을 줄이고 사용자 경험을 향상시킬 수 있습니다.
  2. 크로스 플랫폼 지원: TF.js는 여러 환경을 지원하므로 유연하게 배포할 수 있습니다.
  3. 오프라인 기능: 인터넷 연결 없이도 애플리케이션이 작동하도록 하여 안정성과 개인 정보 보호를 보장합니다.
  4. GPU 가속: GPU 가속을 위해 WebGL을 활용하여 리소스가 제한된 디바이스에서 성능을 최적화합니다.

종합적인 개요는 TensorFlow.js와의 통합을 참조하세요.

TensorFlow.js는 브라우저 기반 머신 러닝 애플리케이션에 어떤 이점이 있나요?

TensorFlow.js는 브라우저와 Node.js 환경에서 ML 모델을 효율적으로 실행하기 위해 특별히 설계되었습니다. 브라우저 기반 애플리케이션에 이점을 제공하는 방법은 다음과 같습니다:

  • 지연 시간 단축: 머신 러닝 모델을 로컬에서 실행하여 서버 측 계산에 의존하지 않고 즉각적인 결과를 제공합니다.
  • 개인정보 보호 향상: 사용자의 디바이스에 민감한 데이터를 보관하여 보안 위험을 최소화합니다.
  • 오프라인 사용을 활성화합니다: 인터넷 연결 없이도 모델을 작동할 수 있어 일관된 기능을 보장합니다.
  • 여러 백엔드 지원: 다양한 계산 요구 사항에 맞게 CPU, WebGL, WebAssembly(WASM), WebGPU와 같은 백엔드로 유연성을 제공합니다.

TF.js에 대해 자세히 알아보고 싶으신가요? 공식 TensorFlow.js 가이드를 확인하세요.

What are the key features of TensorFlow.js for deploying YOLO11 models?

TensorFlow.js의 주요 기능은 다음과 같습니다:

  • 크로스 플랫폼 지원: TF.js는 웹 브라우저와 Node.js 모두에서 사용할 수 있으므로 광범위한 배포 유연성을 제공합니다.
  • 여러 백엔드: CPU , WebGL( GPU 가속용), WebAssembly(WASM), 고급 작업을 위한 WebGPU를 지원합니다.
  • 오프라인 기능: 인터넷 연결 없이 브라우저에서 직접 모델을 실행할 수 있어 반응형 웹 애플리케이션을 개발하는 데 이상적입니다.

배포 시나리오 및 자세한 내용은 배포 옵션 섹션( TensorFlow.js를 사용한 배포 옵션)을 참조하세요.

Can I deploy a YOLO11 model on server-side Node.js applications using TensorFlow.js?

Yes, TensorFlow.js allows the deployment of YOLO11 models on Node.js environments. This enables server-side machine learning applications that benefit from the processing power of a server and access to server-side data. Typical use cases include real-time data processing and machine learning pipelines on backend servers.

Node.js 배포를 시작하려면 TensorFlow 에서 Node.js에서 TensorFlow.js 실행하기 가이드를 참조하세요.

📅 Created 6 months ago ✏️ Updated 22 days ago

댓글