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
Initial upload: LibreBiRefNetl-matte (BiRefNet, MIT)
Browse files- .gitattributes +1 -35
- LICENSE +21 -0
- LibreBiRefNetl-matte.pt +3 -0
- NOTICE +10 -0
- README.md +49 -0
.gitattributes
CHANGED
|
@@ -1,35 +1 @@
|
|
| 1 |
-
*.
|
| 2 |
-
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
-
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 1 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2024 ZhengPeng
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
LibreBiRefNetl-matte.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8f5e9814e1702023d357cffd90bd8a500e5a34a3f73b0297e83167006dde72b9
|
| 3 |
+
size 885083867
|
NOTICE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
LibreBiRefNetl-matte weights
|
| 2 |
+
------------------------------------
|
| 3 |
+
|
| 4 |
+
This product contains weights derived from BiRefNet
|
| 5 |
+
(https://github.com/ZhengPeng7/BiRefNet).
|
| 6 |
+
Copyright (c) 2024 ZhengPeng (Peng Zheng).
|
| 7 |
+
Licensed under the MIT License.
|
| 8 |
+
|
| 9 |
+
Conversion is a state-dict metadata-wrap: learned parameters are unchanged.
|
| 10 |
+
See weights/convert_birefnet_weights.py in the LibreYOLO source repository.
|
README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: libreyolo
|
| 4 |
+
pipeline_tag: image-segmentation
|
| 5 |
+
tags:
|
| 6 |
+
- background-removal
|
| 7 |
+
- matte
|
| 8 |
+
- dichotomous-image-segmentation
|
| 9 |
+
- birefnet
|
| 10 |
+
- libreyolo
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# LibreBiRefNetl-matte
|
| 14 |
+
|
| 15 |
+
BiRefNet background removal (BiRefNet general (Swin-L tier), the quality default), repackaged for LibreYOLO's
|
| 16 |
+
`matte` task. Predicts a soft alpha matte at a fixed native 1024x1024.
|
| 17 |
+
|
| 18 |
+
```python
|
| 19 |
+
from libreyolo import LibreYOLO
|
| 20 |
+
|
| 21 |
+
m = LibreYOLO("LibreBiRefNetl-matte.pt")
|
| 22 |
+
res = m.predict("product.jpg")
|
| 23 |
+
res[0].matte # (H, W) float alpha in [0, 1]
|
| 24 |
+
res[0].save("cut.png") # transparent-background PNG
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
## Source
|
| 28 |
+
|
| 29 |
+
Derived from [ZhengPeng7/BiRefNet](https://github.com/ZhengPeng7/BiRefNet)
|
| 30 |
+
at commit d83f355.
|
| 31 |
+
Copyright (c) 2024 ZhengPeng (Peng Zheng). Licensed under the MIT License.
|
| 32 |
+
|
| 33 |
+
Backbone: Swin Transformer v1 (Swin-L).
|
| 34 |
+
Training data provenance (upstream): the BiRefNet DIS/General checkpoints are
|
| 35 |
+
trained on dichotomous-image-segmentation datasets (e.g. DIS5K) under their own
|
| 36 |
+
academic terms; this repo hosts the author's released weights and does not
|
| 37 |
+
redistribute training data.
|
| 38 |
+
|
| 39 |
+
## Modifications
|
| 40 |
+
|
| 41 |
+
State-dict key remapping only (metadata-wrap into the LibreYOLO v1.0 checkpoint
|
| 42 |
+
schema). Learned parameters are unchanged. Our fp32 forward matches the upstream
|
| 43 |
+
released weights with `max_abs_diff == 0`. See
|
| 44 |
+
`weights/convert_birefnet_weights.py` in the
|
| 45 |
+
[LibreYOLO source repository](https://github.com/LibreYOLO/libreyolo).
|
| 46 |
+
|
| 47 |
+
## License
|
| 48 |
+
|
| 49 |
+
MIT License. See the [`LICENSE`](./LICENSE) and [`NOTICE`](./NOTICE) files.
|