Nodes/ComfyUI_KimNodes/🍒Image_Classification / 图像分类
ComfyUI Node

🍒Image_Classification / 图像分类

Image_Classification is really a string switch that picks a folder path

By wjl0313·Created 2 years ago·Updated 11 months ago· 54
🍒Image_Classification / 图像分类
    • output_path
    text_tag
    true_path/path/to/true_output
    false_path/path/to/false_output

    Let's get the naming out of the way, because it will trip you up: despite the name, Image_Classification does not look at an image at all. It's a text-to-path router. You hand it a string that is literally "true" or "false", and it returns one of two folder paths you configured. That's the entire node - maybe ten lines of Python.

    The reason it exists is the pack's broader classification workflow: pair it with a node that actually does judge an image - the README's own examples use WD14 taggers or YOLOWorld_Match - and use this node to route the result. If the match says the image contains what you asked, you get the true_path; if not, you get the false_path. Then a Save_Image-style node uses that path to file the image into the right folder. That's the classic "sort my generated images into good/bad buckets" pattern, automated.

    How it works

    Inputs: text_tag (a STRING that must equal "true" or "false" - case-insensitive), true_path, and false_path. It compares text_tag.lower() to "true": match → return true_path, otherwise → return false_path. Output is a single output_path STRING.

    That's it. There's no image tensor input, no model, no magic. If you wire an actual image into it, the input won't even exist - the only inputs are the three strings.

    The inputs that matter

    • text_tag - the verdict. Any string that isn't "true" (case-insensitive) goes to the false branch, including "True", "TRUE", or a stray whitespace - worth knowing, since tagger outputs aren't always tidy.
    • true_path / false_path - where to send each branch. Defaults are placeholder strings (/path/to/true_output), so set them or you'll be routing files to a path that doesn't exist.
    • output_path - the output; feed it into a save node that accepts a path string, or use it to drive a folder-based workflow.

    Installation

    Standard KimNodes pack install - ComfyUI Manager → search "ComfyUI_KimNodes" → Install → Restart, or:

    cd ComfyUI/custom_nodes && git clone https://github.com/wjl0313/ComfyUI_KimNodes
    

    No extra dependencies at all - this node is pure string comparison.

    Common issues

    • Files always end up in the false folder - your tagger isn't emitting a clean "true"/"false". Many classifier nodes output things like "1"/"0", "yes"/"no", or full labels. This node only understands the literal string "true", so you may need a text-matching node in front to normalize.
    • true_path gets a folder that doesn't exist - the node just returns the string; it doesn't create folders. Whatever consumes the path is responsible for that.
    • You expected an image classifier - that's the trap. If you want actual image classification, this isn't it; grab a WD14 tagger or a CLIP-based scorer. This node is the routing half.

    Once you accept it for what it is - a three-string switch - it slots neatly into automated sorting pipelines, and it's refreshingly honest about doing nothing else.

    Category🍒 Kim-Nodes/🔍Text_Tools | 文本工具

    Inputs (3)

    NameTypeDefaultDescription
    text_tagSTRING
    true_pathSTRING/path/to/true_output
    false_pathSTRING/path/to/false_output

    Outputs (1)

    NameTypeDescription
    output_pathSTRING