Nodes/ComfyUI_LayerStyle_Advance/LayerMask: Human Parts Ultra(Advance)
ComfyUI Node Runs on cloud

LayerMask: Human Parts Ultra(Advance)

Human Parts Ultra — mask a specific body part, not just 'person'

By chflame163·Created 2 years ago·Updated 4 months ago· 696
LayerMask: Human Parts Ultra(Advance)
  • image
  • image
  • mask
facefalse
hairfalse
glassesfalse
top_clothesfalse
bottom_clothesfalse
torso_skinfalse
left_armfalse
right_armfalse
left_legfalse
right_legfalse
left_footfalse
right_footfalse
detail_method
detail_erode8
detail_dilate6
black_point0.01
white_point0.99
process_detailtrue
device
max_megapixels2.0

This one's more granular than PersonMaskUltra. Where that node splits a person into broad categories (face, hair, body, clothes), Human Parts Ultra gives you individual limbs and clothing zones: top clothes, bottom clothes, torso skin, glasses, and each arm/leg/foot separately, left and right. It's a ComfyUI wrapper (with the pack's usual ultra-fine edge processing bolted on top) around metal3d's ComfyUI_Human_Parts project, itself built on a DeepLabV3+ human-parsing model. If you need to isolate "just the left arm" or "everything except the shoes" for a targeted edit or inpaint, this is the node built for that - SAM with a text prompt can sort of get there, but this is purpose-built and doesn't require you to phrase what you want as a search query.

The category toggles are all booleans: face, hair, glasses, top_clothes, bottom_clothes, torso_skin, left_arm, right_arm, left_leg, right_leg, left_foot, right_foot. Flip on whichever combination you need - they all default to off, so you're building the mask up from nothing rather than pruning it down. The edge-refinement inputs are the same family shared across this pack's masking nodes: detail_method (VITMatte for the sharpest edges, PyMatting/GuidedFilter as lighter alternatives), detail_erode/detail_dilate to shrink or expand the mask boundary, black_point/white_point for edge sampling thresholds, process_detail to skip refinement entirely if you just want speed, and max_megapixels to cap how large an image the VITMatte pass handles at full resolution. Outputs are image and mask, ready to drop into an inpaint or compositing chain.

Install through ComfyUI Manager (search "ComfyUI Layer Style Advance") or git clone https://github.com/chflame163/ComfyUI_LayerStyle_Advance into custom_nodes/, restart, and run the requirements installer for your ComfyUI setup. The model file is the DeepLabV3+ human-parsing ONNX model - download it from the author's Baidu link or from huggingface.co/Metal3d/deeplabv3p-resnet50-human and put it in ComfyUI/models/onnx/human-parts. If you're using VITMatte for edge detail, that's a separate model that goes in ComfyUI/models/vitmatte.

Because the detection model runs as ONNX, the most likely install-time failure here is on the onnxruntime side rather than transformers: if you see an error along the lines of CUDA_PATH is set but CUDA wasn't able to be loaded, that's a broken onnxruntime install rather than a missing model - the fix is to reinstall the onnxruntime (or onnxruntime-gpu) package cleanly rather than chasing your CUDA toolkit version. Beyond that, the standard pack-wide trouble applies: a guidedFilter import error from cv2.ximgproc means a bad opencv-contrib-python install (run repair_dependency.bat), and if edge detail on a big batch is crawling, dropping max_megapixels or switching off process_detail for a quick pass is the practical fix rather than fighting VRAM.

One thing worth deciding up front: how many toggles to flip at once. It's tempting to turn on everything and let a downstream node sort it out, but each additional category adds to the mask the edge-refinement pass has to clean up, and a mask spanning disconnected regions (say, both feet plus the face) refines worse than a single contiguous area does. If you're chaining this into an inpaint, it's usually cleaner to run it once per body part you're actually targeting rather than trying to grab everything in one pass - slightly more nodes in the graph, noticeably better edges on the result.

Category😺dzNodes/LayerMask

Inputs (21)

NameTypeDefaultDescription
imageIMAGE
faceBOOLEANfalse
hairBOOLEANfalse
glassesBOOLEANfalse
top_clothesBOOLEANfalse
bottom_clothesBOOLEANfalse
torso_skinBOOLEANfalse
left_armBOOLEANfalse
right_armBOOLEANfalse
left_legBOOLEANfalse
right_legBOOLEANfalse
left_footBOOLEANfalse
right_footBOOLEANfalse
detail_methodCOMBO5 options: VITMatte, VITMatte(local), vitmatte-base-composition-1k, PyMatting, GuidedFilter
detail_erodeINT81–255
detail_dilateINT61–255
black_pointFLOAT0.010.01–0.98
white_pointFLOAT0.990.02–0.99
process_detailBOOLEANtrue
deviceCOMBO2 options: cuda, cpu
max_megapixelsFLOAT2.01–999

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK