Closed delebash closed 3 years ago
Hi, did you by chance find an answer? The problem I am having is that wasm has a much lower fps. Example run the tensorflow js handpose demo at https://storage.googleapis.com/tfjs-models/demos/handpose/index.html. If you change the backend from webgl to wasm the fps drops dramatically. I would like to use some of the newer applications in mediapipe such as iris tracking but mediapipe uses wasm and tensoflow js does not have a version. I thought wasm was supposed to be faster than javascript.
Thanks for your help, Dan
This is not an answer to your original quesion, but regarding wasm vs WebGL vs JS.
WebGL allows you to use hardware acceleration, which translates to being able to being to perform hundreds of parallel calculations, perfect for many ML use cases. These calculations run on your GPU, not your CPU. Wasm is much lower-level than vanilla JS, meaning less granular overhead, and I believe also allows multi-threading out of the box, so you can take advantage of all your CPU cores for speed. Still it will be nowhere near as fast when it comes to parallel computing. Vanilla JS (without web workers anyway) is single-threaded and has more overhead. So it's not surprising that the WebGL backend is faster for this. Most devices will support hardware-accelerated WebGL, but not all.
I found the mediapipe version are much better than the tfjs models bt sadly i haven't figured out yet how to use that in a web application. I saw the visualizer where it run these models in browser as wasm. Is there any way to use https://google.github.io/mediapipe/solutions/hands.html
In a web application like how i can use the tfjs version ?
Searched everywhere for a sample unfortunately never found any
Certain MediaPipe models are available through the TF.js model repository, such as face-landmarks-detection and handpose. TF.js models include a JavaScript API, and can be used with the TF.js WebAssembly or WebGL accelerated backends.
Although TF.js aims to replicate the behavior of MediaPipe models, they are independent codebases and some drift is unavoidable. The postprocessing pipelines in particular may evolve separately. Both teams are actively considering options to address this issue.
@delebash - for what it's worth, we just added iris detection to our face-landmarks-detection model via MediaPipe Iris.
Thank you for the information and its great to hear Iris tracking has been added, awesome. Do you know if the tfjs models are as accurate in detection as the mediapipe models? I have been doing some lite testing and it appears that the medipipe version seems to be more accurate than the tfjs version. I haven't compared numbers but it just looks that way. Is there any documentation or can you confirm the difference between mediapipe C++, mediapipe web assembly, tfjs WebGel accuracy. I have read an article on the framerate differences but it doesn't tell me the accuracy difference in point detection.
Thanks, Dan
@annxingyuan
Thanks for your updates.
Do you know when you can improve tfjs-handpose frame-rate and add hand detection feature as like mediapipe-handpose ?
Let me know if I understand correctly :
process
to process a frame on CPU, processGL
to process frame on GPU. It means that computationnal functions such as model loading or inferencing are executed with WebAssembly. That allow us to load .tflite models.I noticed performances and quality differences between theses 2 demos (like @delebash ) : tfjs-demo and mediapipe-demo.
The tfjs demo is less accurate and runs with lower FPS than the MediaPipe one.
Where does it come from ?
@yuccai MediaPipe is really more powerfull than TF. You can compare a virtual background on https://meet.google.com, and virtual background implemented on https://beeweet.com.
As I understand 1) tfjs also uses MediaPipe wasm behind the hood but works on an older version, and does not support customization of the graph, and back then MediaPipe was fast but less accurate.
2) Recently MediaPipe added a release to the main branch and it's much accurate but slower, and also working on mobile web/desktop web. but as accuracy caused high cost and lower FPS (hand-track, Desktop: 25-30 FPS, mobile: 6-8 FPS)
using TFJs for the new project doesn't make any sense.
recently, chrome launched a model-viewer, webGPU. so maybe in the next release MediaPipe can also replace webGL with WebGPU, I guess till then we have to wait or you can help me to generate our own .wasm file for MediaPipe.
@yuccai MediaPipe is really more powerfull than TF. You can compare a virtual background on https://meet.google.com, and virtual background implemented on https://beeweet.com.
actually, tfjs uses an older version(specific version) of mediapie, and they are not even upgrading it.. try searching mediapipe in tfjs corresponding js file
For example the mediapipe web version of MediaPipe Hands https://google.github.io/mediapipe/solutions/hands.html has Multihand support. However the tfjs version https://github.com/tensorflow/tfjs-models/tree/master/handpose does not support this feature. Is there a simple example of using the MediaPipe webassembly version just like the tensorflow version?
because, tfjs doesn't support customization and they just set the default value to 1, though you can change via passing params while calling the constructor.
And yes MediaPipe's Latest release had some problems, so you can mail me directly at (vkrypto@gmail.com) if you want some help regarding stable code for web.
And yes MediaPipe's Latest release had some problems, so you can mail me directly at (vkrypto@gmail.com) if you want some help regarding stable code for web.
though you can ignore errors in the latest version. as it's only in PalmDetecter(only comes when hands not present in input frame )
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.
Closing as stale. Please reopen if you'd like to work on this further.
For example the mediapipe web version of MediaPipe Hands https://google.github.io/mediapipe/solutions/hands.html has Multihand support. However the tfjs version https://github.com/tensorflow/tfjs-models/tree/master/handpose does not support this feature. Is there a simple example of using the MediaPipe webassembly version just like the tensorflow version?