Android पर ML किट मॉडल को इंस्टॉल करने के पाथ
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
एमएल किट की सभी सुविधाएं, डिफ़ॉल्ट रूप से Google से ट्रेन किए गए मशीन लर्निंग मॉडल (जिन्हें बेस मॉडल कहा जाता है) का इस्तेमाल करती हैं. यह गाइड, सिर्फ़ बुनियादी मॉडल पर लागू होती है. कस्टम मॉडल के बारे में जानकारी पाने के लिए, यहां देखें.
ML Kit API में मौजूद मॉडल को तीन तरीकों से इंस्टॉल किया जा सकता है:
- अनबंडल्ड: मॉडल, Google Play Services के ज़रिए डाउनलोड और मैनेज किए जाते हैं.
- बंडल किए गए: मॉडल, बिल्ड टाइम पर आपके ऐप्लिकेशन से स्टैटिक तौर पर लिंक होते हैं.
- डाइनैमिक रूप से डाउनलोड किए गए मॉडल: मॉडल को मांग पर डाउनलोड किया जाता है.
हर एपीआई के लिए, इंस्टॉल करने के पाथ
नीचे दी गई टेबल में दिखाया गया है कि ML Kit की हर सुविधा के साथ, मॉडल इंस्टॉलेशन के किन पाथ का इस्तेमाल किया जा सकता है:
एपीआई के हिसाब से गाइड में यह बताया जाता है कि दिए गए एपीआई के लिए, इंस्टॉलेशन के कौनसे विकल्प उपलब्ध हैं.
इंस्टॉल करने के विकल्पों के बीच मुख्य अंतर
|
अनबंडल्ड
|
बंडल किया गया
|
डाइनैमिक तरीके से डाउनलोड किया गया
|
मॉडल कहां सेव किए जाते हैं?
|
यह Google Play Services में मौजूद होता है और इसे इस ऐप्लिकेशन के लिए इस्तेमाल की गई स्टोरेज में नहीं गिना जाता
|
इंस्टॉल होने के बाद, ऐप्लिकेशन के लिए खास तौर पर बनाए गए स्टोरेज में सेव किया जाता है
|
मॉडल डाउनलोड होने के बाद, ऐप्लिकेशन के लिए खास तौर पर बने स्टोरेज में सेव किया जाता है
|
मॉडल के साइज़ का ऐप्लिकेशन के साइज़ पर क्या असर पड़ता है?
|
इससे ऐप्लिकेशन के साइज़ पर कोई असर नहीं पड़ता
|
इससे ऐप्लिकेशन का साइज़ सीधे तौर पर बढ़ता है
|
इससे ऐप्लिकेशन के साइज़ पर कोई असर नहीं पड़ता, लेकिन ऐप्लिकेशन के लिए खास तौर पर बने स्टोरेज का साइज़ बढ़ जाता है
|
मॉडल कब अपडेट किए जाते हैं?
|
नया वर्शन रिलीज़ होने पर अपने-आप अपडेट हो जाता है
|
मॉडल को अपडेट करने के लिए, ऐप्लिकेशन को अपडेट करना ज़रूरी है
|
मॉडल को अपडेट करने के लिए, ऐप्लिकेशन को अपडेट करना ज़रूरी है
|
मॉडल कब डाउनलोड किए जाते हैं?
|
इस्तेमाल करने से पहले मॉडल डाउनलोड करना ज़रूरी है
|
ऐप्लिकेशन इंस्टॉल करने पर, सभी मॉडल और सुविधाएँ शामिल होती हैं. इसलिए, इनका इस्तेमाल तुरंत किया जा सकता है
|
मॉडल डाउनलोड करने, अपडेट करने, और मिटाने के लिए, RemoteModelManager API का इस्तेमाल करके, मैन्युअल तरीके से मैनेज करना होगा
|
डिवाइस से मॉडल कब हटाए जाते हैं?
|
Google Play Services, मॉडल को सिर्फ़ तब स्टोरेज से हटाएगी, जब मॉडल पर निर्भर सभी ऐप्लिकेशन अनइंस्टॉल कर दिए गए हों
|
ऐप्लिकेशन अनइंस्टॉल करने पर, मॉडल ऐप्लिकेशन के हिसाब से तय की गई स्टोरेज लोकेशन से हटा दिए जाते हैं
|
ऐप्लिकेशन अनइंस्टॉल करने पर, डाउनलोड किए गए मॉडल ऐप्लिकेशन के हिसाब से तय की गई स्टोरेज लोकेशन से हटा दिए जाते हैं
|
बंडल किए गए और बंडल नहीं किए गए ऑफ़र में से किसी एक को चुनने का तरीका
अगर कोई एपीआई, बंडल किए गए और बंडल नहीं किए गए, दोनों तरह के इंस्टॉलेशन के विकल्पों के साथ काम करता है, तो:
अगर आपको इन चीज़ों को प्राथमिकता देनी है, तो बंडल किए गए प्रॉडक्ट का विकल्प इस्तेमाल करें:
- ऐप्लिकेशन इंस्टॉल करने के तुरंत बाद, सुविधा की पूरी फ़ंक्शनैलिटी का इस्तेमाल करना
- ऐप्लिकेशन इंस्टॉल करने के बाद, नेटवर्क कनेक्शन के बिना सुविधा का इस्तेमाल करना
अगर आपको इन बातों को प्राथमिकता देनी है, तो अनबंडल्ड विकल्प का इस्तेमाल करें:
- ऐप्लिकेशन का साइज़ कम होना
- Google Play services की मदद से मॉडल अपने-आप अपडेट होना
मॉडल डाउनलोड करने का तरीका
अनबंडल्ड मॉडल के विकल्प का इस्तेमाल करते समय, यह तय किया जा सकता है कि डिवाइस पर मॉडल कैसे डाउनलोड किए जाएं:
अपने ऐप्लिकेशन की AndroidManifest.xml
फ़ाइल में एलान जोड़कर, ऐप्लिकेशन इंस्टॉल करते समय मॉडल डाउनलोड करने की सुविधा चालू की जा सकती है. उदाहरण के लिए, यहां दिए गए कोड स्निपेट में बताया गया है कि Play Store से ऐप्लिकेशन इंस्टॉल होने के बाद, बारकोड स्कैनिंग मॉडल को अपने-आप डाउनलोड होने के लिए कैसे कॉन्फ़िगर करें:
<application ...>
...
<meta-data
android:name="com.google.mlkit.vision.DEPENDENCIES"
android:value="barcode" >
<!-- To use multiple models: android:value="barcode,model2,model3" -->
</application>
Google Play Services के ModuleInstallClient API के ज़रिए, डाउनलोड करने का अनुरोध किया जा सकता है.
अगर आपने इंस्टॉल के समय मॉडल डाउनलोड करने की सुविधा चालू नहीं की है या आपने मॉडल को साफ़ तौर पर डाउनलोड करने का अनुरोध नहीं किया है, तो मॉडल को पहली बार सुविधा चलाने पर डाउनलोड किया जाएगा.
डाउनलोड पूरा होने तक, अनुमान लगाने के अनुरोध पूरे नहीं किए जा सकेंगे.
मॉडल अपडेट करने का तरीका
बंडल किए गए मॉडल या डाइनैमिक तौर पर डाउनलोड किए गए मॉडल का इस्तेमाल करते समय, अपने मॉडल अपडेट करने के लिए:
ML Kit की नई सुविधा वाले क्लाइंट लाइब्रेरी का इस्तेमाल करने के लिए, अपने ऐप्लिकेशन की gradle फ़ाइल अपडेट करें.
dependencies {
implementation 'com.google.mlkit:barcode-scanning: 17.3.0' // The latest version number of the API
}
अपने ऐप्लिकेशन को फिर से बनाएं.
कुछ एपीआई, डाइनैमिक तौर पर डाउनलोड किए गए मॉडल क्यों उपलब्ध कराते हैं
कुछ ML Kit API में बंडल करने के लिए बहुत ज़्यादा मॉडल विकल्प होते हैं. उदाहरण के लिए, डिजिटल इंक को पहचानने की सुविधा 300 से ज़्यादा भाषाओं के साथ काम करती है. साथ ही, इंस्टॉल करने के दौरान हर भाषा को इस सुविधा में शामिल करना हमेशा ज़रूरी नहीं होता.
इसके लिए, हम तीसरा इंस्टॉलेशन विकल्प उपलब्ध कराते हैं. इसमें मॉडल, इंस्टॉलेशन के बाद मांग पर डाउनलोड किए जाते हैं. फ़िलहाल, यह विकल्प सिर्फ़ डिजिटल इंक को पहचानने,
अनुवाद करने, और इकाई की जानकारी निकालने की सुविधा के लिए उपलब्ध है.
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-09-03 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-09-03 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eML Kit features utilize Google-trained machine learning models, offering three installation options: unbundled, bundled, and dynamically downloaded.\u003c/p\u003e\n"],["\u003cp\u003eUnbundled models are downloaded via Google Play Services, while bundled models are included in the app, and dynamically downloaded models are fetched on demand.\u003c/p\u003e\n"],["\u003cp\u003eChoosing between bundled and unbundled models depends on priorities: bundled for immediate functionality, unbundled for smaller app size and automatic updates.\u003c/p\u003e\n"],["\u003cp\u003eModels can be downloaded at install time, explicitly requested, or downloaded on first use, and updates for bundled or dynamically downloaded models require app updates.\u003c/p\u003e\n"],["\u003cp\u003eDynamically downloaded models are offered for APIs with extensive model options, such as Digital Ink Recognition and Translation, to avoid bundling all possibilities.\u003c/p\u003e\n"]]],[],null,["All ML Kit features make use of Google-trained machine learning models (known as\nbase models) by default. This guide is only applicable to base models. [See here\nfor guidance on custom models.](/ml-kit/custom-models)\n\nModels in ML Kit APIs can be installed in one of three ways:\n\n1. **Unbundled:** Models are downloaded and managed via Google Play Services.\n2. **Bundled:** Models are statically linked to your app at build time.\n3. **Dynamically downloaded:** Models are downloaded on demand.\n\nSupported installation paths for each API\n\nThe table below shows which model installation paths are supported by each ML\nKit feature:\n\n|---------------------------------------------------------------------------|---------------|-------------|----------------------------|\n| | **Unbundled** | **Bundled** | **Dynamically downloaded** |\n| [Text recognition v2](/ml-kit/vision/text-recognition/v2/android) | ✅ | ✅ | |\n| [Face detection](/ml-kit/vision/face-detection/android) | ✅ | ✅ | |\n| [Face mesh detection](/ml-kit/vision/face-mesh-detection/android) | | ✅ | |\n| [Pose detection](/ml-kit/vision/pose-detection/android) | | ✅ | |\n| [Selfie segmentation](/ml-kit/vision/selfie-segmentation/android) | | ✅ | |\n| [Barcode scanning](/ml-kit/vision/barcode-scanning/android) | ✅ | ✅ | |\n| [Image labeling](/ml-kit/vision/image-labeling/android) | ✅ | ✅ | |\n| [Object detection and tracking](/ml-kit/vision/object-detection/android) | | ✅ | |\n| [Digital ink recognition](/ml-kit/vision/digital-ink-recognition/android) | | | ✅ |\n| [Document scanner](/ml-kit/vision/doc-scanner) | ✅ | | |\n| [Subject segmentation](/ml-kit/vision/subject-segmentation/android) | ✅ | | |\n| [Google code scanner](/ml-kit/code-scanner) | ✅ | | |\n| [Language identification](/ml-kit/language/identification/android) | ✅ | ✅ | |\n| [Translation](/ml-kit/language/translation/android) | | | ✅ |\n| [Smart Reply](/ml-kit/language/smart-reply/android) | ✅ | ✅ | |\n| [Entity Extraction](/ml-kit/language/entity-extraction/android) | | | ✅ |\n\nAPI-specific guides show which installation options are available for the given\nAPI.\n\nKey differences between installation options\n\n|----------------------------------------------|-------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | **Unbundled** | **Bundled** | **Dynamically downloaded** |\n| **Where are models stored?** | Resides in Google Play Services and is not counted towards the storage used by this app | Saved in [app-specific storage](https://developer.android.com/training/data-storage/app-specific) after installation | Saved in [app-specific storage](https://developer.android.com/training/data-storage/app-specific) after model download |\n| **How does model size affect app size?** | Does not contribute to app size | Directly contributes to app size | Does not contribute to app size but increase the [app-specific storage](https://developer.android.com/training/data-storage/app-specific) |\n| **When are models updated?** | Automatically updated when a newer version is released | [Need to update the app to update model](#update-model) | [Need to update the app to update model](#update-model) |\n| **When are models downloaded?** | [Models must be downloaded before use](#download-models) | All models and features are included when the app is installed, so are usable immediately | Model downloads, updates, and deletions must be managed manually using the [RemoteModelManager](/android/reference/com/google/mlkit/common/model/RemoteModelManager) API |\n| **When are models removed from the device?** | Google Play Services will only remove the model from storage if all apps that depend on the model are uninstalled | Models are removed from [app-specific storage](https://developer.android.com/training/data-storage/app-specific) when the app is uninstalled | Downloaded models are removed from [app-specific storage](https://developer.android.com/training/data-storage/app-specific) when the app is uninstalled |\n\nHow to choose between bundled and unbundled\n\nIf an API supports both the bundled and unbundled installation options:\n\n- Use the bundled option if you prioritize:\n\n - Complete feature functionality immediately after app installation\n - Feature functionality without network connection after app installation\n- Use the unbundled option if you prioritize:\n\n - Smaller app size\n - Automated model updates by Google Play Services\n\nHow to download models\n\nWhen using the unbundled model option, you can specify how you want models to be\ndownloaded to the device:\n\n- You can enable **install-time model downloads** by adding a declaration to\n your app's `AndroidManifest.xml` file. For example, the code snippet below\n shows how to configure your app to automatically download the Barcode\n Scanning model after your app is installed from the Play Store:\n\n \u003capplication ...\u003e\n ...\n \u003cmeta-data\n android:name=\"com.google.mlkit.vision.DEPENDENCIES\"\n android:value=\"barcode\" \u003e\n \u003c!-- To use multiple models: android:value=\"barcode,model2,model3\" --\u003e\n \u003c/application\u003e\n\n- You can **request explicit download** through Google Play Services\n [ModuleInstallClient API](/android/guides/module-install-apis).\n\n- If you don't enable install-time model downloads or request explicit\n download, the model will be downloaded the first time you run the feature.\n Until the download is completed, inference requests will fail.\n\nHow to update models\n\nTo update your models when using the bundled model or the dynamically downloaded\nmodels option:\n\n1. Update your app's gradle file to use the latest ML Kit feature client\n library.\n\n dependencies {\n implementation 'com.google.mlkit:barcode-scanning: 17.3.0' // The latest version number of the API\n }\n\n2. Rebuild your app.\n\nWhy some APIs offer dynamically downloaded models\n\nSome ML Kit API have too many model options to bundle. For example, [Digital ink\nrecognition](/ml-kit/vision/digital-ink-recognition) supports [300+\nlanguages](/ml-kit/vision/digital-ink-recognition/base-models), and it's not\nalways necessary to put every language inside the feature during installation.\nFor that purpose, we provide the third installation option, in which models are\ndownloaded on demand after installation. Currently, only [Digital ink\nrecognition](/ml-kit/vision/digital-ink-recognition),\n[Translation](/ml-kit/language/translation) and [Entity\nextraction](/ml-kit/language/entity-extraction) have this option."]]