tfjs-wechat icon indicating copy to clipboard operation
tfjs-wechat copied to clipboard

Why the model predicted so slow on ios device?

Open allrightzhu opened this issue 5 years ago • 17 comments

TensorFlow.js 1.7.0 tfjs-wechat plugin 0.0.9 WeChat 7.0.12 WeChat base API 2.10.4 WeChat IDE v1.02.1911180

I tried to run blazeface model on miniprogram,but I found that it predicted very slow on ios,this is my data about predicted time: IDE:15ms , android(MI 6): 40ms ios(iphone 6s): 460ms

But if I runed the blazeface model on web,like safari, the predicted time was fast.

allrightzhu avatar Apr 02 '20 02:04 allrightzhu

@allrightzhu can you share the wechat app for blazeface?

pyu10055 avatar Apr 02 '20 03:04 pyu10055

@allrightzhu can you share the wechat app for blazeface?

Yes,which email can I send?

allrightzhu avatar Apr 02 '20 03:04 allrightzhu

@allrightzhu can you share it here? If you prefer more secure way, you can create a private github project and add me to the project. Thanks!

pyu10055 avatar Apr 02 '20 16:04 pyu10055

@allrightzhu can you share it here? If you prefer more secure way, you can create a private github project and add me to the project. Thanks!

Ok,I invited you.

allrightzhu avatar Apr 03 '20 02:04 allrightzhu

@allrightzhu I tried your facemesh demo on iphoneXR the console output indicates around 20ms, blazeface is slower at 30ms

pyu10055 avatar Apr 03 '20 16:04 pyu10055

@allrightzhu I tried your facemesh demo on iphoneXR the console output indicates around 20ms, blazeface is slower at 30ms

OK,maybe my iphone6s is too old,I'll try it on more devices.

allrightzhu avatar Apr 07 '20 06:04 allrightzhu

@allrightzhu please let us know how did go, thanks.

pyu10055 avatar Apr 10 '20 15:04 pyu10055

I had the similar problem. On Android device, it runs fast, but it can not recieve any message from the UI. On Iphone device, it runs slow, but it can recieve message from UI like button.

Starsky-Synlitec avatar Jun 17 '20 05:06 Starsky-Synlitec

@pyu10055 I also invited you to my project, you can check it out.

Starsky-Synlitec avatar Jun 17 '20 05:06 Starsky-Synlitec

