From be319d3489fde273de5a3d6004f5751e858ec345 Mon Sep 17 00:00:00 2001 From: Nihir <31130127+nihirv@users.noreply.github.com> Date: Sat, 16 Dec 2023 15:12:26 +0000 Subject: [PATCH] Update USAGE.md (#553) --- USAGE.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/USAGE.md b/USAGE.md index 8881f4e7..fa44f35b 100644 --- a/USAGE.md +++ b/USAGE.md @@ -27,6 +27,16 @@ session = new_session(model_name) output = remove(input, session=session) ``` +### For processing multiple image files +By default, `remove` initialises a new session every call. This can be a large bottleneck if you're having to process multiple images. Initialise a session and pass it in to the `remove` function for fast multi-image support +```python +model_name = "unet" +rembg_session = new_session(model_name) +for img in images: + output = remove(img, session=rembg_session) +``` + + ### With alpha metting Alpha metting is a post processing step that can be used to improve the quality of the output. ```python