rembg
rembg copied to clipboard
[FEATURE] Select Model
Can you maybe add a new flag to select the model that should be used? And could you possibly also update the U-2 Models?
Right now there's nothing explained about how to use different models, and I can't even find the .2unet directory
I managed to do this by doing the following
from rembg.session_factory import new_session
from rembg import remove
# for the small model
remove(input, session=new_session("u2netp"))
I'm assuming you can just put in u2net_human_seg or u2net_cloth_seg for the other models
I managed to do this by doing the following
from rembg.session_factory import new_session from rembg import remove # for the small model remove(input, session=new_session("u2netp"))I'm assuming you can just put in
u2net_human_segoru2net_cloth_segfor the other models
and with the cli?
try this ;)
rembg i --help
$ rembg i --help
Usage: rembg i [OPTIONS] INPUT OUTPUT
for a file as input
Options:
-m, --model [u2net|u2netp|u2net_human_seg|u2net_cloth_seg]
model name [default: u2net]
-a, --alpha-matting use alpha matting [default: False]
-af, --alpha-matting-foreground-threshold INTEGER
trimap fg threshold [default: 240]
-ab, --alpha-matting-background-threshold INTEGER
trimap bg threshold [default: 10]
-ae, --alpha-matting-erode-size INTEGER
erode size [default: 10]
-om, --only-mask output only the mask [default: False]
-ppm, --post-process-mask post process the mask [default: False]
--help Show this message and exit.
Were you able to change the model? I've tried -m and --model followed by the model name, but with no luck. Idk if it's a bug, but this needs to be streamlined better. And my newly added onnx files do not show up in the help menu either. I feel like they should. Anyway, if any of you know how to, it'd be great.