怎么我的代码代码运行报错啊,报错如下: VM1948:1 MiniProgramError module "miniprogram_npm/@tensorflow/tfjs-backend-wasm/path" is not defined Error: module "miniprogram_npm/@tensorflow/tfjs-backend-wasm/path" is not defined at require (http://127.0.0.1:42868/appservice/dev/WAService.js:2:2032908) at http://127.0.0.1:42868/appservice/dev/WAService.js:2:2032529 at REQUIRE (http://127.0.0.1:42868/appservice/miniprogram_npm/@tensorflow/tfjs-backend-wasm/index.js:25:34) at http://127.0.0.1:42868/appservice/miniprogram_npm/@tensorflow/tfjs-backend-wasm/index.js:5959:12 at Object.func (http://127.0.0.1:42868/appservice/miniprogram_npm/@tensorflow/tfjs-backend-wasm/index.js:102:32) at REQUIRE (http://127.0.0.1:42868/appservice/miniprogram_npm/@tensorflow/tfjs-backend-wasm/index.js:48:23) at http://127.0.0.1:42868/appservice/miniprogram_npm/@tensorflow/tfjs-backend-wasm/index.js:5962:10 at http://127.0.0.1:42868/appservice/miniprogram_npm/@tensorflow/tfjs-backend-wasm/index.js:5963:2 at require (http://127.0.0.1:42868/appservice/dev/WAService.js:2:2033046) at http://127.0.0.1:42868/appservice/dev/WAService.js:2:2032529 有人遇到过吗?

smallSix6 avatar Jun 22 '20 03:06 smallSix6

@allrightzhu您可以在这里分享吗?如果您希望使用更安全的方式,则可以创建一个私有github项目并将我添加到该项目中。谢谢!

好吧,我邀请你。

@allrightzhu can you share it here? If you prefer more secure way, you can create a private github project and add me to the project. Thanks!

Ok,I invited you.

Can you add me to the project too? Thanks!

smallSix6 avatar Jun 22 '20 03:06 smallSix6

怎么我的代码代码运行报错啊,报错如下: VM1948:1 MiniProgramError module "miniprogram_npm/@tensorflow/tfjs-backend-wasm/path" is not defined Error: module "miniprogram_npm/@tensorflow/tfjs-backend-wasm/path" is not defined at require (http://127.0.0.1:42868/appservice/dev/WAService.js:2:2032908) at http://127.0.0.1:42868/appservice/dev/WAService.js:2:2032529 at REQUIRE (http://127.0.0.1:42868/appservice/miniprogram_npm/@tensorflow/tfjs-backend-wasm/index.js:25:34) at http://127.0.0.1:42868/appservice/miniprogram_npm/@tensorflow/tfjs-backend-wasm/index.js:5959:12 at Object.func (http://127.0.0.1:42868/appservice/miniprogram_npm/@tensorflow/tfjs-backend-wasm/index.js:102:32) at REQUIRE (http://127.0.0.1:42868/appservice/miniprogram_npm/@tensorflow/tfjs-backend-wasm/index.js:48:23) at http://127.0.0.1:42868/appservice/miniprogram_npm/@tensorflow/tfjs-backend-wasm/index.js:5962:10 at http://127.0.0.1:42868/appservice/miniprogram_npm/@tensorflow/tfjs-backend-wasm/index.js:5963:2 at require (http://127.0.0.1:42868/appservice/dev/WAService.js:2:2033046) at http://127.0.0.1:42868/appservice/dev/WAService.js:2:2032529 有人遇到过吗?

@smallSix6, for WASM backend, you need to use 2.0.0 version of tfjs-wasm and tfjs-core, tfjs-converter, please take a look at the readme file for details.

pyu10055 avatar Jun 22 '20 22:06 pyu10055

Maybe it's not due to tfjs, instead the camera frame difference between iphone and android should be blamed for this. Note that the camera frame resolution on android is a constant 384288, while on iphone, as instruction says, it varies from 480p to 1080p, and 720p (1080720) as default.

One useful way to improve is setting the camera resolution low in camera label.

Hope it's helpful.

GaussRieman avatar Jul 27 '20 02:07 GaussRieman

@allrightzhu can you share it here? If you prefer more secure way, you can create a private github project and add me to the project. Thanks!

Ok,I invited you.

I am doing a similar project with you,can you please show me your code too?

1161735054 avatar Aug 25 '20 12:08 1161735054

JSCore on iOS has no jit. So that in many scenarios V8 on Android is outperformed. Not sure if it's related to this case.

anthann avatar Oct 30 '20 13:10 anthann

@allrightzhu您可以在这里分享吗?如果您希望使用更安全的方式,则可以创建一个私有github项目并将我添加到该项目中。谢谢!

好吧,我邀请你。

@allrightzhu can you share it here? If you prefer more secure way, you can create a private github project and add me to the project. Thanks!

Ok,I invited you.

Can you add me to the project too? Thanks!

Can you add me to the project too? Thanks!

tenderzada avatar Apr 03 '21 03:04 tenderzada

ios mini program run in jsCore without jit 小程序开启 useExperimentalWorker 可以开启JIT 然后运行wasm 的效率就和安卓差不多了,但是用了 useExperimentalWorker 就不能用 wx.createSharedArrayBuffer 创建共享内存了 传输数据时非常耗资源

aizigao avatar Apr 21 '24 09:04 aizigao