alt.freeweights.vision / BiRefNet_lite
From: ZhengPeng7 <huggingface.co/ZhengPeng7>Newsgroups: alt.freeweights.visionSubject:

BiRefNet_lite

Date: 2026-11-15Commit: aa62cd8Signed: 2DC28CC7B26A283B ✓

Image segmentation model with 44M parameters. Safetensors weights, 178 MB in all. Published by ZhengPeng7 under MIT.

44M params178MBBiRefNet_litesafetensorspermissive
FactsParams44MSize178 MBFormatssafetensorsTaskimage segmentationLicenseMITFrom sourcepermissive
$ fw get ZhengPeng7/BiRefNet_lite
# manifest sha256 44ddf68413a5… · 178 MB · 8 files
$ fw verify ./BiRefNet_lite ZhengPeng7/BiRefNet_lite
From sourceHosted (signed)ZhengPeng7/BiRefNet_liteLast check: 2026-11-15 02:35 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Works with

Runs with

Ranked by fit to this model (safetensors), then by GitHub stars.

Overview

Size
178 MB
Weights
178 MB (safetensors)
Parameters
44M
Formats
safetensors
Task
image segmentation
License
MIT (permissive)
Files
8, each with a sha256
Publisher
ZhengPeng7
Added
2026-11-15
Section
alt.freeweights.vision
Lineage

Original release from the publisher.

Where these bytes come from
Publisher at the pinned commit→You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-15 02:35 UTCpassed

Model card

From the publisher at commit aa62cd8. Shown as plain text with links; images open at the publisher.

Bilateral Reference for High-Resolution Dichotomous Image Segmentation#

Peng Zheng 1,4,5,6,&thinsp; Dehong Gao 2,&thinsp; Deng-Ping Fan 1*,&thinsp; Li Liu 3,&thinsp; Jorma Laaksonen 4,&thinsp; Wanli Ouyang 5,&thinsp; Nicu Sebe 6

1 Nankai University&ensp; 2 Northwestern Polytechnical University&ensp; 3 National University of Defense Technology&ensp; 4 Aalto University&ensp; 5 Shanghai AI Laboratory&ensp; 6 University of Trento&ensp;

https://arxiv.org/pdf/2401.03407&ensp; https://drive.google.com/file/d/1aBnJ_R9lbnC2dm8dqD0-pzP2Cu-U1Xpt/view?usp=drive_link&ensp; https://www.birefnet.top&ensp; https://drive.google.com/drive/folders/1s2Xe0cjq-2ctnJBR24563yMSCOu4CcxM&ensp; LICENSE&ensp; https://huggingface.co/spaces/ZhengPeng7/BiRefNet_demo&ensp; https://huggingface.co/ZhengPeng7/BiRefNet&ensp; https://colab.research.google.com/drive/14Dqg7oeBkFEtchaHLNpig2BcdkZEogba?usp=drive_link&ensp; https://colab.research.google.com/drive/1MaEiBfJ4xIaZZn0DqKrhydHB8X97hNXl#scrollTo=DJ4meUYjia6S&ensp;

DIS-Sample_1DIS-Sample_2
Image: imageImage: image

This repo is the official implementation of "Bilateral Reference for High-Resolution Dichotomous Image Segmentation" (___CAAI AIR 2024___).

Visit our GitHub repo: https://github.com/ZhengPeng7/BiRefNet for more details -- codes, docs, and model zoo!

How to use (this tiny version)#

0. Install Packages:#
pip install -qr https://raw.githubusercontent.com/ZhengPeng7/BiRefNet/main/requirements.txt
1. Load BiRefNet:#
Use codes + weights from HuggingFace#

