Instructions to use feyninc/FeyNobg with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- nobg
How to use feyninc/FeyNobg with nobg:
pip install nobg
import torch from loadimg import load_img from nobg import AutoModel, AutoProcessor model = AutoModel.from_pretrained("feyninc/FeyNobg").eval() processor = AutoProcessor.from_pretrained("feyninc/FeyNobg") image = load_img("input.jpg").convert("RGB") inputs = processor(image, return_tensors="pt") with torch.no_grad(): outputs = model(pixel_values=inputs["pixel_values"]) alpha = processor.post_process_alpha_matting(outputs, target_sizes=[(image.height, image.width)])[0] processor.cutout(image, alpha).save("output.png") - Notebooks
- Google Colab
- Kaggle
Push model using huggingface_hub.
Browse files- README.md +50 -0
- config.json +26 -0
- model.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: nobg
|
| 3 |
+
tags:
|
| 4 |
+
- birefnet
|
| 5 |
+
- model_hub_mixin
|
| 6 |
+
- nobg
|
| 7 |
+
- pytorch_model_hub_mixin
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
<p align="center">
|
| 11 |
+
<img src="https://usefeyn.com/feyn/feyn_mark.svg"/>
|
| 12 |
+
</p>
|
| 13 |
+
|
| 14 |
+
This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration.
|
| 15 |
+
|
| 16 |
+
Library: [nobg](https://github.com/feyninc/nobg)
|
| 17 |
+
|
| 18 |
+
## how to load
|
| 19 |
+
```
|
| 20 |
+
pip install nobg
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
use the AutoModel class
|
| 24 |
+
```python
|
| 25 |
+
from nobg import AutoModel
|
| 26 |
+
model = AutoModel.from_pretrained("feyninc/FeyNobg")
|
| 27 |
+
```
|
| 28 |
+
or you can use the model class directly
|
| 29 |
+
```python
|
| 30 |
+
from nobg import BiRefNet
|
| 31 |
+
model = BiRefNet.from_pretrained("feyninc/FeyNobg")
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
## Citation
|
| 36 |
+
If you use this model, please cite:
|
| 37 |
+
```bibtex
|
| 38 |
+
@article{zheng2024birefnet,
|
| 39 |
+
title={Bilateral Reference for High-Resolution Dichotomous Image Segmentation},
|
| 40 |
+
author={Zheng, Peng and Gao, Dehong and Fan, Deng-Ping and Liu, Li and Laaksonen, Jorma and Ouyang, Wanli and Sebe, Nicu},
|
| 41 |
+
journal={CAAI Artificial Intelligence Research},
|
| 42 |
+
volume={3},
|
| 43 |
+
pages={9150038},
|
| 44 |
+
year={2024},
|
| 45 |
+
url={https://arxiv.org/abs/2401.03407},
|
| 46 |
+
}
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
## Contributions
|
| 50 |
+
Any contributions are welcome at https://github.com/feyninc/nobg
|
config.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"dec_channels_inter": 64,
|
| 3 |
+
"depths": [
|
| 4 |
+
2,
|
| 5 |
+
2,
|
| 6 |
+
24,
|
| 7 |
+
2
|
| 8 |
+
],
|
| 9 |
+
"drop_path_rate": 0.2,
|
| 10 |
+
"embed_dim": 192,
|
| 11 |
+
"image_size": 1024,
|
| 12 |
+
"mlp_ratio": 4.0,
|
| 13 |
+
"nobg_version": "0.2.0",
|
| 14 |
+
"num_heads": [
|
| 15 |
+
6,
|
| 16 |
+
12,
|
| 17 |
+
24,
|
| 18 |
+
48
|
| 19 |
+
],
|
| 20 |
+
"num_layers": 4,
|
| 21 |
+
"patch_size": 4,
|
| 22 |
+
"use_gradient_attention": true,
|
| 23 |
+
"use_image_patch_injection": true,
|
| 24 |
+
"use_multi_scale_input": true,
|
| 25 |
+
"window_size": 12
|
| 26 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7ee181389acf07c6dcf3d72caba2d169224caacdde8bb837ecf7aa3e22e0c3aa
|
| 3 |
+
size 1051353168
|