遷移指南
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
2020 年 6 月 3 日,我們針對 Firebase 適用的 ML Kit 做出了部分調整,以便提高裝置端 API 與雲端式 API 的區別。目前的 API 組合現已分成下列兩項產品:
這項變更也能讓您在只需要裝置端解決方案時,更輕鬆地整合 ML Kit 與應用程式。本文說明如何將應用程式從 Firebase ML Kit SDK 遷移至新的 ML Kit SDK。
異動內容
裝置端基礎 API
下列 API 已移至新的獨立 ML Kit SDK。
- 條碼掃描
- 臉部偵測
- 圖片標籤
- 物件偵測和追蹤
- 文字辨識
- 語言 ID
- 智慧回覆
- 翻譯
- AutoML Vision Edge 推論 API
ML Kit for Firebase SDK 中現有的裝置端基礎 API 已淘汰,因此不會再收到更新。
如果您目前在應用程式中使用這些 API,請按照 Android 的 ML Kit 遷移指南和 iOS 適用的 ML Kit 遷移指南進行遷移。
自訂模型 API
如要下載 Firebase 託管的模型,系統會繼續透過 Firebase ML SDK 提供自訂模型下載工具。SDK 會擷取最新可用的模型,並傳遞至個別的 TensorFlow Lite 執行階段進行推論。
ML Kit for Firebase SDK 中現有的自訂模型解譯器已淘汰,因此不會再收到更新。建議您直接使用 TensorFlow Lite 執行階段進行推論。或者,如果您只想使用自訂模型處理圖片標籤、物件偵測及追蹤 API,您現在可以直接在 ML Kit 的這些 API 中使用自訂模型。
如需詳細操作說明,請參閱 Android 和 iOS 版遷移指南。
維持不變的內容
我們會繼續透過 Firebase ML 提供雲端式 API 和服務:
常見問題
為什麼要實施這項異動?
我們做出這項異動是為了釐清產品提供的解決方案。
進行這項變更後,新的 ML Kit SDK 會完全聚焦在裝置端的機器學習中,所有資料處理都在裝置上進行,開發人員可免費使用。原先屬於 Firebase ML Kit 的雲端服務仍可透過 Firebase ML 提供,而您仍然可以搭配 ML Kit API 使用這些服務。
針對裝置端 API,新的 ML Kit SDK 可讓開發人員更輕鬆地將 ML Kit 整合至應用程式。日後只需在應用程式的專案中加入依附元件,然後開始使用 API 即可。您不需要設定只使用裝置端 API 的 Firebase 專案。
由 Firebase 代管的模型會受到什麼影響?
Firebase 機器學習會繼續照常提供模型。這項功能並未改變。以下提供幾個改善項目:
遷移至新的 ML Kit SDK 可帶來哪些好處?
遷移至新的 SDK 可確保應用程式享有裝置端 API 的最新錯誤修正和改善項目。舉例來說,以下是第一個版本中的變更內容:
如需最新異動的完整清單,請參閱 ML Kit SDK 版本資訊。
我今天正在使用 Firebase 的 ML Kit,需要何時進行遷移?
(這取決於您目前在應用程式中使用何種 Firebase API 專用 ML Kit)。
Firebase SDK for Firebase SDK 中的裝置端基礎 API 會繼續運作,預計的未來也將繼續運作。但是,如果延後切換至新的 ML Kit SDK,您就無法享有新功能和更新帶來的好處。此外,一旦更新應用程式中的其他元件,可能會發生依附元件衝突的風險。當您的某些其他依附元件 (直接或間接) 比舊版 ML Kit for Firebase SDK 預期的依附元件還新時,就可能會發生這種情況。以下列舉一些可能發生此問題的程式庫:OkHttp 和 firebase-common。
如果您是透過 Firebase SDK for Firebase SDK 使用 Cloud API,目前不需要做任何變更。
如果您使用的是自訂模型部署,建議升級至最新版本,這樣就能直接在 TensorFlow Lite 執行階段中執行推論。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003eML Kit is now split into two products: ML Kit (on-device APIs) and Firebase Machine Learning (cloud-based APIs and custom model deployment).\u003c/p\u003e\n"],["\u003cp\u003eOn-device APIs like barcode scanning and text recognition have moved to the standalone ML Kit SDK; existing on-device APIs in Firebase ML Kit are deprecated.\u003c/p\u003e\n"],["\u003cp\u003eCloud-based APIs, such as image labeling and text recognition, remain available through Firebase ML.\u003c/p\u003e\n"],["\u003cp\u003eMigrating to the new ML Kit SDK ensures access to the latest features, bug fixes, and improvements, including custom models and lifecycle support.\u003c/p\u003e\n"],["\u003cp\u003eWhile on-device APIs in Firebase ML Kit will continue to function, developers are encouraged to migrate to the new ML Kit SDK to benefit from ongoing updates and avoid potential dependency conflicts.\u003c/p\u003e\n"]]],[],null,["# Migration guide\n\nOn June 3, 2020, we made some changes to ML Kit for Firebase to better distinguish the\non-device APIs from cloud based APIs. The current set of APIs is now split into\nthe following two products:\n\n- A new product, simply called [**ML Kit**](/ml-kit/guides), which will contain all the on-device APIs\n\n- [**Firebase Machine Learning**](https://firebase.google.com/docs/ml), focused on cloud-based APIs and custom model\n deployment.\n\nThis change will also make it easier to integrate ML Kit into your app if you only\nneed an on-device solution. This document explains how to migrate your app from the\nFirebase ML Kit SDK to the new ML Kit SDK.\n\nWhat's changing?\n----------------\n\n### On-device base APIs\n\nThe following APIs have moved to the new standalone ML Kit SDK.\n\n- Barcode scanning\n- Face detection\n- Image labeling\n- Object detection and tracking\n- Text recognition\n- Language ID\n- Smart reply\n- Translate\n- AutoML Vision Edge inference API\n\nThe existing on-device base APIs in the ML Kit for Firebase SDK are\ndeprecated and will no longer receive updates.\n\nIf you are using these APIs in\nyour app today, please migrate to the new ML Kit SDK, by following the\n**[ML Kit migration guide for Android](/ml-kit/migration/android)** and the\n**[ML Kit migration guide for iOS](/ml-kit/migration/ios)**.\n\n### Custom model APIs\n\nFor downloading models hosted in Firebase, the custom model downloader continues\nto be offered through the Firebase ML SDK. The SDK fetches the latest available\nmodel and passes it to the separate TensorFlow Lite runtime for inference.\n\nThe existing custom model interpreter in the ML Kit for Firebase SDK is deprecated\nand will no longer receive updates. We recommend using the TensorFlow Lite runtime\ndirectly for inference. Alternatively, if you only want to use custom models for\nimage labeling and object detection and tracking APIs, you can now use\n[custom models](/ml-kit/custom-models) in these APIs in ML Kit directly.\n\nSee the migration guides for\n[Android](https://firebase.google.com/docs/ml/android/migrate-from-legacy-api/)\nand [iOS](https://firebase.google.com/docs/ml/ios/migrate-from-legacy-api/)\nfor detailed instructions.\n\nWhat hasn't changed?\n--------------------\n\nCloud-based APIs and services will continue to be offered with Firebase ML:\n\n- The cloud-based image labeling, text recognition, and landmark recognition APIs\n are still available from the Firebase ML SDK.\n\n- Firebase ML also continues to offer [Model deployment](https://firebase.google.com/docs/ml/use-custom-models)\n\nFrequently asked questions\n--------------------------\n\n### Why this change?\n\nWe are making this change to clarify what solutions the product is offering.\nWith this change, the new ML Kit SDK is fully focused on on-device machine\nlearning where all data processing happens on-device and is available to\ndevelopers at no cost. The cloud services that were part of Firebase ML Kit\nbefore remain available through Firebase ML and you can still use these in\nparallel with ML Kit APIs.\n\nFor on-device APIs, the new ML Kit SDK makes it easier for developers to\nintegrate ML Kit into their app. Going forward, you just need to add\ndependencies to the app's project and then start using the API. There is no need\nto set up a Firebase project just to use on-device APIs.\n\n### What happens to my models that are being hosted with Firebase?\n\nFirebase Machine Learning will continue to serve your models as before. That\nfunctionality isn't changing. Here are a couple of improvements:\n\n- You can now deploy your models to Firebase programmatically using the\n [Python or Node SDKs](https://firebase.google.com/docs/ml/manage-hosted-models#manage_models_with_the_firebase_admin_sdk).\n\n- You can now use the Firebase ML SDK in conjunction with the TensorFlow\n Lite runtime. The Firebase SDK downloads the model to the device, and the TensorFlow\n Lite runtime performs the inference. This allows you to easily choose the\n runtime version you prefer, including a custom build.\n\n### What benefits do I get from migrating to the new ML Kit SDK?\n\nMigrating to the new SDK will ensure your applications benefit from the latest\nbug fixes and improvements to the on-device APIs. For example, here are a\ncouple of changes in the first release:\n\n- You can now use the new\n [custom image labeling](/ml-kit/vision/image-labeling#custom-tflite) and\n [custom object detection and tracking](/ml-kit/vision/object-detection#custom-tflite)\n APIs to easily integrate custom image classification models in your apps\n and build real-time interactive user experiences.\n\n- [Android Jetpack Lifecycle](https://developer.android.com/reference/androidx/lifecycle/Lifecycle)\n support is added to all APIs. You can now use `addObserver` to automatically\n manage the initiation and teardown of ML Kit APIs as the app goes through screen\n rotation or closure by the user / system. This makes integration with CameraX\n easier.\n\nA full list of the latest changes can be found in the [ML Kit SDK release\nnotes](/ml-kit/release-notes).\n\n### I am using ML Kit for Firebase today, when do I need to migrate over?\n\nThis depends on which ML Kit for Firebase APIs you currently use in your app.\n\n- The **on-device base APIs** in the ML Kit for Firebase SDK will continue to work for\n the foreseeable future. However, by delaying the switch to the new ML Kit SDK,\n you will not benefit from new features and updates. In addition, once you update\n other components in your app there is a risk you may\n run into dependencies conflicts. This can happen when some of your other dependencies (direct or indirect) are\n newer than the ones expected by the old ML Kit for Firebase SDK. Examples of\n libraries for which this may happen are OkHttp and firebase-common.\n\n- If you are using **Cloud APIs** via the ML Kit for Firebase SDK, no change is\n required at this time.\n\n- If you are using **Custom Model Deployment**, we recommend you upgrade to the latest\n version which allows running inferences directly on the TensorFlow Lite runtime."]]