Skip to content
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

TfLiteGpuDelegate Invoke: GpuDelegate must run on the same thread #31

Closed
AhmedKaram2 opened this issue Nov 22, 2022 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@AhmedKaram2
Copy link

FATAL EXCEPTION: main
Process: com.ml.quaterion.facenetdetection, PID: 11467
java.lang.IllegalArgumentException: Internal error: Failed to run on the given Interpreter: Can not open OpenCL library on this device - dlopen failed: library "libOpenCL.so" not found
Falling back to OpenGL
TfLiteGpuDelegate Invoke: GpuDelegate must run on the same thread where it was initialized.
Node number 181 (TfLiteGpuDelegateV2) failed to invoke.
at org.tensorflow.lite.NativeInterpreterWrapper.run(Native Method)
at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:249)
at org.tensorflow.lite.InterpreterImpl.runForMultipleInputsOutputs(InterpreterImpl.java:133)
at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:80)
at org.tensorflow.lite.InterpreterImpl.run(InterpreterImpl.java:126)
at org.tensorflow.lite.Interpreter.run(Interpreter.java:80)
at com.ml.quaterion.facenetdetection.model.FaceNetModel.runFaceNet(FaceNetModel.kt:87)
at com.ml.quaterion.facenetdetection.model.FaceNetModel.getFaceEmbedding(FaceNetModel.kt:79)
at com.ml.quaterion.facenetdetection.FileReader$getEmbedding$2.invokeSuspend(FileReader.kt:108)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@a0c68f4, Dispatchers.Main]

@shubham0204 shubham0204 added the bug Something isn't working label Nov 22, 2022
@denny-zefanya
Copy link

denny-zefanya commented Dec 1, 2022

I try this https://stackoverflow.com/questions/71485371/android-12api-level-31-tflitegpudelegate-invoke-gpudelegate-must-run-on-the
I add these lines to AndroidManifest to fix it:

    <uses-native-library
        android:name="libOpenCL.so"
        android:required="false" />

    <uses-native-library
        android:name="libOpenCL-car.so"
        android:required="false" />

    <uses-native-library
        android:name="libOpenCL-pixel.so"
        android:required="false" />

@shubham0204
Copy link
Owner

@AhmedKaram2 Did you try the solution suggested by @denny-zefanya?

shubham0204 added a commit that referenced this issue Feb 18, 2023
- Set CameraX output format to `OUTPUT_IMAGE_FORMAT_RGBA_8888`
- Updated copyright
@AhmedKaram2
Copy link
Author

yes and it's working now thanks @denny-zefanya @shubham0204

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants