20x Faster Background Removal in the Browser Using ONNX Runtime with WebGPU

  • Background Removal can be thought of as Foreground Segmentation, inverted. That is no trivial feat; my undergraduate thesis was on segmentation, but using only “mechanical” approaches, no NNs, etc), hence my appreciation!

    But here’s something I don’t understand: (And someone please correct me if I’m wrong!) - now I do understand that NNs are to software what FPGAs are to hardware, and the ability to pick any node and mess with it (delete, clone, more connections, less connections, link weights, swap-out the activation functions, etc) means they’re perfect for evolutionary-algorithms that mutate, spawn, and cull these NNs until they solve some problem (e.g. playing Super Mario on a NES (props to Tom7) or in this case, photo background segmentation.

    …now, assuming the analogy to FPGAs still holds, with NNs being an incredibly inefficient way to encode and execute steps in a data-processing pipeline (but very efficient at evolving that pipeline) - doesn’t it then mean that whatever process is encoded in the NN, it should both be possible to represent in some more efficient representation (I.e. computer program code, even if it’s highly parallelised) and that “compiling” it down is essential for performance? And if so, then why are models/systems like this being kept in NN form?

    (I look forward to revisiting this post a decade from now and musing at my current misconceptions)

  • Worth noting that background removal is built in to Preview on Macos.

  • "Therefore, the first run of the network will take ~300 ms and consecutive runs will be ~100 ms"

    I only skimmed the article, but I don't think they mention the size of the image. 100ms is not that impressive when you consider that you need to be three times as fast for acceptable video frame rate.

  • As long as one uses a Chrome distribution.

    WebGPU is at least one year away of becoming usable for cross browser deployment.

  • Onnx is cool, the other option is tensorflow js which I have found quite nice as a usable matrix lib for JS with shockingly good perf.would love to know how well they compare

  • Interesting, there’s also node version in /packages.

  • MS teams does this already, right? (I assume they do, as it didn't work in Firefox until recently)

    Or do they do it server side?

  • [flagged]

  • [flagged]

  • [flagged]

  • [flagged]

  • If I run it in a browser on my client, why going to a website in the first place?