Nankai University's BiRefNet Opens Pixel-Perfect Object Cutouts to Everyone
Researchers at Nankai University and collaborators released open model weights for BiRefNet, a high-resolution segmentation architecture built around bilateral reference and gradient supervision.
ProTakeaways
- Researchers released open MIT-licensed weights for BiRefNet, a high-resolution dichotomous image segmentation model.
- Architecture pairs a localization module with a reconstruction module using bilateral reference and gradient supervision.
- Paper reports state-of-the-art results on DIS, HRSOD, and camouflaged object detection benchmarks.
- Model is 0.2B params, loads via Transformers
AutoModelForImageSegmentationwithtrust_remote_code=True. - Recommended inference at 1024x1024 with ImageNet normalization and fp16 on GPU.
- Full training code and model zoo available on GitHub alongside the arXiv paper.
Researchers from Nankai University, Aalto University, Shanghai AI Laboratory, and the University of Trento have published open weights for BiRefNet, the segmentation model introduced in their paper Bilateral Reference for High-Resolution Dichotomous Image Segmentation. The repository packages trained checkpoints, inference code, and a Transformers integration for a model that targets pixel-accurate cutouts of complex objects at high resolution.
The work, authored by Peng Zheng, Dehong Gao, Deng-Ping Fan, Li Liu, Jorma Laaksonen, Wanli Ouyang, and Nicu Sebe, appears in CAAI Artificial Intelligence Research. The model card links to a GitHub codebase that houses training scripts, evaluation utilities, and a broader model zoo.
What dichotomous image segmentation actually means
Dichotomous Image Segmentation (DIS) produces a single binary mask that separates a foreground object from its background at very high resolution, keeping fine structures like hair strands, tree branches, or mesh patterns intact. It sits closer to a professional matting problem than to the multi-class segmentation most ML practitioners have seen in COCO-style benchmarks.
Bilateral reference, explained
The paper's bilateral reference framework has two components: a localization module (LM) and a reconstruction module (RM) that uses the proposed bilateral reference (BiRef). The split separates the two things a high-resolution segmenter has to do well.
- The LM handles object localization using global semantic information, deciding roughly where the object is.
- Inside the RM, BiRef uses hierarchical patches of the image as the source reference and gradient maps as the target reference, so the network reconstructs the mask while being pulled toward true edges.
- An auxiliary gradient supervision term pushes the network to focus on regions with finer details, which is where most segmentation losses collapse.
The authors outline practical training strategies tailored for DIS and run experiments on four tasks, reporting that BiRefNet outperforms task-specific methods across the benchmarks tested. The repository also notes state-of-the-art results on high-resolution salient object detection (HRSOD) and camouflaged object detection (COD) using the same architecture.
Getting it running
The checkpoint on Hugging Face is roughly 0.2B parameters and ships under an MIT license. It plugs directly into the Transformers pipeline through AutoModelForImageSegmentation, so no custom loader is required for standard use.
from transformers import AutoModelForImageSegmentation
birefnet = AutoModelForImageSegmentation.from_pretrained(
"ZhengPeng7/BiRefNet", trust_remote_code=True
)The recommended inference recipe resizes inputs to 1024x1024, normalizes with ImageNet statistics, runs the model in half precision on GPU, and applies a sigmoid to the last output tensor to get the alpha mask. The model card documents a second path that clones the GitHub repo for the latest code while still pulling weights from the Hub, useful if you want to fine-tune or modify the architecture.
Where it fits
The obvious applications are the ones the tag list already hints at: background removal, mask generation for compositing, and cutouts for downstream generative pipelines. The Spaces section of the model card shows it being used inside 3D reconstruction pipelines like Microsoft TRELLIS.2, relighting demos, and video background removal projects, which reflects how high-quality alpha mattes have become a preprocessing step for a lot of generative work.
A few practical caveats worth keeping in mind:
- The base checkpoint was trained on DIS-TR and validated on DIS-TEs and DIS-VD, so it targets single-object foreground extraction rather than multi-instance or panoptic segmentation.
- Running at 1024x1024 in fp16 is comfortable on a single consumer GPU, but memory grows quickly if you push to native 2K or 4K resolutions.
- The maintainer curates a BiRefNet collection of variants tuned for different tasks and scales, worth browsing before defaulting to the base weights.
Why this release matters
Most open segmentation work has centered on class-based masks, whether SAM-style promptable segmentation or semantic parsing. BiRefNet targets a different regime: producing a clean, high-resolution alpha for one object, with edges good enough to composite. Releasing the weights, the training recipes, and a Transformers-compatible loader under MIT lowers the bar for teams that previously relied on closed background-removal APIs or hand-tuned matting pipelines.
For anyone building image editing tools, e-commerce catalog pipelines, or datasets for generative training, this is a strong open baseline to measure against, and the paper's design choices around bilateral references and gradient supervision are worth reading even if you end up training your own segmenter on top.