FeyNoBg: A SOTA Model For Background Removal
Research · field note

FeyNoBg: A SOTA Model For Background Removal

Authors
Hafedh Hichri, Shreyash Nigam
Affiliation
Feyn Labs
Published
July 21, 2026
Reading time
8 min
Three rental bicycles parked on a busy city sidewalk Original Background removed

We’re introducing FeyNoBg, a state-of-the-art model for automatic background removal. Across eight benchmarks, it posts the best published S-measure on four and comes within 2% of the leader on the rest.

BenchmarkUHRSD-TE
FeyNoBg0.981
BiRefNet0.957
Description

Tests salient-object masks in ultra-high-resolution images, including 4K and 8K scenes.

We’re also releasing NoBg, the library we used to train our model. Use NoBg to run FeyNoBg or train your own background removal model.

Both are open source. Download FeyNoBg on Hugging Face, or build with NoBg on GitHub.

Removal Requires Combination

In your computer, images are stored as grids of pixels. The goal of a background removal algorithm is to predict an opacity value for each pixel such that background pixels become transparent, foreground pixels remain opaque, and boundary pixels become translucent.

Producing this opacity map requires two skills. First, the model has to separate the foreground from the background. When the subject stands against a plain backdrop, this can be done easily by comparing colors. However, in low contrast, crowded, or camouflaged images, the model has to use shape, texture, and context to recognize which pixels form the subject.

Second, the model has to trace the foreground’s boundary. In simple images, a sharp change in color or texture provides a strong edge signal. But real boundaries are more difficult. Hair, fur, thin wires, and motion blur can blend foreground and background elements together. The model has to measure how much of an edge pixel belongs to the subject and set its opacity accordingly. This is called image matting.

Generally, these skills are taught with different kinds of focused data. This creates a failure point. A poor training mix can produce unbalanced models where improvements in one skill come at the expense of the other. Outputs either miss parts of the subject or lack clean edges.

Real images are complex and require deftness in foreground recognition and boundary precision. This was our key insight when training FeyNoBg.

Creating Room To Learn

We chose BiRefNet as the foundation for FeyNoBg, as its architecture already matched our goal. BiRefNet gives two parts of the model complementary responsibilities. Its localization module finds the foreground, while its reconstruction module traces the subject’s boundary.

The model starts by passing the input image through a feature extractor that runs in four stages. Early stages capture local details. Later stages combine the gathered details into broader image representations called feature maps. The localization module uses these maps to find the subject, while the reconstruction module uses them to recover its boundary.

The third stage of the feature extractor has the hardest job. It sees enough of the image to reason about the whole subject while retaining the spatial detail needed to represent its shape. Both localization and boundary reconstruction depend heavily on the feature map produced here.

Given the rich image representation this stage holds, we expected that adding more depth here would help the model retain information better and thus improve performance. Accordingly, we expanded the third stage from 18 to 24 blocks. This grew the model modestly from 222M parameters to 263M.

We preserved every compatible pre-trained weight during the expansion. Only the six new blocks started untrained. This gave FeyNoBg additional capacity to learn new skills without forgetting what the base model already knows.

With room to learn more, it was time to teach an old model some new tricks.

Strength in Diverse Data

Our first training run was with MaskFactory, a collection of synthetic image and mask pairs created for precise foreground segmentation. This was the only dataset used for the run.

If our intuition was correct, the resulting model would improve on some benchmarks while regressing on others. That is what happened in our controlled evaluation, where the model improved on the CAMO benchmark but regressed on DIS5K.

Next, we focused on building a more diverse dataset. We assembled 26.1K images from 10 datasets covering crowded scenes, camouflage, high resolution subjects, portraits, and anime, then trained for 7,000 steps. Our goal was to expose the model to as many scenarios as possible during training.

Training mix26.1K examples across ten sources
DatasetS3OD
What it added

Synthetic scenes designed to help models generalize beyond familiar image collections.

We revised our original mix before the final run. We added 4,000 images from S3OD, reduced Anime to 500 images, and removed ThinObject-5K, HIM-2K, and COIFT. This left us with the sources that contributed the most useful, consistent training examples.

