메뉴
HN
Hacker News 1일 전

오픈소스 배경 제거 SOTA 모델 'FeyNoBg'와 학습 라이브러리 공개

IMP
7/10
핵심 요약

Feyn Labs 연구진이 8개 벤치마크에서 최고 수준의 성능을 기록한 자동 배경 제거 모델 'FeyNoBg'와 이를 학습시킬 수 있는 오픈소스 라이브러리 'NoBg'를 공개했습니다. 이 모델은 피사체 인식 능력과 경계선 처리(이미지 매팅) 능력의 불균형을 해결하기 위해, BiRefNet 아키텍처를 확장하고 정제된 합성 데이터로 학습시켜 복잡한 이미지에서도 훌륭한 결과물을 냅니다. 개발자들은 허깅페이스(Hugging Face)와 깃허브(GitHub)를 통해 모델과 라이브러리를 무료로 다운로드하고 직접 커스텀 모델을 구축할 수 있습니다.

번역된 본문

연구 · 현장 노트 FeyNoBg: 배경 제거를 위한 SOTA(State-of-the-Art) 모델 저자: Hafedh Hichri, Shreyash Nigam 소속: Feyn Labs 발행일: 2026년 7월 21일 읽는 시간: 8분

당사는 자동 배경 제거를 위한 최고 수준의 모델인 FeyNoBg를 소개합니다. 8개의 벤치마크에서 4개의 벤치마크 부문에서 최고의 S-measure(구조적 유사성 측정 지표)를 기록했으며, 나머지 부문에서도 1위 모델과 2% 이내의 차이를 보였습니다. 또한 당사가 모델 학습에 사용한 라이브러리인 NoBg도 함께 릴리스합니다. NoBg를 사용하여 FeyNoBg를 실행하거나 나만의 배경 제거 모델을 학습시킬 수 있습니다. 두 가지 모두 오픈소스입니다. Hugging Face에서 FeyNoBg를 다운로드하거나, GitHub에서 NoBg를 사용하여 빌드해 보세요.

배경 제거에는 결합이 필수입니다 컴퓨터에서 이미지는 픽셀 격자로 저장됩니다. 배경 제거 알고리즘의 목표는 배경 픽셀은 투명하게, 전경 픽셀은 불투명하게, 경계선 픽셀은 반투명하게 만들기 위해 각 픽셀의 불투명도(투명도) 값을 예측하는 것입니다.

이러한 불투명도 맵을 생성하려면 두 가지 기술이 필요합니다. 첫째, 모델이 전경과 배경을 분리해야 합니다. 피사체가 단순한 배경 앞에 서 있을 때는 색상을 비교하여 쉽게 분리할 수 있습니다. 하지만 대비가 낮거나, 붐비거나, 위장된(주변과 섞여 구별하기 어려운) 이미지에서는 모델이 모양, 질감 및 문맥을 사용하여 어떤 픽셀이 피사체를 형성하는지 인식해야 합니다.

둘째, 모델이 전경의 경계선을 추적해야 합니다. 단순한 이미지에서는 색상이나 질감의 급격한 변화가 강력한 가장자리 신호를 제공합니다. 하지만 실제 경계선은 더 다루기 어렵습니다. 머리카락, 털, 얇은 전선, 모션 블러는 전경과 배경 요소를 뒤섞어 버립니다. 모델은 가장자리 픽셀이 얼마나 피사체에 속하는지 측정하고 그에 따라 불투명도를 설정해야 합니다. 이를 이미지 매팅(Image Matting)이라고 합니다.

일반적으로 이러한 기술은 각기 다른 종류의 특정 맞춤형 데이터로 학습됩니다. 이로 인해 실패 지점이 발생합니다. 훈련 데이터 구성이 좋지 않으면 한 가지 기술이 향상되는 대신 다른 기술이 희생되는 불균형한 모델이 탄생할 수 있습니다. 그 결과, 출력 결과물은 피사체의 일부를 잃어버리거나 깔끔하지 못한 가장자리를 갖게 됩니다. 실제 이미지는 복잡하며, 전경 인식의 민첩성과 경계선의 정밀함이 모두 필요합니다. 이것이 FeyNoBg를 훈련시킬 때 우리가 가졌던 핵심 통찰이었습니다.

학습의 여유 공간 확보 우리는 BiRefNet의 아키텍처가 이미 우리의 목표와 일치했기 때문에 FeyNoBg의 기반으로 선택했습니다. BiRefNet은 모델의 두 부분에 상호 보완적인 역할을 부여합니다. 현지화(Localization) 모듈은 전경을 찾고, 재구성(Reconstruction) 모듈은 피사체의 경계선을 추적합니다.

이 모델은 입력 이미지를 4단계로 실행되는 특징 추출기(Feature Extractor)를 통과시키는 것으로 시작됩니다. 초기 단계에서는 국소적인 세부 정보를 캡처합니다. 이후 단계에서는 수집된 세부 정보를 특징 맵(Feature Map)이라는 더 넓은 이미지 표현으로 결합합니다. 현지화 모듈은 이 맵을 사용하여 피사체를 찾고, 재구성 모듈은 이를 사용하여 경계선을 복구합니다.

특징 추출기의 세 번째 단계가 가장 어려운 작업을 수행합니다. 이 단계는 모양을 표현하는 데 필요한 공간적 세부 정보를 유지하면서도 전체 피사체를 추론할 수 있을 만큼 충분히 이미지를 살핍니다. 현지화와 경계선 재구성 모두 여기서 생성된 특징 맵에 크게 의존합니다. 이 단계가 담고 있는 풍부한 이미지 표현을 고려할 때, 여기에 깊이를 더하면 모델이 정보를 더 잘 유지하여 성능을 향상시킬 수 있을 것이라고 예상했습니다.

이에 따라 우리는 세 번째 단계를 18개 블록에서 24개 블록으로 확장했습니다. 이로 인해 모델 파라미터는 2억 2,200만 개에서 2억 6,300만 개로 약간 증가했습니다. 우리는 확장하는 동안 호환되는 모든 사전 학습된 가중치(Pre-trained Weight)를 보존했습니다. 새로 추가된 6개 블록만 처음부터 학습을 시작했습니다. 이를 통해 FeyNoBg는 기본 모델이 이미 알고 있는 것을 잊지 않고 새로운 기술을 학습할 수 있는 추가적인 용량을 확보했습니다. 더 많이 학습할 여유 공간이 생겼으니, 이제 기존 모델에게 새로운 기술을 가르칠 차례였습니다.

다양한 데이터에서 나오는 강점 우리의 첫 번째 학습 실행은 정밀한 전경 분할(Foreground Segmentation)을 위해 만들어진 합성 이미지 및 마스크 쌍 모음인 MaskFactory를 사용했습니다. 이것이 해당 실행에 사용된 유일한 데이터셋이었습니다. 우리의 직관이 맞다면, 결과 모델은 일부 벤치마크에서는 향상되고 다른 벤치마크에서는 성능이 퇴보할 것입니다. 통제된 평가에서도 그런 일이 바로 일어났습니다.

원문 보기
원문 보기 (영어)
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 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. 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. 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( "fe