Hacker News new | ask | show | jobs
by methodin 1637 days ago
So seemingly this is a Tensorflow model compiled as WASM? Pretty cool no matter how it's accomplished but I'll echo the other commenter that a more detailed writeup would be nice especially for the HN folks!
1 comments

Yeah, really. What's with the claim about "pure JS"...?

      async function setup() {
        await faceapi.tf.setWasmPaths('https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.12.0/dist/');
        await faceapi.tf.setBackend('wasm');
        await faceapi.tf.enableProdMode();
        await faceapi.tf.ENV.set('DEBUG', false);
        await faceapi.tf.ready();

        const model = await set_and_get_filter('gigachad');
        await faceapi.nets.tinyFaceDetector.load('./faceapi-models');
      };
There's not a whole lot of difference between minified JS and WASM anyway.
How.. Wai... What do you mean? There is a lot of difference! That's like saying Java bytecode is the same as Java source code, not nearly the same thing! Things that can run JS can run minified JS but doesn't mean it can run WASM, and just because something can run WASM doesn't mean it can run JS.
If something can run wasm, it can run JS by running an interpreter compiled to wasm.

Conversely, wasm can be transpiled to JS, and asm.js is also a thing.

Sure but a from scratch implementation in pure JS instead of a wasm compile would be cool.
Seems it's just the HN title that is incorrect, the website itself makes no claim about being vanilla JS/"pure" JS. Maybe mods/dang can correct it to remove the "Pure JavaScript" part?
I think a better description would be "pure client-side"