Open-source project
ZhengPeng7/BiRefNet avatar
ZhengPeng7/BiRefNet

BiRefNet keeps its changelog in the readme and its weights on a model hub

[CAAI AIR'24] Bilateral Reference for High-Resolution Dichotomous Image Segmentation

4,446 stars353 forksPythonMIT

At a glance

What is it?
BiRefNet is the official implementation of a CAAI AIR 2024 paper on high-resolution dichotomous image segmentation. The repository holds training and inference scripts and a requirements file of fifteen entries, with no package metadata and a single release tag, while the artefacts people actually run are weights published separately as a growing set of variants, each labelled with the resolution it was trained at.
Who is it for?
BiRefNet fits someone who needs a foreground mask at high resolution today and is willing to choose between checkpoints rather than tune one model: the HR, matting and dynamic variants differ in training resolution and purpose. It does not fit a project that needs a pinned, versioned dependency, because the repository publishes one tag from May 2024 while the actual model history lives as dated entries in the readme, and the code carries no packaging metadata.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 29 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 23, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • ZhengPeng7/BiRefNet4,446 ★ · +227
Star history
Repository2026-09-232026-11-23
ZhengPeng7/BiRefNet4.2k4.4k

227 Stars in the last 61 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The repository is a hub of links around one paper

The page opens with an author block and then a row of badge links, and reading those links is the fastest way to understand how this project is distributed. There is a paper PDF hosted on a journal site and the same paper on arxiv, two Google Drive links, the project site at birefnet.cv, a LICENSE link, a Hugging Face Space for a demo, and a Hugging Face model page for the weights. A second row adds three Colab notebooks, and a third row holds a single trendshift badge. The project homepage field points at birefnet.cv.

One sentence states the purpose: this is the official implementation of Bilateral Reference for High-Resolution Dichotomous Image Segmentation, from CAAI AIR 2024.

The arrangement matters for anyone deciding what to clone. The code needed to train or fine-tune the model lives in the repository, while the artefact most people want, a trained checkpoint, does not, and is downloaded from a model hub under the maintainer's account. Nothing in the repository itself carries weights.

One release tag and a changelog written into the readme

The repository has a single GitHub release, tagged v1 and named BiRefNet-v1, published on 2024-05-13. There is no CHANGELOG file in the tree.

Everything that happened afterwards is recorded as dated entries inside the readme, and they run in reverse chronological order from Sep 23, 2025 back through 2024. Reading them is the only way to learn that the attention implementation in the swin transformer was switched to PyTorch's official SDPA on Sep 23, 2025, that foreground refinement was accelerated on Jun 30, 2025, that a fine-tuning tutorial was recorded on May 15, 2025, and that the dynamic and matting variants were released in March and February of that year.

So the tag and the code have drifted apart. Someone pinning v1 gets a May 2024 state, and the difference between that state and the branch is only described in prose on the page, with no per-change commit reference to check against. The tree shows work continuing to the last push on 2026-10-25, which is well after the tag.

Five checkpoints, each labelled with the resolution it was trained at

The variant names encode purpose and training resolution, which is the most useful thing on the page. BiRefNet_lite-2K, uploaded Sep 24, 2024, takes inputs at the much higher resolution of 2560x1440. BiRefNet-matting, uploaded Oct 6, 2024, is for general trimap-free matting use. BiRefNet_HR, released Feb 1, 2025, was trained on images at 2048x2048. BiRefNet_HR-matting, released Feb 12, 2025, was trained at the same 2048x2048 for matting work. BiRefNet_dynamic, released Mar 31, 2025, was trained across a dynamic range from 256x256 to 2304x2304.

The dynamic variant is the one that changes how you use the project, because being trained across a range is the stated reason it behaves the same way on images of any resolution. The two matting variants sit apart from the dichotomous ones: a trimap-free matting model is answering a different question about the same pixels, and the page presents them as separate downloads rather than as flags on one model.

Speed claims come with numbers and quality claims do not

The efficiency entries are specific enough to plan against. On Jan 6, 2025 the standard model was validated under FP16 inference with about no decrease in performance, running at 17 FPS with resolution set to 1024x1024 and using 3.45GB of GPU memory on a single RTX 4090. On Jun 30, 2025 foreground refinement was accelerated by a factor of eight, to about 80ms on a 5090, by taking a GPU implementation of fast-fg-est and upgrading the array pre- and post-processing around it.

The quality entries are not comparable. The dynamic variant is described as showing great performance on images of any resolution, and the HR variant as showing great performance on higher resolution images. No metric, dataset or baseline accompanies either statement.

So the news entries give concrete figures about cost, one number for inference and one for a preprocessing step, while their statements about output quality are adjectives.

The compute behind the weights came from one appeal and two donations

The compute story is written into the page as plainly as the model story. A pinned note dated 2024-04-08 says more GPU resources are needed to push the performance of BiRefNet forward, especially toward general use and higher resolution images, invites cooperation, and gives a direct email address to the maintainer.

The training runs that followed are credited to outside support rather than to the authors' own hardware. The HR variant, released Feb 1, 2025, credits Freepik for offering H200x4 GPU for a training run described as taking about three weeks. The HR-matting entry on Feb 12, 2025 and the dynamic entry on Mar 31, 2025 each credit Freepik again for GPU support.

Two things follow. And the request for resources is dated more than two years before the last push recorded on 2026-10-25, so whether that request is still open is not something the page says.

Six institutions in the author block, and a student project in the news

The author block maps seven names onto six institutions with numbered markers. Peng Zheng carries markers 1, 4, 5 and 6; Dehong Gao carries 2; Deng-Ping Fan carries 1 with an asterisk marking him as the corresponding author; Li Liu carries 3; Jorma Laaksonen carries 4; Wanli Ouyang carries 5; Nicu Sebe carries 6. The institutions are Nankai University, Northwestern Polytechnical University, National University of Defense Technology, Aalto University, Shanghai AI Laboratory and the University of Trento.

The repeated markers are the useful part: the first author is affiliated with four of the six, so this is one research group spread across several sites rather than a single lab's project, and the corresponding author is at Nankai.

The Nov 28, 2024 entry is a different kind of record. It congratulates students from Nankai University who used BiRefNet to build a project and won a provincial gold medal and a national bronze medal at the China International College Students' Innovation Competition 2024. Adopted in a student competition project, which is the clearest evidence on the page about who finds this useful.

A research script layout with no package metadata and no test suite

The top level of the tree is a set of research scripts rather than a library. There is config.py, dataset.py, train.py, inference.py, eval_existingOnes.py, gen_best_ep.py, image_proc.py, loss.py and utils.py at the root, plus directories for models, evaluation and tutorials, and shell entry points named test.sh, train.sh, train_test.sh, sub.sh, rm_cache.sh and make_a_copy.sh.

What is missing is as informative as what is there. There is no pyproject.toml, no setup.py and no package directory, so the scripts are run from a checkout rather than installed. There is no tests directory and no continuous integration configuration, which for a repository with a single 2024 release tag and dated performance claims leaves no automated way to confirm that a checkout still behaves as described.

The requirements file lists fifteen entries: torch at 2.5.0 or newer, torchvision, numpy pinned below 2, opencv-python, timm, scipy, scikit-image, kornia, einops, tqdm, prettytable, tabulate, ipykernel, huggingface-hub above 0.25, and accelerate. The presence of ipykernel says the intended entry point is a notebook, and the numpy upper bound is the one constraint in the list that will need revisiting as the ecosystem moves.

Editorial conclusion

BiRefNet fits someone who needs a foreground mask at high resolution today and is willing to choose between checkpoints rather than tune one model: the HR, matting and dynamic variants differ in training resolution and purpose. It does not fit a project that needs a pinned, versioned dependency, because the repository publishes one tag from May 2024 while the actual model history lives as dated entries in the readme, and the code carries no packaging metadata. Before building on it, check three things. Which resolution your inputs actually are, since each variant was trained at a stated one as recorded in the README's news entries. Whether the 3.45GB memory figure and 17 FPS rate quoted for a single RTX 4090 at 1024x1024 fit the hardware you have, and note that the README points to a model efficiency part in its model zoo section for more details. And which of the five dated variants you want, because the newest weights are hosted on a model hub under one author's account rather than in this repository.

Frequently asked questions

What is BiRefNet?

It is the official implementation of Bilateral Reference for High-Resolution Dichotomous Image Segmentation, published as CAAI AIR 2024, written by researchers at Nankai University, Northwestern Polytechnical University, the National University of Defense Technology, Aalto University, Shanghai AI Laboratory and the University of Trento.

Is BiRefNet open source?

The repository is MIT licensed, with a LICENSE file at its root, and the training and inference scripts are in the tree. The trained weights are not in the repository: they are published separately on Hugging Face under the maintainer's account, along with a demo Space.

How do I use BiRefNet?

Three Colab notebooks are linked at the top of the page, along with a Hugging Face Space demo and a screen-recorded fine-tuning tutorial published on YouTube and Bilibili. The repository ships inference.py, train.py and test.sh, and its requirements file needs PyTorch 2.5.0 or newer plus fourteen other packages.

What is the BiRefNet model?

A family of checkpoints released over time rather than one model: BiRefNet_lite-2K for inputs at 2560x1440, BiRefNet_HR and BiRefNet_HR-matting trained at 2048x2048, BiRefNet-matting for trimap-free matting, and BiRefNet_dynamic trained across a range from 256x256 to 2304x2304.

Official sources

  1. License: MIT
  2. Project website
  3. README
  4. Releases
  5. ZhengPeng7/BiRefNet on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/zhengpeng7-birefnet.svg)](https://hysenlabs.com/projects/zhengpeng7-birefnet)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/zhengpeng7-birefnet.svg)](https://hysenlabs.com/projects/zhengpeng7-birefnet)

Was this useful?