Nodes/ComfyUI-YCYY-InSPyReNet/Inspyrenet Rembg Advanced
ComfyUI Node

Inspyrenet Rembg Advanced

The InSPyReNet cutout that does more

By ycyy·Created 2 years ago·Updated 2 years ago· 3
Inspyrenet Rembg Advanced
  • image
  • IMAGE
  • RGBB
  • RGBW
  • MASK
model_nameckpt_base.pth
threshold0.50
torchscript_jit

The Advanced version of the same cutout node, and the one you reach for once "remove background" stops being enough. Where the basic YCYY-InspyrenetRembg is one fixed model and two inputs, YCYY-InspyrenetRembgAdvanced hands you all three InSPyReNet checkpoints, an alpha cutoff you can tune, and - the headline - RGB outputs composited onto black and white backgrounds, with no alpha channel in sight.

Those RGB outputs matter more than they look. RGBA is great until it isn't: it survives a PNG save, but plenty of downstream ComfyUI paths - video nodes, some upscalers, previews that render a grey checkerboard - either drop the alpha or make it impossible to judge the cut. Flattened RGB means you can composite onto a studio backdrop without babysitting alpha at all, or just preview the cutout against white instead of a checkerboard. That checkerboard is the classic trap: an edge that looks clean against grey falls apart against white. The white-background output shows you the truth immediately, and the black one shows you where the edge actually stops. Both are added by the pack itself, no extra nodes needed.

Mechanism is the same family as the basic node: a thin wrapper over plemeri's transparent-background library, running InSPyReNet's image-pyramid saliency - strict pyramid of saliency maps, low-res and high-res scales blended, which is what keeps hair and fine edges intact. The node re-instantiates the Remover on every execution, so expect a load-time stall at the start of each run. That's the wrapper, not your GPU.

Inputs and outputs

Four inputs:

  • image - any IMAGE tensor, single or batch.
  • model_name - ckpt_base.pth (default, the best-quality weights), ckpt_fast.pth (lighter and quicker, edges slightly softer), or ckpt_base_nightly.pth (a newer nightly build of the base - least battle-tested of the three). You have to download whichever you pick; the node never fetches weights.
  • threshold - float from 0 to 1, default 0.5. The cutoff for what counts as foreground. Nudge it up if background is bleeding through, down if it's clipping bits of your subject.
  • torchscript_jit - default or on; the same TorchScript speed trick as the basic node. Worth on for batch work.

Outputs:

  • IMAGE - the full RGBA cutout.
  • RGBB - the cutout composited onto black.
  • RGBW - the cutout composited onto white. Preview this one.
  • MASK - the alpha channel standalone, for inpainting or mask-based compositing.

This is also the node people wire into scripts - it's the variant that shows up in API workflow JSON, with threshold: 0.5 and torchscript_jit: "default", when you're running background removal headlessly.

Installing it

Same story as the basic node - same pack, one install. ComfyUI Manager: search "ComfyUI-YCYY-InSPyReNet" and install. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/ycyy/ComfyUI-YCYY-InSPyReNet.git
cd ComfyUI-YCYY-InSPyReNet
pip install -r requirements.txt

That installs transparent-background (with its torch-adjacent dependency stack - give it a minute). Then drop the model(s) into ComfyUI/models/transparent-background/:

# https://github.com/plemeri/transparent-background/releases/download/1.2.12/ckpt_base.pth
# https://github.com/plemeri/transparent-background/releases/download/1.2.12/ckpt_fast.pth
# https://github.com/plemeri/transparent-background/releases/download/1.2.12/ckpt_base_nightly.pth

Troubleshooting

  • Error that boils down to "ckpt not found" - if the model file you selected isn't present, the node prints ckpt not found and returns nothing, which ComfyUI treats as a failed node. Download the exact filename you picked into the exact folder.
  • RGBW and RGBB look different from the RGBA preview - that's expected, not a bug. They're flattened composites, so threshold changes (background bleed, clipped subject) show up here first.
  • Edges still not right - before you blame the model, this is the honest move: run InSPyReNet and BiRefNet side by side on your worst images. The two trade wins depending on the material, and no leaderboard settles it.
CategoryYCYY/image

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
model_nameCOMBOckpt_base.pth3 options: ckpt_base.pth, ckpt_fast.pth, ckpt_base_nightly.pth
thresholdFLOAT0.500–1
torchscript_jitCOMBO2 options: default, on

Outputs (4)

NameTypeDescription
IMAGEIMAGE
RGBBIMAGE
RGBWIMAGE
MASKMASK