Nodes/comfy_Pond_Nodes/🐳批量加载
ComfyUI Node

🐳批量加载

The folder loader that actually reads your whole dataset

By Pondowner857·Created about a year ago·Updated 21 days ago· 45
🐳批量加载
    • 图像批次
    • 文本内容
    • 文件总数
    • 文件信息
    • 统计信息
    folder_path
    file_type图像
    batch_size1
    start_index0
    shufflefalse
    seed-1
    group_by
    resize_mode
    target_size512
    text_mode配对

    Smart Batch Loader (🐳批量加载) is the node you reach for when the stock Load Image stops scaling: instead of dragging fifty files into a node, point this at a folder and let it hand you batches of images, text captions, or paired image+text - optionally shuffled, grouped, and resized on the way in. It's the front door for batch img2img, caption-based workflows, and any "run this over a whole directory" job where you don't want to rebuild the graph per file.

    Mechanically it's a folder scanner with opinions. You give it a folder_path, pick a file_type (图像 image, 文本 text, 混合 mixed, or 图像+文本 image+text pairing), and it lists the matching files. batch_size (1-64) sets how many it returns per run, start_index picks where in the list to begin (with wraparound, so it never runs out of files), and shuffle + seed (seed -1 means random each run) give you reproducible shuffling for training or variety jobs. group_by (extension, prefix, or date) is the interesting one - it groups files and then loads from the largest group, which is how you say "only the jpgs, not the pngs" or "only this batch's numbered prefix" without pre-sorting the folder.

    resize_mode + target_size handle the resolution question at load time: 缩放 (resize, aspect-preserving via LANCZOS), 裁剪 (center crop to a square target), or 填充 (pad with black to the target). Doing this at load keeps the rest of your graph simple - every image arrives at a uniform size, which a batch workflow generally needs anyway.

    The outputs

    Five outputs, and most of them are about knowing what you loaded:

    • 图像批次 - the actual IMAGE batch
    • 文本内容 - the loaded text/caption (in image+text mode, paired by filename or picked randomly via text_mode)
    • 文件总数 - count, handy for wiring into loops or math
    • 文件信息 - a LIST of per-file details
    • 统计信息 - a DICT with stats

    That metadata pair is the reason this node beats a plain Load Image loop - you can log what ran, or wire 文件总数 into a counter for a controlled loop over every file. It's also marked as an output node, so it behaves like a proper entry point you build a workflow around.

    Honest gripes: batch_size with a fixed start_index means consecutive runs don't advance the window by themselves - you have to move start_index between runs, or rely on shuffle. And "mixed" mode is a grab-bag; if your folder has both images and text and you actually want them paired, use 图像+文本 mode instead.

    Install

    Part of Pond Nodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Pondowner857/comfy_Pond_Nodes
    cd comfy_Pond_Nodes
    pip install -r requirements.txt
    

    Restart after (or Manager → search "comfy_Pond_Nodes"). No model files needed. The README's standing caveat applies: if your console is spammed after install, the pack conflicts with comfyui_HiDream-Sampler - drop one of them.

    Category🐳Pond/Tools

    Inputs (10)

    NameTypeDefaultDescription
    folder_pathSTRING
    file_typeCOMBO图像4 options: 图像, 文本, 混合, 图像+文本
    batch_sizeINT11–64
    start_indexINT00–99999
    shuffleBOOLEANfalse
    seedINT-1-1–18446744073709550000
    group_byCOMBO4 options: 无, 扩展名, 前缀, 日期
    resize_modeCOMBO4 options: 无, 缩放, 裁剪, 填充
    target_sizeINT51264–2048
    text_modeCOMBO配对2 options: 配对, 随机

    Outputs (5)

    NameTypeDescription
    图像批次IMAGE
    文本内容STRING
    文件总数INT
    文件信息LIST
    统计信息DICT