CustomCodeForRMBG / README.md
linxy97's picture
Duplicate from not-lain/CustomCodeForRMBG
694e47c verified
|
raw
history blame
1.27 kB
metadata
library_name: transformers
pipeline_tag: image-segmentation

How to use

either load the model

from transformers import AutoModelForImageSegmentation
model = AutoModelForImageSegmentation.from_pretrained("briaai/RMBG-1.4",revision ="refs/pr/9",trust_remote_code=True)

or load the pipeline

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

This repo is a temporary one to test out the custom architecture for RMBG-1.4, please do refer to the original model.