Quickstart-android: Waiting for the text recognition model to be downloaded. Please wait

Created on 13 Jan 2019  路  13Comments  路  Source: firebase/quickstart-android

problem

Text detection failed.com.google.firebase.ml.common.FirebaseMLException: Waiting for the text
recognition model to be downloaded. Please wait.

Steps to reproduce:

I just cloned your repo

Observed Results:

2019-01-13 15:45:53.429 32741-572/com.google.firebase.samples.apps.mlkit I/Vision: Loading library libocr.so
2019-01-13 15:45:53.429 32741-572/com.google.firebase.samples.apps.mlkit I/Vision: libocr.so library load status: false
2019-01-13 15:45:53.429 32741-572/com.google.firebase.samples.apps.mlkit W/TextNativeHandle: Native handle not yet available. Reverting to no-op handle.
2019-01-13 15:45:53.430 32741-572/com.google.firebase.samples.apps.mlkit W/DynamiteModule: Local module descriptor class for com.google.android.gms.vision.dynamite.text not found.
2019-01-13 15:45:53.435 32741-572/com.google.firebase.samples.apps.mlkit I/DynamiteModule: Considering local module com.google.android.gms.vision.dynamite.text:0 and remote module com.google.android.gms.vision.dynamite.text:0
2019-01-13 15:45:53.436 32741-572/com.google.firebase.samples.apps.mlkit W/DynamiteModule: Local module descriptor class for com.google.android.gms.vision.dynamite not found.
2019-01-13 15:45:53.440 32741-572/com.google.firebase.samples.apps.mlkit I/DynamiteModule: Considering local module com.google.android.gms.vision.dynamite:0 and remote module com.google.android.gms.vision.dynamite:1800
2019-01-13 15:45:53.440 32741-572/com.google.firebase.samples.apps.mlkit I/DynamiteModule: Selected remote version of com.google.android.gms.vision.dynamite, version >= 1800
2019-01-13 15:45:53.444 32741-572/com.google.firebase.samples.apps.mlkit I/Vision: Loading library libocr.so
2019-01-13 15:45:53.444 32741-572/com.google.firebase.samples.apps.mlkit I/Vision: libocr.so library load status: false
2019-01-13 15:45:53.448 32741-32741/com.google.firebase.samples.apps.mlkit W/TextRecProc: Text detection failed.com.google.firebase.ml.common.FirebaseMLException: Waiting for the text recognition model to be downloaded. Please wait.

mlkit

Most helpful comment

Add this dependency. It worked for me.
implementation 'com.google.firebase:firebase-ml-vision-barcode-model:16.0.2'

All 13 comments

@ayalma does the download ever complete or are you stuck waiting for the model indefinitely? Also is this specific to a certain device or network?

Yes , it's stuck in waiting.
I tested in my friend Lg device and problem exist.
And for network i tested it with wifi and mobile date and even i used vpn for that and still this problem exist .

This happens to me one time, I only w8 like 10 minutes because the device is downloading the model, and later work without problem

@samtstern I think that this issue also ties in with #586

@the-dagger I can confirm we're making some internal progress on #586, I've seen some good API proposals going around!

Awesome, thanks!

I also have this problem(any devices)
there is a solution?

implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-ml-vision:18.0.2'

take image and call method

   mCamera.takePicture(null, null, new Camera.PictureCallback() {
     @Override
       public void onPictureTaken(byte[] bytes, Camera camera) {
              Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
               ByteArrayOutputStream stream = new ByteArrayOutputStream();
               bitmap.compress(Bitmap.CompressFormat.JPEG, 1, stream);
               imageView.setImageBitmap(bitmap);
               fetch(bitmap);
     }
 });

 private void fetch(Bitmap bitmap) {
        final FirebaseVisionImage    firebaseVisionImage          = FirebaseVisionImage.fromBitmap(bitmap);
        FirebaseVisionTextRecognizer firebaseVisionTextRecognizer = FirebaseVision.getInstance().getOnDeviceTextRecognizer();

        firebaseVisionTextRecognizer.processImage(firebaseVisionImage)
                .addOnSuccessListener(new OnSuccessListener<FirebaseVisionText>() {
                    @Override
                    public void onSuccess(FirebaseVisionText firebaseVisionText) {
                        btn.setEnabled(true);
                        Log.i(TAG, "onFailure: " + firebaseVisionText.getText());

                    }
                }).addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception e) {
                btn.setEnabled(true);
                e.printStackTrace();
                Log.i(TAG, "onFailure: " + e.getMessage());
            }
        });
    }

_error message_ : Waiting for the text recognition model to be downloaded. Please wait.

There doesn't seem to be evidence here that anything is broken, models can sometimes take a long time to download on a slower or spottier connection. Let's close this and I will update on when we have a better API for these downloads in #586.

This pops up for me after trying on-device OCR on Android 11 DP 1.

On previous versions, everything worked fine (the models are also mentioned in the manifest to be downloaded via com.google.firebase.ml.vision.DEPENDENCIES).

But it seems that even with FirebaseModelManager I cannot check the status of on-device models (see firebase/firebase-android-sdk#47)?!

Is this a known problem with Android 11?

Add this dependency. It worked for me.
implementation 'com.google.firebase:firebase-ml-vision-barcode-model:16.0.2'

This might be a workaround. But the auto-download will be fixed, right?

@shubh261096 which dependency do I need for OCR?

Do you have a workaround? @samtstern samtstern

I am having the same issue. Can anyone please help me?

Was this page helpful?
0 / 5 - 0 ratings