1

I'm using rembg's model to extract images. It uses the default model. However, I want to use Python code to specify other rembg models to extract images

Rembg prompts that rembg - m can be used, but I want to use python code

2 Answers2

1

#import new_session

from rembg.bg import remove, new_session

#create a new session by passing name of the model from one of the following

#["u2net", "u2netp", "u2net_human_seg", "u2net_cloth_seg", "silueta"]

my_session = new_session("u2net_human_seg")

#set session to your custom session

remove(frame, session=my_session)

Mayank
  • 11
  • 1
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 11 '23 at 00:58
1

Add -m + model name on the end of command.

For example: rembg p org new -m isnet-general-use.

bfontaine
  • 18,169
  • 13
  • 73
  • 107
Mark
  • 11
  • 1