[Feature Request] ML Kit: On-Device Model Download API
See original GitHub issueI’d like to request an API to query the download status for MLKit’s on-device models. Ideally, this API would allow the following:
- return the current status of the on-device model for a given “kit” (e.g., barcode, face, etc.). Potential responses could be
UNAVAILABLE
,AVAILABLE
,DOWNLOADING
, etc. - initiate a download for a specified “kit” and ideally allow an observer to be attached to monitor completion (e.g.,
Task<Void
) - (optional) delete a downloaded model
Here’s the current documentation with regards to on-device models:
Optional but recommended: Configure your app to automatically download the ML model to the device after your app is installed from the Play Store. To do so, add the following declaration to your app’s AndroidManifest.xml file:
<application ...> ... <meta-data android:name="com.google.firebase.ml.vision.DEPENDENCIES" android:value="barcode" /> <!-- To use multiple models: android:value="barcode,model2,model3" --> </application>
If you do not enable install-time model downloads, the model will be downloaded the first time you run the detector. Requests you make before the download has completed will produce no results.
(from https://firebase.google.com/docs/ml-kit/android/read-barcodes, emphasis mine)
I think it’s crucial to have APIs to monitor the state of the on-device models, especially since the system makes no guarantees about when the “runtime” download will start/finish.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:18
- Comments:15 (5 by maintainers)
We need an offline model bundled with the app for users with no network access.
Another reason to have an embedded model is because some users download apps from different app stores (e.g. HiMarket, Samsung, Tencent, etc.) and in most cases don’t have the Google Play Services installed. So I’d like to reinforce the necessity to have an embedded model (it may be a lightweight version, just to have the feature working properly) to avoid this kind of issues.