feynobg
- title
- feynobg
- type
- toolbox
- summary
- Feyn's background-removal model grown from BiRefNet, plus NoBg, the library used to train and run it
- tags
- python, computer-vision, image-processing, machine-learning, watchlist
- language
- Python
- license
- Apache-2.0
- created
- 2026-07-29
- updated
- 2026-07-29
FeyNoBg is a background-removal model published by Feyn, released alongside NoBg, the Python library they used to train it. The model is on Hugging Face as feyninc/FeyNobg; NoBg is pip install nobg and gives a consistent interface for running and training background-removal models rather than each one arriving as its own repository with its own adapters to write. Both are open source.
Feyn's headline claim, from their own announcement: across eight benchmarks FeyNoBg posts the best published S-measure on four and comes within 2% of the leader on the remaining four. The named benchmarks are UHRSD-TE, HRSOD-TE, DIS5K, DAVIS-S, DUTS-TE, COD10K-TE, DUT-OMRON, and CAMO-TE, covering camouflage, low contrast, fine structures, high resolution, and video. The one comparison the post spells out is UHRSD-TE, where it reports 0.981 for FeyNoBg against 0.957 for BiRefNet. This is a vendor blog post, not a peer-reviewed evaluation, and the comparison baseline is "best published result" as Feyn assembled it โ treat the ranking as their claim.
How the model was built
Background removal needs two different skills. The model has to separate foreground from background, which is trivial against a plain backdrop and hard in crowded, low-contrast, or camouflaged scenes where shape and context are the only signal. Then it has to trace the boundary, which is where hair, fur, thin wires, and motion blur blend the two together and each edge pixel needs a partial opacity. That second skill is image matting. Training data for the two skills tends to be different, and Feyn's stated insight is that an unbalanced mix produces a model that is good at one and worse at the other โ outputs that either miss parts of the subject or have dirty edges.
They started from BiRefNet, whose architecture already splits those responsibilities: a localization module finds the foreground and a reconstruction module traces the boundary, both consuming feature maps from a four-stage feature extractor. The third stage is where both modules get most of what they need, since it sees enough of the image to reason about the whole subject while still holding the spatial detail that describes its shape. So Feyn made that stage deeper, from 18 blocks to 24:
BiRefNet 222M params depths=[2, 2, 18, 2]
FeyNoBg 263M params depths=[2, 2, 24, 2]
Every compatible pre-trained weight was preserved through the expansion, leaving only the six new blocks untrained. The point was extra capacity that does not cost the base model what it already knew.
The data story is the part with a negative result in it. A first run trained on MaskFactory alone, a synthetic set built for precise foreground segmentation, and behaved exactly as the specialization hypothesis predicted: better on CAMO, worse on DIS5K. The final mix pulled 26.1K images from 10 datasets spanning crowded scenes, camouflage, high-resolution subjects, portraits, and anime, trained for 7,000 steps. It was revised before the final run by adding 4,000 images from S3OD, cutting anime to 500, and dropping ThinObject-5K, HIM-2K, and COIFT. Two normalizations made the mix usable: each source was capped at 4,000 images so the largest ones could not dominate and reintroduce the same specialization, and the annotations were unified โ segmentation datasets give foreground masks, matting datasets give alpha mattes, and everything was converted to binary foreground masks. That last choice means the matting datasets contributed precisely outlined subjects rather than soft-opacity supervision. Feyn report that the broader mix turned the DIS5K regression into a benchmark-leading result.
Scores are S-measure, from 0 to 1, which compares the predicted foreground against the correct mask and rewards both complete subjects and faithful shapes.
The library
NoBg exists because comparing or fine-tuning matting models normally means writing several adapters before any experiment can start. It follows the Hugging Face AutoModel/AutoProcessor shape, handles resize and normalization, converts the model output back into an alpha matte at the original resolution, and writes a transparent PNG:
import torch
from loadimg import load_img
from nobg import AutoModel, AutoProcessor
model = AutoModel.from_pretrained("feyninc/FeyNobg").eval()
processor = AutoProcessor.from_pretrained("feyninc/FeyNobg")
image = load_img("input.jpg").convert("RGB")
inputs = processor(image, return_tensors="pt")
with torch.inference_mode():
outputs = model(pixel_values=inputs["pixel_values"])
alpha = processor.post_process_alpha_matting(
outputs, target_sizes=[(image.height, image.width)],
)[0]
processor.cutout(image, alpha).save("output.png")
Training works through the stock transformers.Trainer with a collator that runs images and masks through the processor, so checkpointing and evaluation come for free. Feyn also claim their BiRefNet implementation beats the original on throughput, latency, and peak GPU memory at batch sizes 1, 2, and 4, without publishing the numbers.
FeyNoBg builds on BiRefNet by Peng Zheng and co-authors (arXiv:2401.03407), and the training mix draws on S3OD (arXiv:2510.21605).
On watchlist until the ranking is checkable: one benchmark pair published out of eight claimed, throughput numbers withheld, and the whole comparison assembled by the vendor.
github.com/feyninc/nobg โ 87 stars, Apache-2.0. Model weights at huggingface.co/feyninc/FeyNobg, with a hosted demo Space.