Show HN: FeyNoBg – Automatic background removal model and training library
Show HN: FeyNoBg – Automatic background removal model and training library
Feyn Open Source Blog | Research Field Note Authors: Hafedh Hichri, Shreyash Nigam Affiliation: Feyn Labs Published: July 21, 2026 Reading Time: min
🚀 Introducing FeyNoBg
We are proud to unveil FeyNoBg, a state-of-the-art (SOTA) model designed for the automatic removal of image backgrounds.
Examples: Bicycles, windblown hair, and free kicks.
Across eight distinct benchmarks, FeyNoBg achieves the top published S-measure in four categories and remains within a margin of the leader in all others.
Performance Comparison
| Benchmark | FeyNoBg vs. Leader | Result |
|---|---|---|
| UHRSD-TE | Better | |
| HRSOD-TE | Better | |
| DIS5K | Better | |
| DAVIS-S | Better | |
| DUTS-TE | Others Better | |
| COD10K-TE | Others Better | |
| DUT-OMRON | Others Better | |
| CAMO-TE | Others Better |
Note: The UHRSD-TE benchmark specifically evaluates salient-object masks within ultra-high-resolution imagery, including 8K and 4K scenes.
Alongside the model, we are releasing NoBg, the comprehensive library utilized for training. You can use NoBg to either deploy FeyNoBg or develop your own custom background removal models.
- Hugging Face: Download FeyNoBg weights.
- GitHub: Build using the
NoBglibrary.
🛠️ The Mechanics of Removal
In digital computing, images are represented as grids of pixels. The fundamental objective of a background removal algorithm is to assign an opacity value to every pixel:
- Background pixels Transparent
- Foreground pixels Opaque
- Boundary pixels Translucent
The Challenge of Segmentation
The process requires a combination of two distinct skills:
- Foreground Separation: Identifying the subject. This is trivial with plain backdrops (color comparison) but difficult in camouflaged, crowded, or low-contrast environments where the model must rely on context, texture, and shape.
- Boundary Precision: Handling "edge signals." While sharp color changes are easy, elements like motion blur, thin wires, fur, or hair blend the subject into the background.
"A poor training mix can produce unbalanced models where improvements in one skill come at the expense of the other."
The Goal:
- Accurate foreground recognition
- High-precision boundary tracing
- Robustness across complex real-world images
🏗️ Creating Room To Learn
We utilized BiRefNet as our architectural foundation. BiRefNet splits responsibilities between two modules:
localization module: Locates the foreground.reconstruction module: Refines the subject's edges.
Architecture Flow
The third stage of the feature extractor is critical; it balances global reasoning with spatial detail. We hypothesized that increasing the depth of this stage would enhance information retention.
The Expansion: We increased the third stage from 18 to 24 blocks.
# Architecture Depth Configuration
# Origin BiRefNet: 222M parameters
depths_old = [2, 2, 18, 2]
# FeyNoBg: 263M parameters
depths_new = [2, 2, 24, 2] # Added 6 fresh blocks
By preserving all compatible pre-trained weights during this expansion, we ensured the model retained existing knowledge while gaining the capacity to learn new nuances.
📊 Strength in Diverse Data
Our initial experiments using only MaskFactory (synthetic pairs) resulted in a specialized model: it excelled at the CAMO benchmark but failed on DIS5K. To fix this, we curated a diverse training set of 26.1K images across ten sources, training for 7,000 steps.
The Training Mix
| Dataset | Image Count | Contribution/Purpose |
|---|---|---|
| S3OD | 4,000 | Synthetic scenes for better generalization |
| MaskFactory | 4,000 | Precise foreground segmentation |
| DIS5K | 3,000 | General salient object detection |
| DUTS | 3,000 | Standard segmentation benchmarks |
| COD10K | 3,000 | Camouflaged object detection |
| UHRSD | 3,000 | Ultra-high resolution subjects |
| P3M-10K | 3,000 | High-quality matting |
| HRSOD | 1,610 | High-resolution salient objects |
| CAMO | 1,000 | Low-contrast/Camouflage |
| Anime | 500 | Stylized edge cases |
To prevent any single large dataset from dominating the model's behavior, we implemented a cap of 4,000 images per source and shuffled them. We also refined the list by removing:
ThinObject-5K, HIM-2K, and COIFT.
Data Normalization
We encountered two types of data:
- Segmentation datasets Provided binary foreground masks.
- Matting datasets Provided alpha mattes (soft edges).
To maintain a consistent training target, we converted all alpha mattes into binary foreground masks. This meant matting data contributed to outline precision rather than soft-opacity supervision.
🏁 Final Evaluation
We used the S-measure (scored from to ) to compare the predicted foreground against the ground truth. By testing across camouflage, high-resolution, and video benchmarks, we confirmed that FeyNoBg provides a robust, versatile solution for background removal.