ComfyUI Node

Inspyrenet Rembg

InSPyReNet background removal in one node

By ycyy·Created 2 years ago·Updated 2 years ago· 3
Inspyrenet Rembg
  • image
  • IMAGE
  • MASK
torchscript_jit

Background removal looks solved until you hit a person with flyaway hair. That's the gap this node lives in. YCYY-InspyrenetRembg is the one-node path to InSPyReNet - the 2022 image-pyramid model that, years later, still wins head-to-heads against the default recommendation on exactly the cases everyone cares about: hair, fur, fine edges. It's the engine behind the highest-scoring background-removal workflow post of 2026, and the name keeps coming up in threads where people tried BiRefNet and still prefer the older model. So when your cutout comes back with the subject's hair turned into a solid helmet, this is the cheap way to hear the other side of the argument.

The node itself is thin, and that's a compliment. It comes from ycyy/ComfyUI-YCYY-InSPyReNet, a small pack that wraps plemeri's transparent-background library - the same engine the more famous ComfyUI-Inspyrenet-Rembg uses - and drops it into a single node. No API, no key, no account. Image in, RGBA cutout and mask out. There's a sibling node, Inspyrenet Rembg Advanced, that adds model switching and threshold control; this one is the dead-simple version, and it's a fine place to start.

How it works

InSPyReNet (Inverse Saliency Pyramid Reconstruction Network) takes a different route than most saliency models. Instead of one network at one resolution, it builds a strict pyramid of saliency maps and blends a low-resolution scale with a high-resolution one. That's how it gets clean, high-res boundaries without ever training on high-res data - and it's why the edges on hair hold up where u2net-style cutouts smear.

The node is a thin wrapper over transparent_background.Remover. It takes an IMAGE, loops over every frame in the batch, runs the remover, and stacks the results. Genuinely batch-friendly: feed it ten images and you get ten cutouts back.

Inputs and outputs

Two inputs, which is the point:

  • image - any IMAGE tensor, single or batched.
  • torchscript_jit - default or on. on compiles the model to TorchScript for faster inference. On a batch it usually pays off; on a single image the compile time can eat the savings. This is the setting people mean when they mention "torchscript on" as the speed trick.

Outputs:

  • IMAGE - the cutout as RGBA, ready for a compositor or a straight PNG save.
  • MASK - the alpha channel as a standalone mask, which is what you wire into inpainting or a mask-based composite.

One catch: this node hardcodes ckpt_base.pth. There's no model picker here - that's what the Advanced node is for. If you only downloaded the fast model, this node won't find it.

Installing it

Easiest way is ComfyUI Manager: search "ComfyUI-YCYY-InSPyReNet" (or just "Inspyrenet") and install. The pack is registered in the Comfy registry, so Manager handles the plumbing. By hand, it's the usual dance:

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

That requirements file is one line - transparent-background - and it brings its own torch-adjacent dependency stack, so the first install takes a minute. Then the model, which Manager will not fetch for you:

# place at: ComfyUI/models/transparent-background/ckpt_base.pth
# download: https://github.com/plemeri/transparent-background/releases/download/1.2.12/ckpt_base.pth

Restart ComfyUI. The filename has to be exactly ckpt_base.pth in models/transparent-background/ - the node builds that path itself and won't look anywhere else.

Troubleshooting

  • Node errors on the first run - the model isn't in ComfyUI/models/transparent-background/. Exact filename, exact folder; this is far and away the #1 failure.
  • Slow start to every run - the wrapper constructs the Remover on each execution, so you pay model-load time at the start of every run. That's the node, not a broken GPU.
  • Edges still rough on your worst images - try the Advanced node's threshold, or run BiRefNet for comparison. Nothing wins every material; the honest workflow runs both on your three hardest images and keeps whichever wins.
CategoryYCYY/image

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
torchscript_jitCOMBO2 options: default, on

Outputs (2)

NameTypeDescription
IMAGEIMAGE
MASKMASK