Repository navigation
Opt-in neural cut-out: remove_background {neural} and reel cutout --neural (u2netp) - #86
Merged
Merged
Conversation
…eural (u2netp) Adds the u2netp salient-object model (Apache-2.0, 4.5 MB) to the model manifest with a pinned URL and SHA-256, and a CPU onnxruntime cut-out that needs no plain background. The colour cut-out stays the default; nothing downloads except setup-models. No new dependency (onnxruntime is already in requirements-reel). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017qYKdYke3ySSZS76W9Tp34
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017qYKdYke3ySSZS76W9Tp34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
An opt-in neural cut-out, beside the colour-based one (which stays the default):
remove_background {"neural": true}inimage_edit/ posterpreops.funkbox reel cutout photo.jpg -o out.png --neural.u2netpinreel/models.json(pinned URL, SHA-256, size, licence), installed withfunkbox reel setup-models --only u2netp. 4.5 MB, runs on the CPU.It needs no plain background, so it handles a product on a table or a busy wall.
build_product_pngtakesneural=True; the quality score still runs and reportsmethod: "neural".Why
From the repo scout (
claude/repo-scout-feature-plan-2026-11-29.md, item 1; idea from rembg, no rembg code or package used, and not its default bria-rmbg model).No new dependency, nothing downloads by itself
onnxruntimeis already inrequirements-reel.txt(depth, LaMa, MobileSAM). Onlysetup-modelsdownloads, as for the other models. Without the model the op stops with "needs the u2netp model: run funkbox reel setup-models --only u2netp"; the CLI exits 2 with the same message.Licence: please check before merge
danielgatis/rembgreleasev0.0.0, MIT). I downloaded it: 4,574,861 bytes, SHA-256309c8469...ddd8, MD58e83ca70e441ab06c318d82300c84806(matches the value rembg lists).models.jsonsays "upstream weight provenance not re-verified", the same caveat the LaMa and MobileSAM entries already carry.Limits
The model sees a 320 px picture, so edges are soft on large photos. A saliency model picks "the main subject"; with several objects it may keep or drop the wrong one. Colour cut-out remains better for clean studio shots.
Tests
tests/stills/test_neural_cutout.pyuses a fake model session (preprocess shape, alpha stretch and resize, flat map, edit op, bool check, unknown keys, missing-model message, CLI flag and exit code, manifest has hash/licence/no bria). One test runs the real model and is skipped without it; it passed locally (real model, bright square on a dark scene).test_r7_cli_mcpupdated for the new manifest key. The full suite is left to CI.Not included
No change to the hosted repo.
Generated by Claude Code