Instructions to use LibreYOLO/LibreBiRefNetl-matte with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- BiRefNet
How to use LibreYOLO/LibreBiRefNetl-matte with BiRefNet:
# Option 1: use with transformers from transformers import AutoModelForImageSegmentation birefnet = AutoModelForImageSegmentation.from_pretrained("LibreYOLO/LibreBiRefNetl-matte", trust_remote_code=True)# Option 2: use with BiRefNet # Install from https://github.com/ZhengPeng7/BiRefNet from models.birefnet import BiRefNet model = BiRefNet.from_pretrained("LibreYOLO/LibreBiRefNetl-matte") - Notebooks
- Google Colab
- Kaggle
license: mit
library_name: libreyolo
pipeline_tag: image-segmentation
tags:
- background-removal
- matte
- dichotomous-image-segmentation
- birefnet
- libreyolo
LibreBiRefNetl-matte
BiRefNet background removal (BiRefNet general (Swin-L tier), the quality default), repackaged for LibreYOLO's
matte task. Predicts a soft alpha matte at a fixed native 1024x1024.
from libreyolo import LibreYOLO
m = LibreYOLO("LibreBiRefNetl-matte.pt")
res = m.predict("product.jpg")
res[0].matte # (H, W) float alpha in [0, 1]
res[0].save("cut.png") # transparent-background PNG
Source
Derived from ZhengPeng7/BiRefNet at commit d83f355. Copyright (c) 2024 ZhengPeng (Peng Zheng). Licensed under the MIT License.
Backbone: Swin Transformer v1 (Swin-L). Training data provenance (upstream): the BiRefNet DIS/General checkpoints are trained on dichotomous-image-segmentation datasets (e.g. DIS5K) under their own academic terms; this repo hosts the author's released weights and does not redistribute training data.
Modifications
State-dict key remapping only (metadata-wrap into the LibreYOLO v1.0 checkpoint
schema). Learned parameters are unchanged. Our fp32 forward matches the upstream
released weights with max_abs_diff == 0. See
weights/convert_birefnet_weights.py in the
LibreYOLO source repository.