Hugging Face has released FeyNoBg, a state-of-the-art model for automatic background removal. The model excels across eight benchmarks, achieving the best published S-measure on four and coming within 2% of the leader on the remaining four. The company also introduced NoBg, a library used to train FeyNoBg, which is now open source. Users can run FeyNoBg on Hugging Face or build their own models using NoBg on GitHub. This release marks a significant step forward in image matting and foreground segmentation.
FeyNoBg is designed to handle complex image scenarios by combining two critical skills: separating foreground from background and tracing the subject's boundary. The model uses BiRefNet as its foundation, which splits responsibilities between localization and boundary reconstruction modules. The localization module identifies the subject, while the reconstruction module traces its boundary. The model's third stage of the feature extractor, expanded from 18 to 24 blocks, plays a crucial role in retaining spatial details needed for accurate foreground recognition. This expansion increased the model's parameter count from 222M to 263M, while preserving pre-trained weights from the base model.
The training process involved a diverse dataset of 26.1K images from 10 sources, covering crowded scenes, camouflage, high-resolution subjects, portraits, and anime. The team adjusted the dataset mix before the final run, adding 4,000 images from S3OD and reducing Anime to 500 images. They capped each dataset to 4,000 images and shuffled them to ensure balanced training. All datasets were converted to binary foreground masks for consistency. This approach enabled the model to learn foreground identification and boundary outlining across a wide range of scenarios.
Source: huggingface