Conversation
RMBG-2.0 produces noticeably cleaner masks than 1.4. It is not pipeline-compatible, so the function now drives AutoModelForImageSegmentation directly with the documented preprocessing/sigmoid/resize-mask flow. Added kornia as a runtime dependency (required by the model's trust_remote_code modeling file) and regenerated the example masks/poses. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe background removal feature is upgraded from Hugging Face pipelines to direct RMBG-2.0 model inference. A new cached model loader with device management is introduced, and the image processing pipeline shifts to manual torchvision preprocessing, torch-based inference, and PIL-based postprocessing to return RGBA images. Dependencies are updated to include ChangesBackground Removal Implementation Upgrade
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
Summary
briaai/RMBG-1.4(pipeline) withbriaai/RMBG-2.0(AutoModelForImageSegmentation+ manual transforms / sigmoid / mask resize, since RMBG-2.0 is not pipeline-compatible).korniaas a runtime dependency (required by the RMBG-2.0 trust-remote-code modeling file).assets/examples/{amit,flux,stock}/masked.pngandpose.posewith the new model.Test plan
python -m human_avatar.image_to_avatarend-to-end and visually inspect the regenerated masks.pip install -e .resolves cleanly with the newkorniadep.🤖 Generated with Claude Code
Note
Medium Risk
Moderate risk because it changes the core background-removal pipeline and introduces a new runtime dependency plus
trust_remote_codemodel loading, which can affect output quality and runtime/environment compatibility.Overview
Switches background removal from a Hugging Face
pipeline(RMBG-1.4) to directAutoModelForImageSegmentationinference with cached model loading, explicit preprocessing (Resize/Normalize), sigmoid mask generation, and alpha compositing.Updates runtime dependencies by adding
korniato support the RMBG-2.0trust_remote_codemodel implementation.Reviewed by Cursor Bugbot for commit 29a5cca. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit