cozymantis / human-parser-comfyui-node

A ComfyUI node to automatically extract masks for body regions and clothing/fashion items. Made with 💚 by the CozyMantis squad.
https://cozymantis.gumroad.com
GNU General Public License v3.0
57 stars 4 forks source link
comfyui comfyui-nodes human-parsing human-part-segmentation image-segmentation segmentation

Cozy Human Parser

Fast, VRAM-light ComfyUI nodes to generate masks for specific body parts and clothes or fashion items. Runs on CPU and CUDA. Made with 💚 by the CozyMantis squad.

Original ATR LIP Pascal

Installation

Check below for Windows troubleshooting.

Examples

LIP Parser

['Background', 'Hat', 'Hair', 'Glove', 'Sunglasses' 'Upper-clothes', 'Dress', 'Coat', 'Socks', 'Pants', 'Jumpsuits', 'Scarf', 'Skirt', 'Face', 'Left-arm', 'Right-arm', 'Left-leg', 'Right-leg', 'Left-shoe', 'Right-shoe']

assets/lipexample.png

ATR Parser

['Background', 'Hat', 'Hair', 'Sunglasses', 'Upper-clothes', 'Skirt', 'Pants', 'Dress', 'Belt', 'Left-shoe', 'Right-shoe', 'Face', 'Left-leg', 'Right-leg', 'Left-arm', 'Right-arm', 'Bag', 'Scarf']

assets/atrexample.png

Pascal Parser

['Background', 'Head', 'Torso', 'Upper Arms', 'Lower Arms', 'Upper Legs', 'Lower Legs']

assets/pascalexample.png

Windows Troubleshooting

Windows can't find the "ninja.exe" file. The file is probably getting downloaded/installed to something like X:\path\to\comfy\python_embeded\lib\site-packages\ninja\data\bin, but it's not properly getting added to the system path, so the OS can't invoke it.

The solution is to:

Windows can't locate the python311.lib library. You need to search for it on your system, then add the library's parent directory to the "LIB" environment variable.

Windows can't locate "cl.exe" which is the compiler/linker tool: https://learn.microsoft.com/en-us/cpp/build/reference/compiler-options?view=msvc-170

You can start this tool only from a Visual Studio developer command prompt. You cannot start it from a system command prompt or from File Explorer. For more information, see Use the MSVC toolset from the command line.

First, make sure you've installed all of the things highlighted below:

image

Then, it looks like you'll need to start ComfyUI from the developer command prompt instead of the regular cmd. Here's docs on how to launch the dev command prompt: https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2022

You'll want to run something similar to:

cd X:\path\to\comfy
python main.py

Make sure you're running the "x64 Native Tools Command Prompt" instead of the x86 one. Type "x64" in the start menu to locate it.

image

Acknowledgements

Based on the excellent paper "Self-Correction for Human Parsing" by Li, Peike and Xu, Yunqiu and Wei, Yunchao and Yang, Yi, and their original code that we've updated to also run on CPUs.

@article{li2020self,
  title={Self-Correction for Human Parsing}, 
  author={Li, Peike and Xu, Yunqiu and Wei, Yunchao and Yang, Yi},
  journal={IEEE Transactions on Pattern Analysis and Machine Intelligence}, 
  year={2020},
  doi={10.1109/TPAMI.2020.3048039}}