Instructions to use LibreYOLO/LibreBEN2b-matte with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- BEN2
How to use LibreYOLO/LibreBEN2b-matte with BEN2:
import requests from PIL import Image from ben2 import AutoModel url = "https://huggingface.co/datasets/mishig/sample_images/resolve/main/teapot.jpg" image = Image.open(requests.get(url, stream=True).raw) model = AutoModel.from_pretrained("LibreYOLO/LibreBEN2b-matte") model.to("cuda").eval() foreground = model.inference(image) - Notebooks
- Google Colab
- Kaggle
LibreBEN2b-matte
BEN2 Base background removal, repackaged for LibreYOLO's matte task. It
predicts a soft alpha matte at a fixed native 1024x1024 resolution.
from libreyolo import LibreYOLO
model = LibreYOLO("LibreBEN2b-matte.pt")
result = model.predict("product.jpg")
result[0].matte.array # (H, W) float alpha in [0, 1]
result[0].save("cut.png") # transparent-background PNG
Source
Derived from PramaLLC/BEN2 at commit
2c99a5da477b5523585bfa5c893888a6e818a8f6, using the released checkpoint from
PramaLLC/BEN2 at revision
e48a20765fb421d19dcdb0bf3cc61e802ca5ec8f.
Copyright (c) 2025 Prama LLC. Licensed under the MIT License.
Training data provenance (upstream): DIS5K and Prama LLC's proprietary 22K segmentation dataset. This repository redistributes only the released MIT checkpoint and does not redistribute training data.
Modifications
State-dict metadata wrap only. Learned parameters are unchanged. The native
LibreYOLO fp32 forward matches the released BEN2 Base network with
max_abs_diff == 0 for batch sizes 1 and 2. See
weights/convert_ben2_weights.py in the
LibreYOLO source repository.
The port returns raw logits for LibreYOLO's shared matte postprocessing and does not include BEN2's optional media or foreground-refinement helpers.