Nodes/Remove Background (SET)/Load U-2-Net model by name
ComfyUI Node

Load U-2-Net model by name

Load U-2-Net model by name — the old reliable, 26 MiB and unkillable

By set-soft·Created about a year ago·Updated 9 months ago· 18
Load U-2-Net model by name
    • model
    • train_w
    • train_h
    • norm_params
    model_name
    device
    dtypeAUTO

    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) and U-2-Net Human (169 MiB) - the u2net_human_seg weights, 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.

    CategoryRemBG_SET/Load

    Inputs (3)

    NameTypeDefaultDescription
    model_nameCOMBOThe name of the model, from the list of known models of this type
    deviceCOMBODevice where the model will be run
    dtypeoptCOMBOAUTOData 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)

    NameTypeDescription
    modelSET_REMBGThe remove background model ready to be used in a processing node
    train_wINTWidth of the images used to train this model
    train_hINTHeight of the images used to train this model
    norm_paramsNORM_PARAMSNormalization 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.