Nodes/ComfyUI Batch BBox Detector/Load Image Dataset from Folder (Sorted)
ComfyUI Node

Load Image Dataset from Folder (Sorted)

The batch image loader that actually keeps frame_2 before frame_10

By rslosh·Created 11 months ago·Updated 5 months ago· 1
Load Image Dataset from Folder (Sorted)
    • IMAGE
    folder
    resize_methodNone
    sort_orderAscending
    natural_sorttrue
    case_sensitivefalse

    If you've ever loaded a folder of video frames and watched the batch come in as frame_1, frame_10, frame_2, you know the pain this node exists to kill. Load Image Dataset from Folder (Sorted) is the part of the NodeSweet pack that dumps every image in a ComfyUI input subfolder into one IMAGE batch, ordered by filename - with a natural sort that treats frame_2 as coming before frame_10, the way a human would, instead of the way a lexicographic string compare does. It's the boring, load-bearing half of any "process 300 frames" workflow, and it's the node people usually find when they stop fighting the default image loader.

    The built-in Load Image node loads one image, and the community loaders that do folders tend to sort dumb. This one doesn't. It lists the subfolder you pick from the dropdown, filters to image extensions (png, jpg, jpeg, webp, bmp, gif, tif, and friends), then loads them all through ComfyUI's own load_and_process_images helper and stacks them into a single [B, H, W, C] tensor. Sorting is the whole personality: natural_sort is on by default (that's the regex-split-the-digits trick), and case_sensitive is off, which is usually what you want for IMG_1 vs img_2 collections.

    The inputs a beginner actually touches:

    • folder - a dropdown of your ComfyUI/input subfolders. Required, and it's the whole point: pick the folder, load everything in it.
    • natural_sort (default on) - leave it on unless your filenames are already zero-padded.
    • sort_order - Ascending (default), Descending, or None if you don't care about order.
    • resize_method - None (default), Stretch, Crop, or Pad. This one is the trap: if your folder holds mixed sizes and you leave it on None, the internal torch.cat throws and the node fails. Set it to Pad or Crop when your frames aren't uniform and the node resizes everything to the largest dimensions in the folder.

    There's one output, IMAGE - a single batched tensor you can wire straight into the pack's own BboxDetectorBatchChunked, an AnimateDiff-style per-frame pass, or PreviewImage to eyeball the order.

    Install is the same as every NodeSweet node: ComfyUI Manager → search "Batch BBox Detector" (the pack's registry title) → Install, or

    cd ComfyUI/custom_nodes && git clone https://github.com/rslosch/comfyui-nodesweet
    

    then restart ComfyUI. No extra models, no Python deps beyond what ComfyUI already ships - it leans on comfy_extras.nodes_dataset from core.

    Where people get burned: a 300-frame 1080p folder is a large tensor living entirely in RAM. Downscale or slice before you load if your frames are huge, and don't expect a 4K frame dump to be kind to your machine. And remember it loads everything in the folder - there's no filename filter, so a stray screenshot sitting next to your frames will happily join the batch.

    Categoryloaders

    Inputs (5)

    NameTypeDefaultDescription
    folderCOMBOThe folder to load images from.
    resize_methodoptCOMBONone4 options: None, Stretch, Crop, Pad
    sort_orderoptCOMBOAscendingSort images by filename.
    natural_sortoptBOOLEANtrueUse natural sort (e.g. img2.png before img10.png).
    case_sensitiveoptBOOLEANfalseCase-sensitive sorting.

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE