Nodes/tri3d-comfyui-nodes/Levindabhi Cloth Seg v5.1.0
ComfyUI Node

Levindabhi Cloth Seg v5.1.0

Garment parsing, but you must bring the model file

By TRI3D-LC·Created 3 years ago·Updated about a year ago· 27
Levindabhi Cloth Seg v5.1.0
  • images
  • IMAGE

Levindabhi Cloth Seg is the pack's garment parser: it takes clothing images and outputs segmentation masks that split the garment into parts - upper body, lower body, full body - using the LeviNabhi cloth-segmentation model (a U-2-Net-style network with a 4-class palette). If you're building a try-on pipeline, this is how you get the garment's parts as clean regions: which part of the fabric is the top, which is the bottom, where the whole-piece boundary sits.

The mechanism is worth understanding because it's not an in-process model - it's a subprocess. The node writes your batch to custom_nodes/tri3d-comfyui-nodes/cloth-segmentation/input/, shells out to app.py with the Python interpreter path from your .env, waits for it to finish, and reads the resulting masks back from the output folder. That's the whole loop: write images, run external script, read masks. It works, but it means the node inherits every quirk of running a standalone script, including which Python it uses.

The install is the hard part

Standard pack install gets you most of the way:

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

But two things are not handled for you, and both will bite:

  1. The model file is missing. The repo ships cloth-segmentation/model/ex.txt - a placeholder that literally says "/*upload model */". You must place the cloth_segm.pth checkpoint into cloth-segmentation/model/ yourself. Without it, app.py prints "No checkpoints at given path" and the whole thing falls over. The gdown dependency in requirements.txt is a hint at how the author originally fetched it.
  2. You need a .env with COMFY_PYTHON_PATH. The node loads .env and runs whatever COMFY_PYTHON_PATH says (defaulting to python). If that Python doesn't have torch and the pack's deps, the subprocess dies. The repo's .env_sample shows the shape:
    COMFY_PYTHON_PATH=/path/to/your/comfy/python
    

Inputs and output

  • images - an IMAGE batch of garment shots. One input.
  • Output: one IMAGE, the segmentation mask image(s).

Gotchas

  • It uses the CWD-relative path custom_nodes/tri3d-comfyui-nodes/cloth-segmentation/, so it assumes ComfyUI was launched from its root directory. Launch ComfyUI from elsewhere and the paths silently break.
  • It's CPU+disk heavy by construction (writing and re-reading PNGs for every batch) and single-threaded through a subprocess. Fine for a few images, sluggish for hundreds.
  • The 4-class palette is the LeviNabhi convention - don't expect the exact same class numbering as another parser (ATR, SCHP). Know which index is which in this model's output before you wire downstream logic.

Honest verdict: it's the one node in the pack where "it's a model, just run it" falls apart. The segmentation itself is fine, but between the manual checkpoint drop and the .env interpreter dance, it has the highest setup cost of anything in this pack. If you only need garment parsing, a core-friendly alternative may be less fuss - but if you're already all-in on this pipeline, the model works well once you feed it what it's missing.

CategoryTRI3D

Inputs (1)

NameTypeDefaultDescription
imagesIMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE