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 theout_name
preprocess_image
: original method created by briaaipostprocess_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.
- Downloads last month
- 6
Inference API (serverless) does not yet support model repos that contain custom code.