-
Notifications
You must be signed in to change notification settings - Fork 3k
InputImage from "fromMediaImage" method will lead Internal error after feed into FaceDetector while "fromBitmap" work as expected #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@rideflag-yankai-tian it would be helpful if you could provide a Minimum Complete Verifiable Example Code so that we can see how you're using |
Hi, could you provide some code snippets that show where you call image.close()? It is likely that you close the image too soon before mlkit is done with processing it. |
Hey @rideflag-yankai-tian, have you gotten a chance to follow up on this yet? This seems like a problem around when |
Hey @rideflag-yankai-tian , this issue hasn't had any activity for a month, so we'll consider it resolved for now! Feel free to reopen this issue if you are still able to reproduce it |
Hey @calren, I had the same problem. And below is some code snippets. |
Hi, the image is used for processing in the ML pipeline. You should close it in the detector's onComplete() listener instead to make sure the pipeline does not need it anymore. |
Platform: Android
Error occurs when feed InputImage from Camera2 by using InputImage.fromMediaImage() into FaceDetector.
com.google.mlkit.common.MlKitException: Internal error has occurred when executing ML Kit tasks at com.google.mlkit.common.sdkinternal.ModelResource.zza(com.google.mlkit:common@@16.0.0:28) at com.google.mlkit.common.sdkinternal.zzn.call(Unknown Source:6) at com.google.mlkit.common.sdkinternal.zzm.run(com.google.mlkit:common@@16.0.0:5) at com.google.mlkit.common.sdkinternal.zzq.run(com.google.mlkit:common@@16.0.0:3) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at com.google.android.gms.internal.mlkit_common.zzb.dispatchMessage(com.google.mlkit:common@@16.0.0:6) at android.os.Looper.loop(Looper.java:359) at android.os.HandlerThread.run(HandlerThread.java:67) Caused by: java.lang.IllegalStateException: Image is already closed at android.media.Image.throwISEIfImageIsInvalid(Image.java:72) at android.media.ImageReader$SurfaceImage$SurfacePlane.getBuffer(ImageReader.java:965) at com.google.android.gms.vision.Frame$Builder.setPlanes(com.google.android.gms:play-services-vision-common@@19.1.0:14) at com.google.mlkit.vision.face.internal.zza.zza(com.google.android.gms:play-services-mlkit-face-detection@@16.0.0:56) at com.google.mlkit.vision.face.internal.zza.zza(com.google.android.gms:play-services-mlkit-face-detection@@16.0.0:85) at com.google.mlkit.vision.face.internal.zza.run(com.google.android.gms:play-services-mlkit-face-detection@@16.0.0:164) at com.google.mlkit.vision.common.internal.MobileVisionBase.zza(com.google.mlkit:vision-common@@16.0.0:23) at com.google.mlkit.vision.common.internal.zzb.call(Unknown Source:4) at com.google.mlkit.common.sdkinternal.ModelResource.zza(com.google.mlkit:common@@16.0.0:26) at com.google.mlkit.common.sdkinternal.zzn.call(Unknown Source:6) at com.google.mlkit.common.sdkinternal.zzm.run(com.google.mlkit:common@@16.0.0:5) at com.google.mlkit.common.sdkinternal.zzq.run(com.google.mlkit:common@@16.0.0:3) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at com.google.android.gms.internal.mlkit_common.zzb.dispatchMessage(com.google.mlkit:common@@16.0.0:6) at android.os.Looper.loop(Looper.java:359) at android.os.HandlerThread.run(HandlerThread.java:67)
In contrast, If convert preview frame to bitmap then create InputImage by using fromBitmap, everything works fine.
The text was updated successfully, but these errors were encountered: