What is the differen between runtime: 'tfjs' OR 'mediapipe'?

I’m really intrigued by this.

I was looking on the node_modules, and making comparation between those two option (tfjs, mediapipe), on the face-landmarks-detection.

There You will find two folders tfjs and mediapipe…but to be honest, I could not find much differences between both.

Hello there! Sorry for the delay, was OOO, however this simply refers to the implementation we use behind the scenes to execute the facemesh model.

Facemesh is a research model that came from the MediaPipe team. This team have their own web conversion that essentially bundles their C++ code into WebAssembly to execute in the browser that you can use.

The TensorFlow.js team also created a port of their implementation that runs using the TensorFlow.js backends such as WebGL on the GPU.

Historically this was done to please web developers that sometimes prefer a smaller bundle size than what the WASM compile produced as web pages need to load super fast to avoid user drop off, and in the past some ops the MediaPipe implementation was using did not work on certain iOS environments ( though I believe this is fixed now) so was a little more web dev friendly who needed to meet those requirements.

In short both are fine, and the MediaPipe version is likely the most up to date implementation and slightly more performant as they have designed this to be optimized for their calculators etc that they use within the web assembly environment vs our TensoFlow.js conversion for which the goals were slightly different.

1 Like

Thanks Jason, that was really helpful

Most welcome! Look forward to seeing what you create with Web ML!

1 Like