--- license: mit library_name: libreyolo pipeline_tag: image-segmentation tags: - background-removal - matte - dichotomous-image-segmentation - ben2 - libreyolo --- # LibreBEN2b-matte BEN2 Base background removal, repackaged for LibreYOLO's `matte` task. It predicts a soft alpha matte at a fixed native 1024x1024 resolution. ```python 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](https://github.com/PramaLLC/BEN2) at commit `2c99a5da477b5523585bfa5c893888a6e818a8f6`, using the released checkpoint from [PramaLLC/BEN2](https://huggingface.co/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](https://github.com/LibreYOLO/libreyolo). The port returns raw logits for LibreYOLO's shared matte postprocessing and does not include BEN2's optional media or foreground-refinement helpers. ## License MIT License. See the [`LICENSE`](./LICENSE) and [`NOTICE`](./NOTICE) files.