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.

Downloads last month
43
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API: The HF Inference API does not support model that require custom code execution.