-
Notifications
You must be signed in to change notification settings - Fork 74k
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
Using NnApiDelegate in TFLite 2.11.0 returns same embeddings for all images. It works fine for 2.6.0 #60653
Comments
Hi @shuaga Can you try benchmarking and share the results? Also, can you try with TF 2.12 and nightly and let us know if you are observing the same behaviour? Thanks. |
Hi @pjpratik I tried with TF 2.12 and the same problem behaviour was reproduced. Benchmarking steps done
The result of this was - Next - The result this time was - Below are logs containing 'NNAPI' from the logcat:05-24 12:59:12.259 5300 5300 I tflite_BenchmarkModelActivity: Running TensorFlow Lite benchmark with args: --graph=/data/local/tmp/facenet.tflite --num_threads=4 --use_nnapi=true 05-24 12:59:12.268 5300 5300 I tflite : Use NNAPI: [1] 05-24 12:59:12.280 5300 5300 I tflite : NNAPI accelerators available: [qti-default,qti-dsp,qti-gpu,nnapi-reference] 05-24 12:59:12.288 5300 5300 I tflite : Created TensorFlow Lite delegate for NNAPI. 05-24 12:59:12.288 5300 5300 I tflite : NNAPI delegate created. 05-24 12:59:12.289 5300 5300 W tflite : NNAPI SL driver did not implement SL_ANeuralNetworksDiagnostic_registerCallbacks! 05-24 12:59:12.290 5300 5300 I TypeManager: Failed to read /vendor/etc/nnapi_extensions_app_allowlist ; No app allowlisted for vendor extensions use. 05-24 12:59:12.755 5300 5300 I tflite : Replacing 179 out of 181 node(s) with delegate (TfLiteNnapiDelegate) node, yielding 2 partitions for the whole graph. 05-24 12:59:12.755 5300 5300 W tflite : NNAPI SL driver did not implement SL_ANeuralNetworksDiagnostic_registerCallbacks! 05-24 12:59:13.889 5300 5300 I tflite : Explicitly applied NNAPI delegate, and the model graph will be partially executed by the delegate w/ 1 delegate kernels. Next stepsDo let me know if anything else is needed. |
Sure thing, I'll take a look at this. |
Hi @shuaga, can you upload the .tflite file that encountered this issue? The smaller the better but anything that reproduces it will be fine. |
This is the one that encountered the issue. |
Putting the various library combinations that I've tried and what works and what doesn't -- Doesn't work -- Doesn't work -- Works -- |
Hi @sirakiin, can you please take a look at this? |
System information
provided in TensorFlow): Yes
happens on a mobile device: Xiaomi Poco F1
Describe the problem
In my android app I'm using Facenet model to recognize faces. I have added NnApiDelegate to the interpreterOptions.
My app has been working with TFLite version 2.6.0. When I upgraded the TFLite version to 2.10.0 or 2.11.0, I see that the model returns the same embeddings for any image I provide.
Removing the NnApiDelegate works in 2.11.0, but it slows down the face recognition considerably, so I do not want to remove NnApiDelegate.
Source code / logs
Code for setting up the interpreter in Kotlin:
val interpreterOptions = Interpreter.Options()
interpreterOptions.addDelegate(NnApiDelegate())
interpreter = Interpreter(FileUtil.loadMappedFile(context, model.assetsFilename ) , interpreterOptions)
The text was updated successfully, but these errors were encountered: