Add BEN2 and BiRefNet-HR as selectable Remove Background models
BEN2 becomes the new default local backend (clean cutouts, strong on hair/fur edges), with BiRefNet-HR available as a high-res/print alternate and U2Net kept as the lightweight fallback. Both are MIT-licensed and download weights from HuggingFace on first use (cached via the existing hf_cache bind mount), unlike U2Net/SAM which need an explicit download script. - config: new BG_REMOVAL_MODEL setting (default "ben2") - tools.py: remove-background-base64 now tries local backends in order (request.model override > BG_REMOVAL_MODEL > ben2/u2net), falling back to rembg's birefnet-general session as a last resort - requirements.gpu.txt / Dockerfile.gpu: add ben2 + transformers deps needed for the new backends, with a build-time smoke test for ben2 - frontend: model dropdown in the Remove Background dialog, threaded through api.js to the new request field Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ro4PwQKvSc3CH19LSN21Ht
This commit is contained in:
@@ -171,6 +171,12 @@ AUTO_DOWNLOAD_SAM=true
|
||||
# When false: Skips download, Remove Background falls back to rembg (if installed)
|
||||
AUTO_DOWNLOAD_U2NET=true
|
||||
|
||||
# Background removal model (Remove Background tool) — used when request.model="auto"
|
||||
# Options: ben2 (default — best for clean cutouts, hair/edges), birefnet-hr
|
||||
# (best for high-res/print work, slower), u2net (lightweight, always-on fallback)
|
||||
# ben2 and birefnet-hr download weights from HuggingFace on first use (GPU image only).
|
||||
BG_REMOVAL_MODEL=ben2
|
||||
|
||||
# Allow users to select model per-edit
|
||||
ALLOW_MODEL_OVERRIDE=true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user