Nodes/Comfyui_CXH_joy_caption/CXH_Min2_6_classifiy
ComfyUI Node

CXH_Min2_6_classifiy

Sort a folder of images into category folders automatically

By StartHua·Created 2 years ago·Updated 2 years ago· 624
CXH_Min2_6_classifiy
  • pipe
    img_dir
    save_dir
    prompt You are a fashion image classifier. Analyze clothing images following these priority rules and categories. When an item could fit multiple categories, use the highest priority category. Priority Order (Highest to Lowest): 1. MAN 2. WoMAN Required Output Format: [CATEGORY_NAME] Classification Rules: 1. Always check categories in order from highest to lowest priority 2. Use the highest priority category that applies 3. Output only the category name in all caps 4. No additional text or explanations in output
    format
    max_tokens1024
    temperature0.70
    seed656545

    CXH_Min2_6_classifiy (note the author's spelling - "classifiy") is the pack's batch image classifier: it walks a folder of images, asks MiniCPM-V 2.6 to categorize each one, and copies it into a per-category subfolder under your save_dir. Added in late 2024 per the README's changelog, it's a dataset-organization tool, not a captioner - you'd use it before captioning, to split a mixed pile of reference images into clean per-class training folders.

    The default prompt is a fashion-image classifier: it sorts clothing photos into MAN or WoMAN folders by priority order, and demands a specific output format (a bare [CATEGORY_NAME] in caps, nothing else). That's the author's own use case, but the prompt is fully editable - you can redefine the categories to anything the model can label ("landscape|portrait|product", "photo|art|screenshot", whatever).

    How it works

    For every image it runs the MiniCPM-V chat API with the image plus your classification instructions, takes the model's reply as a category name, strips any surrounding brackets, and creates/copies the image into save_dir/<category>/. Two safety valves in the source:

    • If the reply is over 80 characters it's treated as a failure and filed under UNKNOWN (protects against the model rambling instead of answering).
    • Original filenames are preserved, so you can trace every file back.

    There are no outputs - this is an OUTPUT_NODE; the results are the folders it creates. It prints progress (n/total: X.XXXs) to the console.

    Inputs

    • pipe - from CXH_HG_Model_Load (MiniCPM-V 2.6).
    • img_dir - source folder of images.
    • save_dir - destination; category subfolders get created here.
    • prompt - the classification rules (default: the fashion MAN/WoMAN rules).
    • format - png or jpg for the copied files (jpg converts RGBA → RGB automatically).
    • max_tokens, temperature, seed - generation controls.

    Installing

    Pack install - ComfyUI Manager (search "Comfyui_CXH_joy_caption") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/StartHua/Comfyui_CXH_joy_caption
    cd Comfyui_CXH_joy_caption
    python -m pip install -r requirements.txt
    

    Gotchas

    • Category names become folder names, so keep them filesystem-safe (no /, no trailing dots). The default prompt's [CATEGORY_NAME] format exists precisely so the folder names come out clean.
    • It copies, it doesn't move - your originals stay put. Free, just disk-hungry on big folders.
    • The MAN/WoMAN default is two-category. Add your own categories to the prompt's rules and the model will use them; just keep the "output only the category name" instruction intact or the UNKNOWN bucket fills up.
    • Misspelled node name: it's CXH_Min2_6_classifiy (class-i-f-i-y). Search for "classifiy" in ComfyUI Manager, not "classify".
    • NVIDIA-friendly like the rest of the MiniCPM route; expects a GPU.
    CategoryCXH/LLM

    Inputs (8)

    NameTypeDefaultDescription
    pipeCXH_Hg_Pipe
    img_dirSTRING
    save_dirSTRING
    promptSTRING You are a fashion image classifier. Analyze clothing images following these priority rules and categories. When an item could fit multiple categories, use the highest priority category. Priority Order (Highest to Lowest): 1. MAN 2. WoMAN Required Output Format: [CATEGORY_NAME] Classification Rules: 1. Always check categories in order from highest to lowest priority 2. Use the highest priority category that applies 3. Output only the category name in all caps 4. No additional text or explanations in output
    formatCOMBO2 options: png, jpg
    max_tokensINT102410–4048
    temperatureFLOAT0.700–1
    seedINT6565450–1000000

    Outputs (0)

    No outputs