Combining the datasets introduced two problems. First, they varied greatly in size. Without limits, the largest sources would dominate training and cause the same specialization we saw before. Consequently, we capped each source to 4,000 images and then shuffled them together.

Second, the datasets used different annotations. Segmentation datasets provided foreground masks, while matting datasets provided alpha mattes. We converted both into binary foreground masks so every image shared the same training target.

The matting datasets therefore contributed precisely outlined subjects, not soft-opacity supervision.

This gave us one consistent training set with deliberately varied images. Our model could now learn to identify and outline foregrounds across a much wider range of scenarios.

Results

To understand performance, we recorded S-measure. Scored from 0 to 1, S-measure compares the predicted foreground with the correct mask. It rewards both complete subjects and faithful shapes. A higher score is better.

We compared FeyNoBg’s S-Measure to the best published result on eight benchmarks covering camouflage, low contrast scenes, fine structures, high resolution images, and video. FeyNoBg led on four and was within 2% of the leader on the remaining four.

Notably, the broader training mix turned our DIS5K regression into a benchmark-leading result.

The NoBg Library

Image matting models are usually released as isolated repositories. Comparing models or fine-tuning one requires writing several adapters before any experiments can begin. This setup can quickly become too messy and frustrating to do good work in.

To solve this, we created NoBg. It is a Python library that provides a consistent interface to run and train background removal models. We used it ourselves to train FeyNoBg.

To encourage more development in this field, we are releasing NoBg in the open source. You can use it to run FeyNoBg, or train your own model.

Performant and Convenient

A consistent interface should not cost performance. We compared NoBg’s BiRefNet with the original implementation at batch sizes 1, 2, and 4. NoBg delivered higher throughput, lower latency, and lower peak GPU memory at every size.

Run FeyNoBg

NoBg resizes and normalizes the image before inference. It then converts the model output into an alpha matte at the original size and saves the cutout as 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")

Train Your Own Model

NoBg provides the model, processor, and loss needed to train BiRefNet on your own image and mask pairs. It also works with the Hugging Face Trainer, which handles the training loop, checkpointing, and evaluation. Given a dataset with image and mask columns, training looks like this:

from nobg import AutoModel, AutoProcessor
from transformers import Trainer, TrainingArguments

model = AutoModel.from_pretrained("feyninc/FeyNobg")
processor = AutoProcessor.from_pretrained("feyninc/FeyNobg")

def collate(examples):
    batch = processor(
        images=[example["image"] for example in examples],
        segmentation_maps=[
            example["mask"].convert("L") for example in examples
        ],
        return_tensors="pt",
    )
    return {
        "pixel_values": batch["pixel_values"],
        "labels": batch["labels"],
    }

trainer = Trainer(
    model=model,
    args=TrainingArguments(
        output_dir="outputs",
        learning_rate=2e-5,
    ),
    train_dataset=dataset,
    data_collator=collate,
)
trainer.train()

Get Started

Download FeyNoBg from Hugging Face and run the model with NoBg. Try it online in our Hugging Face Space.

Install NoBg with pip install nobg. You can also find it on GitHub.

FeyNoBg and NoBg are built by Feyn. Find us on X, GitHub, or LinkedIn.

Acknowledgements

FeyNoBg builds on BiRefNet and the work of Peng Zheng, Dehong Gao, Deng-Ping Fan, Li Liu, Jorma Laaksonen, Wanli Ouyang, and Nicu Sebe. We also thank the teams that released the models, code, and datasets used here.

References
[1] Zheng et al. "Bilateral Reference for High-Resolution Dichotomous Image Segmentation." CAAI Artificial Intelligence Research 3 (2024). arXiv:2401.03407.
[2] Sargsyan and Navasardyan. "FlowDIS: Language-Guided Dichotomous Image Segmentation with Flow Matching." CVPR 2026. arXiv:2605.05077.
[3] Kupyn, Kataoka, and Rupprecht. "S3OD: Towards Generalizable Salient Object Detection with Synthetic Data." arXiv:2510.21605 (2025).
Cite this note
@note{feynobg2026,
  title  = {FeyNoBg: Better Background Removal Without Forgetting},
  author = {Hichri, Hafedh and Nigam, Shreyash and Feyn Research},
  year   = {2026},
  venue  = {Feyn Field Notes}
}
Keep reading