File size: 1,269 Bytes
694e47c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
---
library_name: transformers
pipeline_tag: image-segmentation
---
# How to use
either load the model
```python
from transformers import AutoModelForImageSegmentation
model = AutoModelForImageSegmentation.from_pretrained("briaai/RMBG-1.4",revision ="refs/pr/9",trust_remote_code=True)
```
or load the pipeline
```python
from transformers import pipeline
pipe = pipeline("image-segmentation", model="briaai/RMBG-1.4",revision ="refs/pr/9", trust_remote_code=True)
numpy_mask = pipe("img_path") # outputs numpy mask
pipe("image_path",out_name="myout.png") # applies mask and saves the extracted image as `myout.png`
```
# parameters :
for the pipeline you can use the following parameters :
* `model_input_size` : default to [1024,1024]
* `out_name` : if specified it will use the numpy mask to extract the image and save it using the `out_name`
* `preprocess_image` : original method created by briaai
* `postprocess_image` : original method created by briaai
# disclamer
I do not own, distribute or take credit for this model.
All rights belong to [briaai](https://huggingface.co/briaai/)
This repo is a temporary one to test out the custom architecture for [RMBG-1.4](https://huggingface.co/briaai/RMBG-1.4), please do refer to the original model.
|