Only use the weights on HuggingFace -- Pro: No need to download BiRefNet codes manually; Con: Codes on HuggingFace might not be latest version (I'll try to keep them always latest).

# Load BiRefNet with weights
from transformers import AutoModelForImageSegmentation
birefnet = AutoModelForImageSegmentation.from_pretrained('zhengpeng7/BiRefNet_lite', trust_remote_code=True)
Use codes from GitHub + weights from HuggingFace#

Only use the weights on HuggingFace -- Pro: codes are always the latest; Con: Need to clone the BiRefNet repo from my GitHub.

# Download codes
git clone https://github.com/ZhengPeng7/BiRefNet.git
cd BiRefNet
# Use codes locally
from models.birefnet import BiRefNet

# Load weights from Hugging Face Models
### >>> Remember to set the `bb` in `config.py` as `swin_v1_t` to use this tiny version. <<< ###
birefnet = BiRefNet.from_pretrained('zhengpeng7/BiRefNet_lite')
Use codes from GitHub + weights from local space#

Only use the weights and codes both locally.

# Use codes and weights locally
### >>> Remember to set the `bb` in `config.py` as `swin_v1_t` to use this tiny version. <<< ###
import torch
from utils import check_state_dict

birefnet = BiRefNet(bb_pretrained=False)
state_dict = torch.load(PATH_TO_WEIGHT, map_location='cpu')
state_dict = check_state_dict(state_dict)
birefnet.load_state_dict(state_dict)
Use the loaded BiRefNet for inference#
# Imports
from PIL import Image
import matplotlib.pyplot as plt
import torch
from torchvision import transforms
from models.birefnet import BiRefNet

birefnet = ... # -- BiRefNet should be loaded with codes above, either way.
torch.set_float32_matmul_precision(['high', 'highest'][0])
birefnet.to('cuda')
birefnet.eval()
birefnet.half()

def extract_object(birefnet, imagepath):
    # Data settings
    image_size = (1024, 1024)
    transform_image = transforms.Compose([
        transforms.Resize(image_size),
        transforms.ToTensor(),
        transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
    ])

    image = Image.open(imagepath)
    input_images = transform_image(image).unsqueeze(0).to('cuda').half()

    # Prediction
    with torch.no_grad():
        preds = birefnet(input_images)[-1].sigmoid().cpu()
    pred = preds[0].squeeze()
    pred_pil = transforms.ToPILImage()(pred)
    mask = pred_pil.resize(image.size)
    image.putalpha(mask)
    return image, mask

# Visualization
plt.axis("off")
plt.imshow(extract_object(birefnet, imagepath='PATH-TO-YOUR_IMAGE.jpg')[0])
plt.show()

This BiRefNet for standard dichotomous image segmentation (DIS) is trained on DIS-TR and validated on DIS-TEs and DIS-VD.

This repo holds the official model weights of "Bilateral Reference for High-Resolution Dichotomous Image Segmentation" (CAAI AIR 2024).#

This repo contains the weights of BiRefNet proposed in our paper, which has achieved the SOTA performance on three tasks (DIS, HRSOD, and COD).

Go to my GitHub page for BiRefNet codes and the latest updates: https://github.com/ZhengPeng7/BiRefNet :)

Try our online demos for inference:#

Image: image

Acknowledgement:#

  • Many thanks to @fal for their generous support on GPU resources for training better BiRefNet models.
  • Many thanks to @not-lain for his help on the better deployment of our BiRefNet model on HuggingFace.

Citation#

@article{zheng2024birefnet,
  title={Bilateral Reference for High-Resolution Dichotomous Image Segmentation},
  author={Zheng, Peng and Gao, Dehong and Fan, Deng-Ping and Liu, Li and Laaksonen, Jorma and Ouyang, Wanli and Sebe, Nicu},
  journal={CAAI Artificial Intelligence Research},
  volume = {3},
  pages = {9150038},
  year={2024}
}

Files

8 files · 178 MBWeights 178 MB (safetensors). Sizes and sha256 from the signed manifest.
Hide all 8 files with their sha256
FileSizesha256
.gitattributes1.52 KB11ad7efa24975ee4b0c3c3a38ed18737f0658a5f75a0a96787b576a78a023361
BiRefNet_config.py298 Be7b8c2a74f6cea6a59553d517f71d47f2c1d90e670a13416af17c25fe2f3dc52
README.md8.73 KB22fe432bdd706e8079ee1c53dcd6192962291d023c84d5416df3c983f6e665a2
birefnet.py92.1 KBaf8568b5be406bf4d2a68a7ed6d72e40f73b37a1fb6fc9ebd71b5b3cbcd069c9
config.json410 B9dc8614fccddd40c601aeadc69b9db6dd820598179b2a2198492e6ffa016a824
handler.py4.71 KB15630ff8225d2d343ca3f7c0a9ef688ce0335d87a3255ae5a7903a16b147259f
model.safetensors178 MB4417d89795250e698c3cb0ae8df15743810065f646f48a694fdfa7ca052d0815
requirements.txt149 Bbdfdd83a090d31a2acf64f7350653fa63cd8b5d9d6e0ff3e135bea7ce3786341
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
aa62cd87ea pinned now2026-11-15 02:35 UTC8 files · 178 MB

Use it

$ fw get ZhengPeng7/BiRefNet_lite
# manifest sha256 44ddf68413a5… · 178 MB · 8 files
$ fw verify ./BiRefNet_lite ZhengPeng7/BiRefNet_lite
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/ZhengPeng7/BiRefNet_lite.json --dir ./BiRefNet_lite $ python3 fw.py verify ./BiRefNet_lite ./ZhengPeng7__BiRefNet_lite.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download ZhengPeng7/BiRefNet_lite --revision aa62cd87eafb9cc43056d08ef3615a14628b831d --local-dir ./BiRefNet_lite

License

Name
MIT License
Id
MIT
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-15
Text in
README.md
Text sha256
22fe432bdd706e8079ee1c53dcd6192962291d023c84d5416df3c983f6e665a2
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: ZhengPeng7 <huggingface.co/ZhengPeng7>Newsgroups: alt.freeweights.visionSubject: BiRefNet_liteDate: 2026-11-15Commit: aa62cd8Signed: 2DC28CC7B26A283B ✓
Upstream
ZhengPeng7/BiRefNet_lite
Pinned commit
aa62cd87eafb9cc43056d08ef3615a14628b831d
Manifest
BiRefNet_lite.json · .minisig
Manifest sha256
44ddf68413a5e053d466a67f1251a826b1ba3126ccfedbdb35da44cfe07b39fc
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-15 02:35 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/ZhengPeng7/BiRefNet_lite.json $ curl -O https://freeweights.allternit.com/manifests/ZhengPeng7/BiRefNet_lite.json.minisig $ minisign -Vm BiRefNet_lite.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

1 model in the catalog name this one as their parent.

Quantizations
1
Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download ZhengPeng7/BiRefNet_lite
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. BiRefNet_lite.json. Provenance. Takedown history: none.

Variants

1 quantized or adapter build of BiRefNet_lite. Each has its own license check and page.

From: dima806 <huggingface.co/dima806>Subject: ai_vs_real_image_detection
From: legekka <huggingface.co/legekka>Subject: AI-Anime-Image-Detector-ViT
From: onnx-community <huggingface.co/onnx-community>Subject: AI-Anime-Image-Detector-ViT-ONNX
From: AICodexLab <huggingface.co/AICodexLab>Subject: answerdotai-ModernBERT-base-ai-detector
From: onnx-community <huggingface.co/onnx-community>Subject: answerdotai-ModernBERT-base-ai-detector-ONNX
From: onnx-community <huggingface.co/onnx-community>Subject: bart-large-cnn-ONNX