Hacker News new | comments | show | ask | jobs | submit login
Experimenting with WebAssembly and Computer Vision (hacks.mozilla.org)
123 points by happy-go-lucky 11 months ago | hide | past | web | favorite | 11 comments

It is so subpar compared to native, both in terms of time needed to reach the result (6 weeks 4 engineers) and fps (30 fps, no low pass filter, lots of noise and drop in the result...) that it confirms me that wasm is not ready for primetime. Overall, the web techonologies are loosing ground.

I wouldn't build any company around this technology.

But it runs on every platform with a webasm-enabled browser without installing or recompiling anything. It seems like a lot more potential users for a lot less work than targeting every hardware platform.

I wouldn't be so harsh; this was a self-directed learning project as part of a 12-week educational course. And they totally managed to get it working, which is no small feat given that WebAssembly only hit v1 a few months prior, and the tooling is still rather rough.

Wasm is very new, give it time. It will eventually get support for SIMD and maybe multi threading and GPU compute. It's amazing you can get results this good without all that though.

Anyway you are comparing apples and oranges. The alternative to wasm isn't native, it's javascript. And this is leaps and bounds better than js. Wasm is the new lowest common denominator language. Every platform supports it, it "just works" from the browser without requiring the user to do anything, and it doesn't require installation of any untrusted software. You can't say that for anything else.

I wonder how much of the perf/feature diff is due to lack of simd or threads? I don't even know if OpenCV uses either (I'd be surprised if they didn't), but both features are coming to WebAssembly.

Regular python/C++ API is threaded (to some extent). Parts of the C++ API is GPU enabled. Simd - pretty sure, the library originated at Intel, after all.

I wonder why they didn't contribute directly to https://github.com/ucisysarch/opencvjs. It was suffering from a bit of code rot so a lot of the demos no longer work. But the ones that do are still pretty comprehensive in terms of opencv feature coverage (at least compared to the demo they built):

Canny w/ webcam: https://ucisysarch.github.io/opencvjs/examples/live/img_proc...

Colors, canny, blurs, contours, histogram, morphology: http://ucisysarch.github.io/opencvjs/examples/img_proc.html

Detect face/eyes: http://ucisysarch.github.io/opencvjs/examples/face_detect.ht...

And much more from: https://github.com/ucisysarch/opencvjs/tree/gh-pages/example....

In this demo, they're not writing code in JS. They're compiling C++ code to run in the browser's webasm runtime.

Same with ucisysarch's demos. All opencv.js does is add JS bindings to compiled C++ code. They could've made it output webasm just by adding a "-s WASM=1" to the g++/em++ flags.

Here's a much better demo of browser-based face detection and face tracking and other cool stuff:


I was just writing about using PNACL for a project the other day: http://www.doxsey.net/blog/juggle-tutor.

In some ways the death of PNACL is kind of sad - as I think it was probably a technically superior solution. But cross-browser support is nice.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact