Nodes/tri3d-comfyui-nodes/Load AEMatter Model v5.1.0
ComfyUI Node

Load AEMatter Model v5.1.0

Image matting, with the weights fetched for you

By TRI3D-LC·Created 3 years ago·Updated about a year ago· 27
Load AEMatter Model v5.1.0
    • AEMatter_Model

    Load AEMatter Model is the loader half of a two-node matting setup. It returns a single AEMatter_Model object that you hand to the pack's tri3d-run_AEMatter_inference node, which does the actual work: taking an image plus a trimap (a rough three-region mask marking definitely-foreground, definitely-background, and unknown) and producing a refined alpha matte. AEMatter is a Swin-Transformer-based matting model - the checkpoint (AEM_RWA.ckpt) lives on Hugging Face under the Self-Correction-Human-Parsing project, and this loader's whole job is to get it loaded into memory once so inference can run on it.

    The notable thing: it self-installs. The loader computes the target path under ComfyUI's models/AEMatter/ directory, and if the checkpoint isn't there, it downloads it on the spot with wget and loads it. No manual model hunt, no "download this to the right folder" ritual - first time you drag the node in and run it, you get a download progress bar. That's a genuinely nicer experience than most matting setups.

    Inputs and output

    • No inputs at all - the node exists purely to hand you the model.
    • One output: AEMatter_Model, which feeds only into tri3d-run_AEMatter_inference. This is a custom type, not a standard tensor, so you can't wire it anywhere else.

    Install

    The pack installs like its siblings:

    cd ComfyUI/custom_nodes
    git clone https://github.com/TRI3D-LC/tri3d-comfyui-nodes
    # restart ComfyUI
    

    Or via ComfyUI Manager (search "tri3d"). Folder must stay tri3d-comfyui-nodes.

    Watch the dependencies. The pack's requirements.txt doesn't list einops or timm, but AEMatter.py imports both - they're assumed to be in your environment already (ComfyUI's core pulls einops; timm is the one you may lack). If the loader dies with a ModuleNotFoundError on timm, fix it once:

    pip install timm einops
    

    The first run also needs internet for the checkpoint download (a few hundred MB, exact size depends on the release). Offline boxes will fail at load until the file is present.

    Gotchas

    • It's a memory hog: a Swin-transformer matting model loaded at full precision stays resident once loaded. One loader node per workflow, reused by every inference node downstream, not one per image.
    • The download happens inside the loader, so a partial or failed download leaves a corrupt checkpoint that will keep erroring until you delete models/AEMatter/AEM_RWA.ckpt and retry. If inference starts failing after a flaky first download, nuke the file and let it re-fetch.
    • The checkpoint's licensing comes from the upstream Self-Correction-Human-Parsing project - fine for personal use, but check the upstream license before building a commercial product on it. (The background-removal landscape is crowded with exactly this kind of gotcha.)

    If your pipeline needs clean alpha mattes - hair, edges, semi-transparent fabric - this loader plus the inference node is the easiest AEMatter path in ComfyUI. Just budget the one-time download and the timm install.

    CategoryAEMatter

    Inputs (0)

    No inputs

    Outputs (1)

    NameTypeDescription
    AEMatter_ModelAEMatter_Model