tensorflow / tfjs-wechat

WeChat Mini-program plugin for TensorFlow.js
https://tensorflow.org/js
538 stars 101 forks source link

Why the model predicted so slow on ios device? #58

Open allrightzhu opened 4 years ago

allrightzhu commented 4 years ago

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.

pyu10055 commented 4 years ago

@allrightzhu can you share the wechat app for blazeface?

allrightzhu commented 4 years ago

@allrightzhu can you share the wechat app for blazeface?

Yes,which email can I send?

pyu10055 commented 4 years ago

@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!

allrightzhu commented 4 years ago

@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.

pyu10055 commented 4 years ago

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

allrightzhu commented 4 years ago

@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.

pyu10055 commented 4 years ago

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

Starsky-Synlitec commented 4 years ago

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 commented 4 years ago

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

smallSix6 commented 4 years ago

怎么我的代码代码运行报错啊,报错如下: 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 commented 4 years ago

@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!

pyu10055 commented 4 years ago

怎么我的代码代码运行报错啊,报错如下: 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.

GaussRieman commented 3 years ago

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.

1161735054 commented 3 years ago

@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?

anthann commented 3 years ago

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.

tenderzada commented 3 years ago

@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!

aizigao commented 2 months ago

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