Load U-2-Net model by name
Load U-2-Net model by name — the old reliable, 26 MiB and unkillable
- model
- train_w
- train_h
- norm_params
Before BiRefNet, before InSPyReNet, there was U-2-Net - the salient-object network from a 2020 Pattern Recognition paper that became the default weight inside rembg and stayed there for years. This loader is a nostalgia trip that's still genuinely useful, because U-2-Net is the cheapest respectable cutter in the pack. The author's benchmark numbers: U-2-Net Base (u2net) at 147ms and 371MB of VRAM on a 3060, at a mere 320×320. The Small variant (u2netp) is 4.5 MiB. These things run on a toaster, and CPU inference is fine if your GPU is busy.
The dropdown has four entries:
U-2-Net Base (u2net)(169 MiB) - the historical default.U-2-Net Small (u2netp)(4.5 MiB) - the lightweight version. Edges get rougher; speed and memory get silly.U-2-Net Human F16(85 MiB) andU-2-Net Human(169 MiB) - theu2net_human_segweights, tuned for people.
Where it fits, honestly
U-2-Net's edge quality is acceptable and not exceptional - fine hair, veils, and glass have been its weak points since 2020 and nobody fixed them. The README's own framing is that choosing rembg's u2net path is choosing interface over quality ceiling. So this loader is for three situations: you want a quick, near-free cutout on CPU; you're on very old hardware; or you need the human-seg weights for a coarse people mask. For anything with a difficult edge, IS-Net (196ms, 776MB) is the same speed class with a big quality jump, and BiRefNet is the quality ceiling. This is the "good enough, always works" option, and that's a real job.
Inputs and outputs
model_name, device (AUTO), dtype (AUTO). Outputs: model (SET_REMBG) for the processing nodes, train_w/train_h (320×320 - note the small training resolution, which is why big inputs don't magically get better), and norm_params.
Install
Same as every node in this pack:
cd ComfyUI/custom_nodes
git clone https://github.com/set-soft/ComfyUI-RemoveBackground_SET
pip install -r ComfyUI-RemoveBackground_SET/requirements.txt
ComfyUI 0.3.48+, seconohe >= 1.0.6 (fresh copy via pip install git+https://github.com/set-soft/seconohe.git if it errors). Weights auto-download into ComfyUI/models/rembg.
The takeaway: this loader is the pack's "leave it loaded, it costs nothing" node. Keep a workflow with U-2-Net Small if you want instant previews while you iterate on a composition, then swap in BiRefNet for the final pass. A 4.5 MiB model that cuts in milliseconds and never OOMs is a tool you keep around even after you've outgrown it.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| model_name | COMBO | The name of the model, from the list of known models of this type | |
| device | COMBO | Device where the model will be run | |
| dtypeopt | COMBO | AUTO | Data type used for inference. `AUTO` means the same as the model on disk.Using a smaller size will save resources, but might degradate the results. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| model | SET_REMBG | The remove background model ready to be used in a processing node |
| train_w | INT | Width of the images used to train this model |
| train_h | INT | Height of the images used to train this model |
| norm_params | NORM_PARAMS | Normalization parameters for the input images. This is needed only for advanced use when you want to manually pre-process the images. The `Arbitrary Normalize` node from `Image Misc` can use these parameters to apply the correct normalization. |