Nodes/ComfyUI-RvTools_v2/BiRefNet Model Switch
ComfyUI Node

BiRefNet Model Switch

Swap background-removal models mid-graph

By r-vage·Created about a year ago·Updated 5 months ago· 23
BiRefNet Model Switch
  • input1
  • input2
  • birefnet_model
Input1

If you've done any background removal in ComfyUI since 2025, you know BiRefNet: the segmentation model that displaced rembg's u2net as the default cutout, MIT-licensed and eventually shipped inside ComfyUI itself. BiRefNet Model Switch is the RvTools two-way switch specialized for it - Input 1 or 2 routes either input1 or input2, both of type BIREFNET_MODEL, out through a single port. It exists so you can keep two BiRefNet variants loaded (say, the fast general-lite and the heavy BiRefNet_HR for big images) and flip between them without reloading or rewiring.

How it works

The BIREFNET_MODEL type is whatever the ComfyUI-BiRefNet node pack uses to pass loaded models around - a pointer to a loaded BiRefNet model, produced by that pack's model loader nodes. This switch just shuttles the reference: if Input == 1: return (input1,) else: return (input2,). No inference happens here; the actual cutout happens in the downstream BiRefNet apply/remove-background node that consumes the model you route to it.

The inputs that matter

  • Input - 1 or 2, which loaded model wins.
  • input1, input2 - wire two loaded BIREFNET_MODELs in.

Output birefnet_model feeds straight into the BiRefNet pack's background-removal node.

Why you'd bother

BiRefNet quality is a resolution story as much as a model story: the general 1024 model is the default, but anything above roughly 1500px is where BiRefNet_HR (2048) earns its keep, and the lite tier exists for constrained hardware. A single workflow that handles both a small preview path and a final full-res path can keep both loaded and switch - this node is the swap point. It also inherits the pack's bypass behavior: bypass the switch and input 1 flows straight through, so you can default to the lite model and let a group bypass decide when the HR model takes over.

Installing

cd ComfyUI/custom_nodes
git clone https://github.com/r-vage/ComfyUI-RvTools_v2

Restart ComfyUI or install via ComfyUI Manager (search "ComfyUI-RvTools_v2"). One thing this pack does not give you is the models - you also need the ComfyUI-BiRefNet custom node pack installed to actually load and run BiRefNet, and its weight files are downloaded separately (several hundred MB depending on variant). The switch alone is useless without that pack, so install both.

Gotchas

Because BIREFNET_MODEL isn't a ComfyUI core type, the sockets only render correctly when the BiRefNet pack that defines the type is installed - install order matters. And the standing caveats: RvTools v2 is deprecated in favor of ComfyUI_Eclipse, and workflows from the dead v1 RvTools repo reference node names Manager can't install anymore. For a brand-new background-removal setup, honestly, check whether ComfyUI's native BiRefNet support already covers your use case before adding this switch to the mix.

Category🫦 RvTools II/ Switches

Inputs (3)

NameTypeDefaultDescription
InputINT11–2
input1optBIREFNET_MODEL
input2optBIREFNET_MODEL

Outputs (1)

NameTypeDescription
birefnet_modelBIREFNET_MODEL