A segmentation model that actually handles 2K without melting your GPU
BiRefNet splits images into layers using bilateral references, then offers a whole zoo of task-specific weights for everything from background removal to camouflaged-object detection.

What it does BiRefNet performs dichotomous image segmentation — essentially, figuring out which pixels belong to the foreground and which to the background. The project ships a full model zoo with weights tuned for specific tasks: general segmentation, high-resolution salient-object detection, camouflaged-object detection, trimap-free matting, and plain old background removal. It runs at 17 FPS on 1024×1024 images using under 3.5 GB of VRAM on an RTX 4090, and there are variants trained up to 2048×2048 and even a dynamic-resolution model spanning 256×256 to 2304×2304.
The interesting bit
The “bilateral reference” in the name refers to how the network builds relationships between features at different scales — not just top-down or bottom-up, but both directions simultaneously. The authors have kept iterating well past publication: SDPA attention for lower memory, an 8× GPU speedup on foreground refinement, and ONNX exports for deployment. There’s even a one-line HuggingFace AutoModelForImageSegmentation loader, which is rarer in academic repos than you’d think.
Key highlights
- Multiple specialized model variants:
BiRefNet_HR,BiRefNet_HR-matting,BiRefNet_dynamic,BiRefNet_lite-2K - FP16 inference with “~0 decrease of performance” according to the authors’ own testing
- Box-guided segmentation mode for interactive use
- Video inference notebook and Colab demos for batch processing
- Fine-tuning tutorial with screen recordings on YouTube and Bilibili
- ONNX exports available; deployed inference API via FAL and HuggingFace Spaces
Caveats
- The “bilateral reference” mechanism itself is not deeply explained in the README; you’ll need the paper for architectural details
- Some claims like “great and robust performance on any resolution images” are stated but not quantified in the README
- The project is actively seeking GPU donations, which suggests the larger experiments are resource-constrained
Verdict Worth a look if you need production-ready segmentation with pre-trained weights for niche tasks like camouflaged objects or high-res matting. Skip it if you want a lightweight, general-purpose backbone — this is a specialized tool with a research pedigree and the model zoo to match.
Frequently asked
- What is ZhengPeng7/BiRefNet?
- BiRefNet splits images into layers using bilateral references, then offers a whole zoo of task-specific weights for everything from background removal to camouflaged-object detection.
- Is BiRefNet open source?
- Yes — ZhengPeng7/BiRefNet is open source, released under the MIT license.
- What language is BiRefNet written in?
- ZhengPeng7/BiRefNet is primarily written in Python.
- How popular is BiRefNet?
- ZhengPeng7/BiRefNet has 3.9k stars on GitHub.
- Where can I find BiRefNet?
- ZhengPeng7/BiRefNet is on GitHub at https://github.com/ZhengPeng7/BiRefNet.