Yesterday,I saw a post in X asking for a self-hostable background remover service. I was thinking, can we make it work by using WebGPU? So it will run in the browser and doesn't require any server/queue to run
After a couple of hours, I created this and published the source code on https://github.com/ducan-ne/remove-bg
It's still new so welcome any ideas and contributions
Powered by WebGPU and Transformer.js (RMBG V1.4 model)
> 1.1 License. > BRIA grants Customer a time-limited, non-exclusive, non-sublicensable, personal and non-transferable right and license to install, deploy and use the Foundation Model for the sole purpose of evaluating and examining the Foundation Model. > The functionality of the Foundation Model is limited. Accordingly, Customer are not permitted to utilize the Foundation Model for purposes other than the testing and evaluation thereof.
> 1.2.Restrictions. Customer may not: > 1.2.2. sell, rent, lease, sublicense, distribute or lend the Foundation Model to others, in whole or in part, or host the Foundation Model for access or use by others.
> The Foundation Model made available through Hugging Face is intended for internal evaluation purposes and/or demonstration to potential customers only.
My company runs a bunch of similar web-based services and plan to do a background remover at some stage, but as far as I know there's no current models with a sufficiently permissive license that can also feasibly download & run in browsers.
Everyone publishing AI model is actually acting as if they owned copyright over it and as such are sharing it with a license, but there's no legal basis for such claim at this point, it's all about pretending and hoping the law will be changed later on to make their claim valid.
Claim fair use
Release model
Claim copyright
Infinite copyright!
You might say that the models were legally trained since no law mandates consent for AI training. But no law says that models are copyrightable either.
>The TRIPS Agreement requires that copyright protection extends to databases and other compilations if they constitute intellectual creation by virtue of the selection or arrangement of their contents, even if some or all of the contents do not themselves constitute materials protected by copyright
https://en.wikipedia.org/wiki/Database_right
Deleted Comment
But maybe that's just a me-problem.
Old habits die hard.
And the modern Internet implicitly assumes the end user is not on a metered connection. Websites are fucking massive these days.
You got me!
The model was 176 MB. Total pageload transferred 182 MB.
https://imgur.com/a/6xx3Lgu
It doesn't seem like "Disable cache" in the DevTools empties the Cache Storage.
PS: WebGPU is the future
https://huggingface.co/briaai/RMBG-1.4
1. Background removal is working good on a lot of different types of images. This includes images with background, plain or white background, men, women, children, hair, and pets.
2. After background removal, the new image is warped in some areas. For example, I have a picture of a child eating ice-cream. The background was removed perfectly but left a lot of artifacts on the child. I can share those images for testing.
Please let me know if there are other areas I can test.
Feel free to raise an issue on Github to keep track progress, it helps open source a lot, or you can DM on x.com/duc__an anytime
nice work. I recently also published a WebGPU version of our browser-only background removal library. It's using the onnx-runtime under the hood. Weights are from isnet. It could also run birefnet – if there is some interest – however BirefNet weights are almost 1GB in size, which is a bit much to download I guess.
There is a blog post about it and also a CPU only version available.
https://img.ly/blog/browser-background-removal-using-onnx-ru...
Source is available at: https://github.com/imgly/background-removal-js
and on npm: @imgly/background-removal
Feel free to check it out!