tf-lite-unity-sample icon indicating copy to clipboard operation
tf-lite-unity-sample copied to clipboard

The version v2.9.1-p1 seems apparently slower compared to the version from Apr 2020

Open rahul-nt opened this issue 3 years ago • 1 comments

Environment:

  • OS/OS Version: Windows 11
  • Source Version: master/v2.9.1-p1 and another version (not sure which) from April 2020
  • Unity Version: 2020.3.36f1 and 2019.24.f1 respectively
  • Android Version: API Level 30
  • Phone model used for testing: Redmi Note 10S

Description of the concern The version of the SSD Sample in the plugin from April 2020 apparently looks about twice as fast compared to the current v2.9.1-p1.

I ran Unity Profiler on the two versions of SSD Sample mentioned above, and the older version from April 2020 seems apparently faster than current v2.9.1-p1. The profiling was done on the same static scene where a static object was being detected. The tflite model for SSD is the same one that was already there in github repo. The CPU usage ranges that I observed in the profiler are as follows:

v2.9.1-p1:

  • Player Loop: 58 to 70+ ms (17 to 14 fps)
  • Interpreter.Invoke(): 36 to 52 ms

Version from Apr 2020:

  • Player Loop: 39 to 51 ms (25 to 19 fps)
  • Interpreter.Invoke(): 18 to 37 ms

Screenshots You can see this attached screenshot of the comparison of the two profiling sessions. You can also download profiling data for v2.9.1-p1 and profiling data for version from Apr 2020.

Query The plugin is quite awesome and I have been working on quite a few applications using the SSD in the plugin version from Apr 2020. I have been thinking of moving to the latest plugin version but given the currently collected profiling data, I am not so sure if I should move to the latest version of the plugin or not, since there are already gonna be other resource overheads in my applications, and I am planning to maintain a certain FPS level i.e. 25 fps. Could you kindly provide some insights into what might be the cause of this and how can this situation be resolved?

rahul-nt avatar Aug 11 '22 17:08 rahul-nt

Thanks for reporting it. Let me check.

asus4 avatar Aug 24 '22 18:08 asus4

@rahul-nt I looked into this issue today. But I could not reproduce that performance issue on my Sony Xperia XZ2 H8266. The latest TFLit version 2.10.0 was faster than the Apr.2020's TFLite Version 2.0.0on my phone.

Looking into further detail from the Unity profiler is impossible as TfLiteInterpreterInvoke (orange arrow) is TFLite's C API. However, you might see more detail using TFLite profiler with your phone.

record-on-xperia

asus4 avatar Oct 07 '22 15:10 asus4

Hi Koki Thank you so much for finding out the time to test this. After your reply, I also tested again on two different phone models.

Phone models:

  1. Google Pixel 6
  2. OPPO Reno 2

Unity Version used: Unity 2020.3.36f1

Android version: Android API Level 30

Gradle version: 5.6.4

Plugins used for comparison:

  1. v2.10
  2. the older version of your plugin to which I had previously referred in my OP as from "April 2020". Some explanation here about the older version: I called it "the version from April 2020" because I don't exactly know the version number, but I called it from "April 2020" because some of the oldest created files on that version are from April 2020. However, now I doubt that it may not be from April 2020, or v2.0 or 2.2 etc. since your test comparison of v2.10 with v2.0 seem to show different results as compared to the results I am getting on multiple phones consistently. I am uploading the older version here so that you may be able to see and test which version exactly it may be.

Results: The results however still show that the older version is faster as compared to v2.10.

I'm including the screenshots here for comparison:

Google Pixel 6

Object Detection Unity Plugin NEW (v2 10) Pixel 6 (2020 3 36f1) Object Detection Unity Plugin OLD Pixel 6 (2020 3 36f1)


OPPO Reno 2 Object Detection Unity Plugin NEW (v2 10) OPPO Reno 2 (2020 3 36f1) Object Detection Unity Plugin OLD OPPO Reno 2 (2020 3 36f1)

Furthermore, I am also including the link to the profiler data files here from Unity for the two versions tested on the two different phones.

A question here is: which Android SDK, NDK, and Gradle versions are you using for the testing?

It would be great if you can find the time to compare the v2.10 with the older version of yours that I have provided as a link.

Looking forward to your reply. Best Regards And kudos for your great work!

rahul-nt avatar Nov 08 '22 18:11 rahul-nt

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 08 '23 18:01 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 28 '23 08:03 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 08 '23 17:06 stale[bot]