BiRefNet
State-of-the-art background removal and dichotomous image segmentation model producing clean masks and transparent foregrounds
Details
Modalities
image
Recommended Hardware
1xRTX 4090
Estimated Price
Loading...
Provider
ZhengPeng7
Family
BiRefNet
License
MIT
BiRefNet: High-Resolution Background Removal
BiRefNet (Bilateral Reference Network) is the official model from the paper "Bilateral Reference for High-Resolution Dichotomous Image Segmentation" (CAAI AIR 2024). It separates a foreground subject from its background with pixel-accurate precision, producing a clean alpha mask and a transparent-background cutout from a single input image. It is one of the most widely used open models for background removal.
Overview
Dichotomous image segmentation is the task of splitting an image into exactly two regions: the object of interest and everything else. BiRefNet approaches this with a bilateral reference architecture that combines an "inward" reference, which keeps the original high-resolution image detail available to the decoder, with an "outward" reference based on gradient information that guides the network's attention toward fine structures. The result is a model that preserves details that defeat most segmentation models, such as hair strands, fur, mesh, wires, and semi-transparent edges.
Key Features
- Precise segmentation masks - Produces high-quality binary masks and soft alpha mattes, handling fine structures such as hair, netting, and thin branches
- High-resolution processing - Standard inference runs at 1024x1024, with sibling checkpoints trained for resolutions up to 2048x2048
- State-of-the-art accuracy - The paper reports leading performance on the three benchmark tasks it targets: dichotomous image segmentation (DIS5K), high-resolution salient object detection (HRSOD), and concealed object detection (COD)
- Lightweight and fast - Compact model that loads in seconds and processes images in a fraction of a second on a modern GPU
- Model zoo - The general-purpose checkpoint used here is one of a family that includes portrait, matting, and lite variants, all published under the same ZhengPeng7 namespace on Hugging Face
Use Cases
- E-commerce product photography: cut out products for catalog images with clean edges
- Portrait and profile picture background removal
- Graphic design and marketing: extract subjects for compositing into new scenes
- Photo editing pipelines: generate alpha mattes for downstream compositing tools
- Batch background removal via the ComfyUI API for automated media workflows
- Preprocessing for image generation: isolate subjects before inpainting or restyling
Architecture
BiRefNet pairs a Swin Transformer backbone with a decoder built around the bilateral reference mechanism. During decoding, patches of the source image at full resolution are fed back into each stage (the inward reference) so that reconstruction never has to rely on downsampled features alone, while gradient-aware supervision (the outward reference) pushes the model to attend to regions dense in fine detail. Auxiliary gradient supervision further sharpens its handling of edges and thin structures.
Community and Ecosystem
BiRefNet is among the most downloaded image segmentation models on Hugging Face, and its checkpoints power background removal features in many downstream tools and interfaces. The author maintains an active model zoo with task-specific weights for standard dichotomous segmentation, salient object detection, and concealed object detection, alongside the general-purpose checkpoint served here from ZhengPeng7/BiRefNet. This template loads it through ComfyUI's built-in background-removal nodes, using the ComfyUI-ready copy published at Comfy-Org/BiRefNet, and saves each result as a transparent PNG.
Quick Start Guide
Choose a model and click 'Deploy' above to find available GPUs recommended for this model.
Rent your dedicated instance preconfigured with the model you've selected.
Start sending requests to your model instance and getting responses right now.