Samsung S21: Noisy AI Inference Results with App Animations in PlayService/GPU Mode
I have the same problem on Samsung S21. Prediction errors will occur randomly when hardwareAccelerated is enabled. Update some new information.

I have discovered that not only can animations in the app cause errors, but if there are operations in other apps simultaneously with the model's prediction, they can also impact the predicted results of the model. Hi @JeremyJian,

Can you please fill out the issue template?: https://github.com/tensorflow/tensorflow/blob/master/ISSUE_TEMPLATE.md

Additionally for this use case are you using the Task Library API? The Interpreter API? Are you using a real device or an emulator in Android Studio? Is the same behavior happening in both?

Any additional information will be great. Thanks! Hi, in my project, I use the Interpreter API provided by Google Play Services. We have found this issue only on the Samsung S21, which is a real device. We have also run the same code on other devices such as the Pixel 5, Pixel 6, and Samsung S10, and everything works fine. To further clarify the issue, we have written a simple code using a simple model (MNIST model) to observe the behavior. The video is shown below.

https://drive.google.com/file/d/1CUb6fIeuX-Xg1KA4p0lKM5umjmjb5wJS/view

In the sample app, we perform inference with the same input(handwritten 7) 100 times for each scenario and display the accuracy on the user interface. As you can see in the video, when we run the inference and the circular progress bar simultaneously, the accuracy drops to 94%. However, we are using the exact same input (a bitmap of a 7-digit number), so the accuracy should always be 100%.


The summary of simple minst model:
_________________________________________________________________
 Layer (type)                Output Shape              Param #   

 conv2d (Conv2D)             (None, 26, 26, 16)        160       
                                                                 
 max_pooling2d (MaxPooling2D)  (None, 13, 13, 16)       0         
                                                               
                                                                 
 conv2d_1 (Conv2D)           (None, 11, 11, 16)        2320      
                                                                 
 max_pooling2d_1 (MaxPooling2D)  (None, 5, 5, 16)         0         
                                                             
                                                                 
 flatten (Flatten)           (None, 400)               0         
                                                                 
 dense (Dense)               (None, 64)                25664     
                                                                 
 dense_1 (Dense)             (None, 10)                650       
                                                                 
=================================================================
Total params: 28,794
Trainable params: 28,794
Non-trainable params: 0 Hi @JeremyJian, can you try on a Samsung S21 emulator as well and let us know the results? I'm trying to determine if we can replicate it on emulator here as well (this will help us immensely as that would make it reproducible on our end) otherwise we would have to procure a real device. Additionally, it seems your drive link is going to the github issues page instead, I can copy and paste the info to get there but if you can edit it so that the community doesn't get confused, that'll be great. Sorry, I can't find the emulator of Samsung S21 (SM-G9910) from Android Studio or Firebase TestLab. On the other hand, our issue only occurs in scenarios where both the GPU and Google Play Services (com.google.android.gms:play-services-tflite-gpu:16.2.0) are used simultaneously. It seems that reproducing this issue on a simulator may not be suitable. As described in the initial question, using the CPU or the standalone version of TensorFlow Lite (org.tensorflow:tensorflow-lite-gpu:2.9.0) does not encounter this problem.

Thank you for your reminder. The video link has been corrected. Thanks for the info, @sirakiin, can you please take a look at this? Thanks. Hi, Is there any new information or update regarding this issue? 
Thanks We have recently encountered similar issues with both the Samsung S22 Ultra and S23 Ultra devices. Including the previously mentioned S21 series, are equipped with Qualcomm processors. While we're uncertain whether the processor is directly linked to these problems, we are eager to receive any updates or new information regarding this issue. Please keep us informed if you have any new insights.
**System information**
- Android Device information : 
samsung/o1qzhx/o1q:12/SP1A.210812.016/G9910ZHU2CVG2:user/release-keys
- TensorFlow Lite in Play Services SDK version : 
   'com.google.android.gms:play-services-tflite-support:16.0.1'
   'com.google.android.gms:play-services-tflite-gpu:16.1.0'
- Google Play Services version
 23.16.13(190408-527363516)


I followed the tutorial from 

https://www.tensorflow.org/lite/android/play_services#java_6.

Everything seemed fine on almost all devices. However, our test team recently attempted to test our app on the Samsung S21 and discovered that the AI inference results are noisy when there are animations on the app's GUI. This issue only occurs in the PlayService/GPU scenario. If I switch to standalone mode, everything works well. We also found that setting "android:hardwareAccelerated" to false in the AndroidManifest.xml can produce stable results, but it's obviously not a reasonable solution. Has anyone else experienced a similar issue? I would appreciate any advice or suggestions.