Nodes/Comfyui_PDuse/PD双图批处理(列表输入)
ComfyUI Node

PD双图批处理(列表输入)

PD双图批处理(列表输入) — pair up your _R and _T image sets without eyeballing filenames

By 7BEII·Created 2 years ago·Updated 15 days ago· 53
PD双图批处理(列表输入)
  • image1_list
  • image2_list
  • image1_batch
  • image2_batch
  • info
name1_list
name2_list
name1_suffixR
name2_suffixT
seed0
only_firstfalse

Training data workflows live on paired image sets: 65_R.png and 65_T.png, same base name, different variant suffix - the convention behind most AI Toolkit-style caption setups. If you've ever tried to feed both sides of a pairing into ComfyUI as two aligned batches, you know the pain: the load order of two folders almost never matches, and a silent misalignment corrupts every pair downstream.

This node (the display name is Chinese: PD双图批处理(列表输入) - "dual-image batch processing, list input") is the fix. It takes two image lists plus two filename lists, matches them by name, and spits out two aligned batches with an info string telling you exactly what matched and how. The README frames it as smart filename matching supporting suffix, prefix, and replacement strategies - which is exactly what _R/_T pairing needs.

How it works

The key mechanic is INPUT_IS_LIST = True: ComfyUI is told not to auto-collapse your lists into a single batch, so the node sees each image separately and can pair them one-to-one. It parses name1_list/name2_list (one name per line) and runs a matching ladder against name1_suffix/name2_suffix (defaults R and T):

  1. Suffix - 65_T pairs with 65_R (and _T/_R with underscores).
  2. Prefix - T1_00001 pairs with R1_00001.
  3. Replacement - 65_T_00001 pairs with 65_R_00001 by swapping the token in the middle.

It validates that the number of names equals the number of images per side, errors loudly if a match is missing, and with only_first on, returns just the first pair. The seed input seeds the RNG for reproducibility, but the pairing itself is deterministic name-matching - you can leave it at 0.

The inputs that matter

  • image1_list / image2_list (IMAGE) - the two sets.
  • name1_list / name2_list (STRING, multiline) - filenames, one per line, same order as the images.
  • name1_suffix / name2_suffix (STRING, defaults R/T) - the tokens that distinguish the two sets.
  • seed (INT) and only_first (BOOLEAN, default off).

Outputs: image1_batch and image2_batch (both image lists), plus info (STRING) with the match report.

The honest gotchas

This node expects you to already have the images in ComfyUI with their names available - you pair it with the pack's list-producing loaders (like the ZIP/txt list readers) or any loader that also emits filenames. If you've got two folders on disk instead of in-memory lists, use the pack's PDimage_dual_batch_v1, which takes folder paths directly - same matching logic, no name typing.

And the requirement that name-count equals image-count is strict. If ComfyUI collapses your list into one batch upstream (a batch tensor, not a list), the node will tell you counts don't match. When that happens, check what's actually on the wire before blaming the node.

Install

ComfyUI Manager: search PDuse (repo 7BEII/Comfyui_PDuse), install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/7BEII/Comfyui_PDuse
cd Comfyui_PDuse
pip install -r requirements.txt

Restart and it appears under PDuse/Image (search PD双图批处理 or PDimage_dual_batch). For caption/training pairs where alignment is non-negotiable, this is the node that removes the manual cross-check.

CategoryPDuse/Image

Inputs (8)

NameTypeDefaultDescription
image1_listIMAGE
image2_listIMAGE
name1_listSTRING
name2_listSTRING
name1_suffixSTRINGR
name2_suffixSTRINGT
seedINT00–18446744073709550000
only_firstBOOLEANfalse

Outputs (3)

NameTypeDescription
image1_batchIMAGE
image2_batchIMAGE
infoSTRING