Nodes/ComfyUI-mnemic-nodes/πŸ–ΌοΈ+πŸ“ Load Text-Image Pair (Single)
ComfyUI Node

πŸ–ΌοΈ+πŸ“ Load Text-Image Pair (Single)

Spot-check one caption/image pair from a dataset

By MNeMoNiCuZΒ·Created 3 years agoΒ·Updated 23 days agoΒ· 105
πŸ–ΌοΈ+πŸ“ Load Text-Image Pair (Single)
  • image_input
  • image_single
  • string_single
  • image_path_single
  • image_filename_single
  • total_count
β—„seed0β–Ί
β—„folder_pathβ–Ί
β—„text_inputβ€”β–Ί
β—„text_format_extensiontxtβ–Ί

If you've got a folder set up dataset-style - image1.png sitting next to image1.txt, same basename, the standard convention for LoRA and finetune captioning - this node is the spot-check tool. It loads exactly one pair, picked by index, and hands you both halves plus the bookkeeping you need to know where you are in the set.

How it works

Point folder_path at the dataset and it matches image files to text files by basename. seed is the index - pick which pair comes back. It also accepts image_input and text_input directly as connections from elsewhere in the graph, and those take priority over folder_path whenever they're wired up, which matters if your pairs are being produced earlier in the workflow rather than sitting on disk. text_format_extension controls which caption file extension it looks for (default txt), useful if your captions use something else like .caption.

The inputs and outputs that matter

  • seed - the index of the pair to load.
  • folder_path - the dataset folder. Only used if image_input/text_input aren't connected.
  • image_input / text_input (optional) - direct connections, override folder_path when present.
  • text_format_extension (optional, default txt) - the caption file extension to match.

Outputs: image_single, string_single (the matched caption), image_path_single, image_filename_single, and total_count (how many pairs exist in the whole dataset).

How to install it

Via ComfyUI Manager: search ComfyUI-mnemic-nodes, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/MNeMoNiCuZ/ComfyUI-mnemic-nodes

Restart ComfyUI. No model downloads or extra dependencies - it's reading local files.

Common issues & troubleshooting

A pair comes back with an empty caption. Matching is strictly by basename - image1.png needs an image1.txt (or whatever extension you've set) sitting in the same folder. A missing or misnamed caption file just produces an empty string_single for that pair rather than an error, so a quiet mismatch can slip through unless you're specifically checking for it.

The output looks wrong even though folder_path seems right. Check whether image_input or text_input is wired up - if either is connected, folder_path is silently ignored entirely, which is an easy thing to forget once a graph has grown a few nodes.

Why this over just loading the folder directly? It's the right tool specifically for QC - stepping through a dataset one caption at a time to catch bad, truncated, or missing captions before you burn GPU hours on a training run that inherited them. For processing the whole dataset in one shot instead of one pair at a time, this pack's sibling node Load Text-Image Pairs (List) is the one to reach for.

Categorysd

Inputs (5)

NameTypeDefaultDescription
seedINT00–18446744073709550000The index of the pair to load.
folder_pathSTRINGPath to a folder containing image and text files with matching basenames. This is used only if image_input and text_input are not connected.
image_inputoptIMAGEA single image or a list/batch of images. This input has priority over the folder_path.
text_inputoptSTRINGA single text string or a list of strings. This input has priority over the folder_path.
text_format_extensionoptSTRINGtxtThe file extension for the text files to look for (without the dot).

Outputs (5)

NameTypeDescription
image_singleIMAGEThe single image selected by the seed.
string_singleSTRINGThe text string that is paired with the selected image.
image_path_singleSTRINGThe full absolute path of the selected image.
image_filename_singleSTRINGThe filename (without extension) of the selected image.
total_countINTThe total number of pairs found in the dataset.