HN.zip

Show HN: FeyNoBg – Automatic background removal model and training library

Hey HN, I’m Shreyash from Feyn. We help companies build custom models from their data.Today, we’re releasing FeyNoBg, an automatic background removal model. Alongside it, we're open-sourcing NoBg, the Python library we built to train and run it.Try the model here: https://huggingface.co/spaces/feyninc/feynobg. Check out the library here: https://github.com/feyninc/nobgSome sample outputs:(1) Soccer Freekick: https://drive.google.com/file/d/1MZkAGLwbhNVOZ0Oi7XvpCfSEu9Q...(2) Hair in wind: https://drive.google.com/file/d/1Odc2m0XMVH9uZtvI_KjaRbXzhLL...(3) Bicycle with visible spokes: https://drive.google.com/file/d/1h99ahjfrtS1MFQJJgiKE2fuM3HZ...(4) Live Demo video: https://youtu.be/b1heHPvY8BMBackground removal separates an image's subject from its surrounding. We've all tried it at some point. Often it is to reuse the subject in a different artifact. Nowadays, it is common to make chat stickers out of it. It is one of the most common but under-appreciated uses of AI. It is also surprisingly complex. Models can be easily confused by camouflage, motion blur, or fine structures like hair.The task requires two skills. First, a model has to identify the foreground. Second, it has to trace the foreground’s boundary and estimate an opacity value for each pixel. Generally, these skills are taught with different datasets. That creates a failure point. A poor training mix can improve one skill at the expense of the other. We saw this in our controlled evaluation. A training run with just the MaskFactory dataset improved on the CAMO benchmark but regressed on DIS5K.For FeyNoBg, we took an interpretability-first approach to training. We first studied how BiRefNet’s stages contribute to finding the foreground and reconstructing its boundary. We discovered that the third stage of it's feature extractor holds a lot of information. Both localization and boundary reconstruction depend heavily on the feature map produced here.This led us to expand this stage from 18 to 24 blocks while preserving the pre-trained weights. We then trained FeyNoBg on 26.1K diverse examples assembled from 10 datasets. The goal was to improve foreground identification and boundary precision without sacrificing either one.Across eight benchmarks, FeyNoBg achieves the best published score on four and comes within 2% of the leader on the rest.Building FeyNoBg also exposed a tooling problem. Image matting models are usually released as isolated repositories with incompatible preprocessing, training, and evaluation code. We built NoBg to solve this. NoBg puts these workflows behind one Python interface. It supports BiRefNet today, with more architectures coming. We hope you build something exciting with it!Happy to answer any questions!

52 points by snyy - 15 comments

15 Comments

woadwarrior01 [3 hidden]5 mins ago
Why extend an MIT licensed model's weights (BiRefNet) and release it under a cc-by-nc-4.0 license?
snyy [3 hidden]5 mins ago
This pertains to the larger open source licensing discussions that have been happening (as I'm sure you've seen too).

We've released projects under the MIT license before, most notably https://github.com/feyninc/chonkie. While we're not trying to directly monetize on this work, credit goes a long way and helps in other operations.

Recently, attributed usage is shrinking. To be clear, this is not a shrinkage in actual use of our software, just how many people acknowledge that they rely on it.

cc-by-nc is a protection against that. We've been very honest about our work being on top of BiRefNet as we want to extend the original creators the same courtesy. I have no issues if individuals fork/finetune/or otherwise build on top of any open source projects we release, irrespective of license. At minimum, we want acknowledgment if a company chooses to use our software in production.

popalchemist [3 hidden]5 mins ago
Yep, nobody wants to adopt models with this license because it opens legal questions most users, whether professional or non-professional, don't want to muddy their work with.
nickludlam [3 hidden]5 mins ago
This looks great! What are the resolution limits? From the GitHub readme I saw mention of 1024x1024, but I was able to process an image 1920x2880 just fine. I didn't see any really obvious scaling artefacts, so is there something clever happening behind the scenes?
snyy [3 hidden]5 mins ago
We resize the opacity mask. That tends to scale better
geooff_ [3 hidden]5 mins ago
I love seeing this. Background removal is such a core task used in so many systems, I group it in with speech to text in terms of importance.

I love seeing maturity getting pushed in this space. Congratulations to you and the team!

defmetrix [3 hidden]5 mins ago
This is awesome, I just bookmarked your tool. Ive been looking for something simple to use, since Its not easy to use the segment anything tool anymore. Thanks!
snyy [3 hidden]5 mins ago
Thanks! Feel free to open an issue if you run into any issues with the outputs

https://github.com/feyninc/nobg/issues

yarone [3 hidden]5 mins ago
I was so impressed with remove.bg in Dec 2018; awesome to see the progress in this area, so cool.
sudb [3 hidden]5 mins ago
very cool! I've been having a fun time porting non-LLM models to iOS/Android (recently had some success with making Bonsai's image generation model run on Android) - have you attempted to run any of the workflows on a mobile device at all? Mind if I try?
snyy [3 hidden]5 mins ago
Please do try, I would love nothing more!

All I ask is you make a PR to https://github.com/feyninc/nobg with your results. We'd love to see what you make, contribute in any way we can, and share onwards.

sudb [3 hidden]5 mins ago
Of course, would be happy to!
bickov [3 hidden]5 mins ago
The two skills failure point is the best part of the writeup, the MaskFactory example where CAMO improved and DIS5K regressed is the kind of tradeoff most model releases never show. How did you land on the 4K cap per dataset source, was that swept or a judgment call? And what is the license on the released weights? The post covers the library but I did not see terms for commercial use of the model itself.
dang [3 hidden]5 mins ago
Can you please not post AI-generated or AI-edited comments to HN? It's not allowed here - see https://news.ycombinator.com/newsguidelines.html#generated and https://news.ycombinator.com/item?id=47340079.

Of course, it's impossible to know for sure what was LLM processed or not, but some of your posts (like this one) have been getting classified that way.

snyy [3 hidden]5 mins ago
The 4K cap was a judgement call, we didn't want one source to dominate. The license is cc-by-nc, just added it to the hugging face