pytorch / android-demo-app

PyTorch android examples of usage in applications
1.45k stars 593 forks source link

pytorch android lite works much slower when app going background #298

Open limuyiju opened 1 year ago

limuyiju commented 1 year ago

Hi,

I have an app that filters real-time sound from the mic and output to the earphone. It can run in the background (with a foreground notification). Everything is fine before embedding a lite torch model in between input/output, the output was always smooth regardless foreground/background/screen off.

However, with a lite torch model, the output sound turns out to be very bad when the app goes to the background. What I found is the 'forward' takes 5x times when the app is in the background. The model consists of CNNs and GRUs.

This happens on Android 10. On Android 12, it runs OK in the background, however, turns very bad when the screen is off.

Very much appreciated it if there are any hints for a fix. Thanks!