Image editing & upscalingMITPython

BiRefNet

High-resolution dichotomous segmentation — state-of-the-art background removal.

Stars
4.3K
Forks
338
Open issues
33
Last commit
2026-10-11

Live from the GitHub API · updated 2026-10-15

What is BiRefNet?

BiRefNet is a segmentation model that produces very clean cut-outs at high resolution, including hair and thin structures. It is available on Hugging Face and integrated into rembg and ComfyUI nodes.

Key features

  • High-resolution, detailed foreground masks
  • Pretrained weights for general, portrait and matting use
  • Hugging Face transformers loading

System requirements

Platforms
Windows · macOS · Linux
GPU
NVIDIA recommended
Python
3.9+

How to install BiRefNet

Summarized from the project’s README. Projects change quickly — check the GitHub page for the latest instructions.

Python

  1. 1
    Clone and install.
    git clone https://github.com/ZhengPeng7/BiRefNet.git
    cd BiRefNet
    pip install -r requirements.txt
  2. 2
    Or load it directly from Hugging Face in your own code.
    from transformers import AutoModelForImageSegmentation
    model = AutoModelForImageSegmentation.from_pretrained("ZhengPeng7/BiRefNet", trust_remote_code=True)

Strengths

  • Best-in-class edge quality
  • Permissive license

Limitations

  • Research code; easiest via rembg or ComfyUI

BiRefNet alternatives compared

SoftwareStarsLicensePlatformsVRAM
BiRefNet

High-resolution dichotomous segmentation — state-of-the-art background removal.

4.3KMIT—
rembg

Remove image backgrounds from the command line, Python or an HTTP server.

25.1KMIT—
Segment Anything (SAM)

Meta’s promptable segmentation model — click to cut out any object.

55KApache-2.0—
Upscayl

Free desktop app that upscales images with AI.

50.6KAGPL-3.0—
Real-ESRGAN

Practical image and video super-resolution models.

37.1KBSD-3-Clause—
GFPGAN

Blind face restoration for old and low-quality photos.

37.7KApache-2.0—

FAQ

Is BiRefNet free?

Yes — BiRefNet is open-source software released under the MIT license. Check the license (and any model weight licenses) before commercial use.

Does BiRefNet run on Windows, Mac and Linux?

BiRefNet supports: Windows, macOS, Linux.

What hardware do I need for BiRefNet?

NVIDIA recommended

How do I install BiRefNet?

1. Clone and install. 2. Or load it directly from Hugging Face in your own code.

What are the best BiRefNet alternatives?

Popular alternatives include rembg, Segment Anything (SAM), Upscayl, Real-ESRGAN. See the comparison table on this page.

Can I use BiRefNet online without installing it?

If you just want results, AiLoft runs top image models such as GPT Image 2.5 and Nano Banana Pro in the browser — no GPU or setup required.

Skip the install — generate images in your browser

No GPU, drivers or Python needed. Use GPT Image 2.5 and Nano Banana Pro online and compare them side by side.