Google Play 服務中的 TensorFlow Lite

Google Play 服務執行階段中的 TensorFlow Lite 適用於所有執行目前 Play 服務版本的 Android 裝置。這個執行階段可讓您執行機器學習 (ML) 模型,而無需將 TensorFlow Lite 程式庫靜態套裝到應用程式中。

透過 Google Play 服務 API,您可以縮減應用程式的大小,並從最新穩定版的程式庫獲得更佳效能。在 Google Play 服務中使用 TensorFlow Lite 是在 Android 上使用 TensorFlow Lite 的建議方式。

您可以透過快速入門開始使用 Play 服務執行階段,其中提供逐步指南,說明如何實作範例應用程式。如果您已在應用程式中使用獨立 TensorFlow Lite,請參閱「從獨立 TensorFlow Lite 遷移」一節,瞭解如何更新現有的應用程式以使用 Play 服務執行階段。如要進一步瞭解 Google Play 服務,請參閱 Google Play 服務網站。

使用 Play 服務執行階段

Google Play 服務中的 TensorFlow Lite 可透過下列程式設計語言 API 取得

限制

Google Play 服務中的 TensorFlow Lite 具有下列限制

  • 硬體加速委派的支援僅限於「硬體加速」一節中列出的委派。不支援其他加速委派。
  • 不支援實驗性或已淘汰的 TensorFlow Lite API (包括自訂運算子)。

支援與意見回饋

您可以透過 TensorFlow 問題追蹤器提供意見回饋並取得支援。請使用 Google Play 服務中 TensorFlow Lite 的問題範本,回報問題和提交支援要求。

服務條款

使用 Google Play 服務 API 中的 TensorFlow Lite 須遵守Google API 服務條款

隱私權與資料收集

當您使用 Google Play 服務 API 中的 TensorFlow Lite 時,輸入資料 (例如圖片、影片、文字) 的處理完全在裝置端進行,而且 Google Play 服務 API 中的 TensorFlow Lite 不會將該資料傳送至 Google 伺服器。因此,您可以將我們的 API 用於處理不應離開裝置的資料。

Google Play 服務 API 中的 TensorFlow Lite 可能會不時與 Google 伺服器聯絡,以便接收錯誤修正、更新的模型和硬體加速器相容性資訊等內容。Google Play 服務 API 中的 TensorFlow Lite 也會將應用程式中 API 的效能和使用率指標傳送給 Google。Google 會使用這些指標資料來評估效能、偵錯、維護及改善 API,並偵測濫用或誤用情形,詳情請參閱我們的《隱私權政策》

您有責任依照適用法律的規定,告知應用程式使用者 Google 對 Google Play 服務 API 指標資料中 TensorFlow Lite 的處理方式。

我們收集的資料包括下列項目

  • 裝置資訊 (例如製造商、型號、作業系統版本和組建) 和可用的 ML 硬體加速器 (GPU 和 DSP)。用於診斷和使用情況分析。
  • 用於診斷和使用情況分析的裝置識別碼。
  • 應用程式資訊 (套件名稱、應用程式版本)。用於診斷和使用情況分析。
  • API 設定 (例如正在使用的委派)。用於診斷和使用情況分析。
  • 事件類型 (例如 Interpreter 建立、推論)。用於診斷和使用情況分析。
  • 錯誤代碼。用於診斷。
  • 效能指標。用於診斷。

後續步驟

如要進一步瞭解如何使用 TensorFlow Lite 在行動應用程式中實作機器學習,請參閱《TensorFlow Lite 開發人員指南》。您可以在 TensorFlow Hub 上找到適用於圖片分類、物件偵測和其他應用程式的其他 TensorFlow Lite 模型。